test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] Qemu kvm module support login parameter
@ 2015-06-24  9:23 Yong Liu
  2015-06-25  2:30 ` Xu, HuilongX
  0 siblings, 1 reply; 6+ messages in thread
From: Yong Liu @ 2015-06-24  9:23 UTC (permalink / raw)
  To: dts

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-29  3:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24  9:23 [dts] [PATCH] Qemu kvm module support login parameter Yong Liu
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

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).