[dts] [PATCH] Qemu kvm module support login parameter

Liu, Yong yong.liu at intel.com
Fri Jun 26 03:03:25 CEST 2015


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 at 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 at 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 at 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 at dpdk.org] On Behalf Of Yong Liu
> > > > Sent: Wednesday, June 24, 2015 5:23 PM
> > > > To: dts at dpdk.org
> > > > Subject: [dts] [PATCH] Qemu kvm module support login parameter
> > > >
> > > > From: Marvin Liu <yong.liu at 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 at 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



More information about the dts mailing list