test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] Qemu kvm module support login parameter
Date: Wed, 24 Jun 2015 17:23:19 +0800	[thread overview]
Message-ID: <1435137799-23294-1-git-send-email-yong.liu@intel.com> (raw)

From: Marvin Liu <yong.liu@intel.com>

Default vm username and password are the same as host.
User can change the default values by login parameter.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index d149524..36622b5 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -92,6 +92,10 @@ class QEMUKvm(VirtBase):
         # devices pass-through into vm
         self.pt_devices = []
 
+        # default login user,password
+        self.username = dut.crb['user']
+        self.password = dut.crb['pass']
+
     def set_vm_default(self):
         self.set_vm_name(self.vm_name)
         self.set_vm_enable_kvm()
@@ -282,6 +286,22 @@ class QEMUKvm(VirtBase):
             disk_boot_line = '-drive file=%s' % options['file']
             self.__add_boot_line(disk_boot_line)
 
+    def add_vm_login(self, **options):
+        """
+        user: login username of virtual machine
+        password: login password of virtual machine
+        """
+        if 'user' in options.keys():
+            user = options['user']
+            self.username = user
+
+        if 'password' in options.keys():
+            password = options['password']
+            self.password = password
+
+    def get_vm_login(self):
+        return (self.username, self.password)
+
     def set_vm_net(self, **options):
         index = self.find_option_index('net')
         if index:
diff --git a/framework/virt_base.py b/framework/virt_base.py
index 9a0035d..063342f 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -294,6 +294,9 @@ class VirtBase(object):
         crb['bypass core0'] = False
         vm_ip = self.get_vm_ip()
         crb['IP'] = vm_ip
+        username, password = self.get_vm_login()
+        crb['user'] = username
+        crb['pass'] = password
 
         # remove default key
         remove_old_rsa_key(self.host_dut.tester, crb['IP'])
-- 
1.9.3

             reply	other threads:[~2015-06-24  9:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  9:23 Yong Liu [this message]
2015-06-25  2:30 ` Xu, HuilongX
2015-06-25  2:51   ` Liu, Yong
2015-06-25  2:57     ` Xu, HuilongX
2015-06-26  1:03       ` Liu, Yong
2015-06-29  3:26         ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435137799-23294-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).