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

* Re: [dts] [PATCH] Qemu kvm module support login parameter
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Xu, HuilongX @ 2015-06-25  2:30 UTC (permalink / raw)
  To: Liu, Yong, dts

Hi yong,
Would check my comments as below?

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu
> Sent: Wednesday, June 24, 2015 5:23 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH] Qemu kvm module support login parameter
> 
> 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
> +        """
           You can used "user" in options replace check dict key is exist
> +        if 'user' in options.keys():
               Would you used self.username = options['user']?
> +            user = options['user']
> +            self.username = user
> +
           The comments same with last coments
> +        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

* Re: [dts] [PATCH] Qemu kvm module support login parameter
  2015-06-25  2:30 ` Xu, HuilongX
@ 2015-06-25  2:51   ` Liu, Yong
  2015-06-25  2:57     ` Xu, HuilongX
  0 siblings, 1 reply; 6+ messages in thread
From: Liu, Yong @ 2015-06-25  2:51 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Huilong,
See my comments below.

> -----Original Message-----
> From: Xu, HuilongX
> Sent: Thursday, June 25, 2015 10:31 AM
> To: Liu, Yong; dts@dpdk.org
> Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> 
> Hi yong,
> Would check my comments as below?
> 
> > -----Original Message-----
> > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu
> > Sent: Wednesday, June 24, 2015 5:23 PM
> > To: dts@dpdk.org
> > Subject: [dts] [PATCH] Qemu kvm module support login parameter
> >
> > 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
> > +        """
>            You can used "user" in options replace check dict key is exist

Huilong,
All parameters in virtual machine are optional.
We can't make sure that both "user" and "password" those two parameters supplied by users.
So we need to check them and if the key existed then use the value.

> > +        if 'user' in options.keys():
>                Would you used self.username = options['user']?
> > +            user = options['user']
> > +            self.username = user
> > +
>            The comments same with last coments
> > +        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

* Re: [dts] [PATCH] Qemu kvm module support login parameter
  2015-06-25  2:51   ` Liu, Yong
@ 2015-06-25  2:57     ` Xu, HuilongX
  2015-06-26  1:03       ` Liu, Yong
  0 siblings, 1 reply; 6+ messages in thread
From: Xu, HuilongX @ 2015-06-25  2:57 UTC (permalink / raw)
  To: Liu, Yong, dts

Hi yong,
dts need run with python2.7.
In python2.7 used if "key" in "dict" replace if "key" in dict.keys() to check "key" in "dict"
This function add in python from python2.3

Thanks  a lot

> -----Original Message-----
> From: Liu, Yong
> Sent: Thursday, June 25, 2015 10:51 AM
> To: Xu, HuilongX; dts@dpdk.org
> Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> 
> Huilong,
> See my comments below.
> 
> > -----Original Message-----
> > From: Xu, HuilongX
> > Sent: Thursday, June 25, 2015 10:31 AM
> > To: Liu, Yong; dts@dpdk.org
> > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> >
> > Hi yong,
> > Would check my comments as below?
> >
> > > -----Original Message-----
> > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu
> > > Sent: Wednesday, June 24, 2015 5:23 PM
> > > To: dts@dpdk.org
> > > Subject: [dts] [PATCH] Qemu kvm module support login parameter
> > >
> > > 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
> > > +        """
> >            You can used "user" in options replace check dict key is
> exist
> 
> Huilong,
> All parameters in virtual machine are optional.
> We can't make sure that both "user" and "password" those two parameters
> supplied by users.
> So we need to check them and if the key existed then use the value.
> 
> > > +        if 'user' in options.keys():
> >                Would you used self.username = options['user']?
> > > +            user = options['user']
> > > +            self.username = user
> > > +
> >            The comments same with last coments
> > > +        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

* Re: [dts] [PATCH] Qemu kvm module support login parameter
  2015-06-25  2:57     ` Xu, HuilongX
@ 2015-06-26  1:03       ` Liu, Yong
  2015-06-29  3:26         ` Liu, Yong
  0 siblings, 1 reply; 6+ messages in thread
From: Liu, Yong @ 2015-06-26  1:03 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Huilong,
Can you give us more information about python compatibility, our framework should compatible with python 3.0.

> -----Original Message-----
> From: Xu, HuilongX
> Sent: Thursday, June 25, 2015 10:57 AM
> To: Liu, Yong; dts@dpdk.org
> Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> 
> Hi yong,
> dts need run with python2.7.
> In python2.7 used if "key" in "dict" replace if "key" in dict.keys() to
> check "key" in "dict"
> This function add in python from python2.3
> 
> Thanks  a lot
> 
> > -----Original Message-----
> > From: Liu, Yong
> > Sent: Thursday, June 25, 2015 10:51 AM
> > To: Xu, HuilongX; dts@dpdk.org
> > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> >
> > Huilong,
> > See my comments below.
> >
> > > -----Original Message-----
> > > From: Xu, HuilongX
> > > Sent: Thursday, June 25, 2015 10:31 AM
> > > To: Liu, Yong; dts@dpdk.org
> > > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> > >
> > > Hi yong,
> > > Would check my comments as below?
> > >
> > > > -----Original Message-----
> > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu
> > > > Sent: Wednesday, June 24, 2015 5:23 PM
> > > > To: dts@dpdk.org
> > > > Subject: [dts] [PATCH] Qemu kvm module support login parameter
> > > >
> > > > 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
> > > > +        """
> > >            You can used "user" in options replace check dict key is
> > exist
> >
> > Huilong,
> > All parameters in virtual machine are optional.
> > We can't make sure that both "user" and "password" those two parameters
> > supplied by users.
> > So we need to check them and if the key existed then use the value.
> >
> > > > +        if 'user' in options.keys():
> > >                Would you used self.username = options['user']?
> > > > +            user = options['user']
> > > > +            self.username = user
> > > > +
> > >            The comments same with last coments
> > > > +        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

* Re: [dts] [PATCH] Qemu kvm module support login parameter
  2015-06-26  1:03       ` Liu, Yong
@ 2015-06-29  3:26         ` Liu, Yong
  0 siblings, 0 replies; 6+ messages in thread
From: Liu, Yong @ 2015-06-29  3:26 UTC (permalink / raw)
  To: Liu, Yong, Xu, HuilongX, dts

Huilong,
Can't get your words from python document listed below. This patch will be merged first. If not match python code style, we will fix it in additional patches.

https://docs.python.org/2/library/stdtypes.html#dict
https://www.python.org/dev/peps/pep-0008/#names-to-avoid

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Liu, Yong
> Sent: Friday, June 26, 2015 9:03 AM
> To: Xu, HuilongX; dts@dpdk.org
> Subject: Re: [dts] [PATCH] Qemu kvm module support login parameter
> 
> Huilong,
> Can you give us more information about python compatibility, our framework
> should compatible with python 3.0.
> 
> > -----Original Message-----
> > From: Xu, HuilongX
> > Sent: Thursday, June 25, 2015 10:57 AM
> > To: Liu, Yong; dts@dpdk.org
> > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> >
> > Hi yong,
> > dts need run with python2.7.
> > In python2.7 used if "key" in "dict" replace if "key" in dict.keys() to
> > check "key" in "dict"
> > This function add in python from python2.3
> >
> > Thanks  a lot
> >
> > > -----Original Message-----
> > > From: Liu, Yong
> > > Sent: Thursday, June 25, 2015 10:51 AM
> > > To: Xu, HuilongX; dts@dpdk.org
> > > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> > >
> > > Huilong,
> > > See my comments below.
> > >
> > > > -----Original Message-----
> > > > From: Xu, HuilongX
> > > > Sent: Thursday, June 25, 2015 10:31 AM
> > > > To: Liu, Yong; dts@dpdk.org
> > > > Subject: RE: [dts] [PATCH] Qemu kvm module support login parameter
> > > >
> > > > Hi yong,
> > > > Would check my comments as below?
> > > >
> > > > > -----Original Message-----
> > > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu
> > > > > Sent: Wednesday, June 24, 2015 5:23 PM
> > > > > To: dts@dpdk.org
> > > > > Subject: [dts] [PATCH] Qemu kvm module support login parameter
> > > > >
> > > > > 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
> > > > > +        """
> > > >            You can used "user" in options replace check dict key is
> > > exist
> > >
> > > Huilong,
> > > All parameters in virtual machine are optional.
> > > We can't make sure that both "user" and "password" those two
> parameters
> > > supplied by users.
> > > So we need to check them and if the key existed then use the value.
> > >
> > > > > +        if 'user' in options.keys():
> > > >                Would you used self.username = options['user']?
> > > > > +            user = options['user']
> > > > > +            self.username = user
> > > > > +
> > > >            The comments same with last coments
> > > > > +        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).