* [PATCH v1] framework/qemu_kvm: fix pylama errors @ 2021-12-06 12:21 Juraj Linkeš 2021-12-16 3:15 ` Dong, JunX 2022-01-19 12:11 ` [PATCH v2] " Juraj Linkeš 0 siblings, 2 replies; 6+ messages in thread From: Juraj Linkeš @ 2021-12-06 12:21 UTC (permalink / raw) To: lijuan.tu, ohilyard; +Cc: dts, Juraj Linkeš Pylama found the following errors: framework/qemu_kvm.py:1498: [E] E0602 Undefined variable 'assgined_pcis_info' [pylint] framework/qemu_kvm.py:1508: [E] E0602 Undefined variable 'assinged_pcis_info' [pylint] framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no '__vf_has_been_assinged' member [pylint] framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments for method call [pylint] framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as first argument [pylint] framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> --- Lijuan, please add additional people to review if needed. --- framework/qemu_kvm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index 515a4c04..32cd668e 100644 --- a/framework/qemu_kvm.py +++ b/framework/qemu_kvm.py @@ -1495,7 +1495,7 @@ class QEMUKvm(VirtBase): if self.__is_vf_pci(pci): assigned_pcis_info[pci]['is_vf'] = True pf_pci = self.__map_vf_to_pf(pci) - assgined_pcis_info[pci]['pf_pci'] = pf_pci + assigned_pcis_info[pci]['pf_pci'] = pf_pci if self.virt_pool.alloc_vf_from_pf(vm=self.vm_name, pf_pci=pf_pci, *[pci]): @@ -1505,7 +1505,7 @@ class QEMUKvm(VirtBase): else: # check that if any VF of specified PF has been # used, raise exception - vf_pci = self.__vf_has_been_assinged(pci, **assinged_pcis_info) + vf_pci = self.__vf_has_been_assigned(pci, **assigned_pcis_info) if vf_pci: raise Exception( "Error: A VF [%s] generated by PF [%s] has " % @@ -1584,7 +1584,7 @@ class QEMUKvm(VirtBase): """ Get IP which VM is connected by bridge. """ - out = self.control_command('ping', '60') + out = self.control_command('ping') if not out: time.sleep(10) out = self.control_command('ifconfig') @@ -1730,6 +1730,7 @@ class QEMUKvm(VirtBase): return cores + @staticmethod def handle_control_session(func): """ Wrapper function to handle serial port, must return serial to host session -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v1] framework/qemu_kvm: fix pylama errors 2021-12-06 12:21 [PATCH v1] framework/qemu_kvm: fix pylama errors Juraj Linkeš @ 2021-12-16 3:15 ` Dong, JunX 2022-01-19 12:11 ` [PATCH v2] " Juraj Linkeš 1 sibling, 0 replies; 6+ messages in thread From: Dong, JunX @ 2021-12-16 3:15 UTC (permalink / raw) To: Juraj Linkeš, Tu, Lijuan, ohilyard; +Cc: dts > -----Original Message----- > From: Juraj Linkeš <juraj.linkes@pantheon.tech> > Sent: Monday, December 6, 2021 8:22 PM > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech> > Subject: [PATCH v1] framework/qemu_kvm: fix pylama errors > > Pylama found the following errors: > framework/qemu_kvm.py:1498: [E] E0602 Undefined variable > 'assgined_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E0602 Undefined variable > 'assinged_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no > '__vf_has_been_assinged' member [pylint] > framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments > for method call [pylint] > framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as first > argument [pylint] > framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> > --- > Lijuan, please add additional people to review if needed. > --- > framework/qemu_kvm.py | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index > 515a4c04..32cd668e 100644 > --- a/framework/qemu_kvm.py > +++ b/framework/qemu_kvm.py > @@ -1495,7 +1495,7 @@ class QEMUKvm(VirtBase): > if self.__is_vf_pci(pci): > assigned_pcis_info[pci]['is_vf'] = True > pf_pci = self.__map_vf_to_pf(pci) > - assgined_pcis_info[pci]['pf_pci'] = pf_pci > + assigned_pcis_info[pci]['pf_pci'] = pf_pci > if self.virt_pool.alloc_vf_from_pf(vm=self.vm_name, > pf_pci=pf_pci, > *[pci]): > @@ -1505,7 +1505,7 @@ class QEMUKvm(VirtBase): > else: > # check that if any VF of specified PF has been > # used, raise exception > - vf_pci = self.__vf_has_been_assinged(pci, **assinged_pcis_info) > + vf_pci = self.__vf_has_been_assigned(pci, > + **assigned_pcis_info) > if vf_pci: > raise Exception( > "Error: A VF [%s] generated by PF [%s] has " % @@ -1584,7 > +1584,7 @@ class QEMUKvm(VirtBase): > """ > Get IP which VM is connected by bridge. > """ > - out = self.control_command('ping', '60') > + out = self.control_command('ping') > if not out: > time.sleep(10) > out = self.control_command('ifconfig') @@ -1730,6 +1730,7 @@ class > QEMUKvm(VirtBase): > > return cores > > + @staticmethod Because below method used as decorator, so if it was decorated by staticmethod description, it will introduce issues same as nics/net_device module. > def handle_control_session(func): > """ > Wrapper function to handle serial port, must return serial to host session > -- > 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] framework/qemu_kvm: fix pylama errors 2021-12-06 12:21 [PATCH v1] framework/qemu_kvm: fix pylama errors Juraj Linkeš 2021-12-16 3:15 ` Dong, JunX @ 2022-01-19 12:11 ` Juraj Linkeš 2022-01-25 5:12 ` Dong, JunX 1 sibling, 1 reply; 6+ messages in thread From: Juraj Linkeš @ 2022-01-19 12:11 UTC (permalink / raw) To: lijuan.tu, ohilyard, junx.dong; +Cc: dts, Juraj Linkeš Pylama found the following errors: framework/qemu_kvm.py:1498: [E] E0602 Undefined variable 'assgined_pcis_info' [pylint] framework/qemu_kvm.py:1508: [E] E0602 Undefined variable 'assinged_pcis_info' [pylint] framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no '__vf_has_been_assinged' member [pylint] framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments for method call [pylint] framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as first argument [pylint] framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> --- Lijuan, please add additional people to review if needed. --- framework/qemu_kvm.py | 62 ++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index 515a4c04..fc31ca09 100644 --- a/framework/qemu_kvm.py +++ b/framework/qemu_kvm.py @@ -44,6 +44,35 @@ from .virt_base import ST_NOTSTART, ST_PAUSE, ST_RUNNING, ST_UNKNOWN, VirtBase QGA_DEV_NAME = 'org.qemu.guest_agent.0' +def handle_control_session(func): + """ + Wrapper function to handle serial port, must return serial to host session + """ + def _handle_control_session(self, command): + # just raise error if connect failed, for func can't all any more + try: + if self.control_type == 'socket': + assert (self.connect_serial_port(name=self.vm_name)), "Can't connect to serial socket" + elif self.control_type == 'telnet': + assert (self.connect_telnet_port(name=self.vm_name)), "Can't connect to serial port" + else: + assert (self.connect_qga_port(name=self.vm_name)), "Can't connect to qga port" + except: + return 'Failed' + + try: + out = func(self, command) + self.quit_control_session() + return out + except Exception as e: + print(RED("Exception happened on [%s] serial with cmd [%s]" % (self.vm_name, command))) + print(RED(e)) + self.close_control_session(dut_id=self.host_dut.dut_id) + return 'Failed' + + return _handle_control_session + + class QEMUKvm(VirtBase): DEFAULT_BRIDGE = 'br0' @@ -1495,7 +1524,7 @@ class QEMUKvm(VirtBase): if self.__is_vf_pci(pci): assigned_pcis_info[pci]['is_vf'] = True pf_pci = self.__map_vf_to_pf(pci) - assgined_pcis_info[pci]['pf_pci'] = pf_pci + assigned_pcis_info[pci]['pf_pci'] = pf_pci if self.virt_pool.alloc_vf_from_pf(vm=self.vm_name, pf_pci=pf_pci, *[pci]): @@ -1505,7 +1534,7 @@ class QEMUKvm(VirtBase): else: # check that if any VF of specified PF has been # used, raise exception - vf_pci = self.__vf_has_been_assinged(pci, **assinged_pcis_info) + vf_pci = self.__vf_has_been_assigned(pci, **assigned_pcis_info) if vf_pci: raise Exception( "Error: A VF [%s] generated by PF [%s] has " % @@ -1584,7 +1613,7 @@ class QEMUKvm(VirtBase): """ Get IP which VM is connected by bridge. """ - out = self.control_command('ping', '60') + out = self.control_command('ping') if not out: time.sleep(10) out = self.control_command('ifconfig') @@ -1730,33 +1759,6 @@ class QEMUKvm(VirtBase): return cores - def handle_control_session(func): - """ - Wrapper function to handle serial port, must return serial to host session - """ - def _handle_control_session(self, command): - # just raise error if connect failed, for func can't all any more - try: - if self.control_type == 'socket': - assert (self.connect_serial_port(name=self.vm_name)), "Can't connect to serial socket" - elif self.control_type == 'telnet': - assert (self.connect_telnet_port(name=self.vm_name)), "Can't connect to serial port" - else: - assert (self.connect_qga_port(name=self.vm_name)), "Can't connect to qga port" - except: - return 'Failed' - - try: - out = func(self, command) - self.quit_control_session() - return out - except Exception as e: - print(RED("Exception happened on [%s] serial with cmd [%s]" % (self.vm_name, command))) - print(RED(e)) - self.close_control_session(dut_id=self.host_dut.dut_id) - return 'Failed' - - return _handle_control_session def quit_control_session(self): """ -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] framework/qemu_kvm: fix pylama errors 2022-01-19 12:11 ` [PATCH v2] " Juraj Linkeš @ 2022-01-25 5:12 ` Dong, JunX 2022-01-25 5:34 ` Dong, JunX 2022-01-25 6:16 ` Tu, Lijuan 0 siblings, 2 replies; 6+ messages in thread From: Dong, JunX @ 2022-01-25 5:12 UTC (permalink / raw) To: Juraj Linkeš, Tu, Lijuan, ohilyard; +Cc: dts > -----Original Message----- > From: Juraj Linkeš <juraj.linkes@pantheon.tech> > Sent: Wednesday, January 19, 2022 8:12 PM > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu; Dong, JunX > <junx.dong@intel.com> > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech> > Subject: [PATCH v2] framework/qemu_kvm: fix pylama errors > > Pylama found the following errors: > framework/qemu_kvm.py:1498: [E] E0602 Undefined variable > 'assgined_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E0602 Undefined variable > 'assinged_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no > '__vf_has_been_assinged' member [pylint] > framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments > for method call [pylint] > framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as first > argument [pylint] > framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> > --- > Lijuan, please add additional people to review if needed. > --- Reviewed-by Jun Dong <junx.dong@intel.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] framework/qemu_kvm: fix pylama errors 2022-01-25 5:12 ` Dong, JunX @ 2022-01-25 5:34 ` Dong, JunX 2022-01-25 6:16 ` Tu, Lijuan 1 sibling, 0 replies; 6+ messages in thread From: Dong, JunX @ 2022-01-25 5:34 UTC (permalink / raw) To: Juraj Linkeš, Tu, Lijuan, ohilyard; +Cc: dts > -----Original Message----- > From: Juraj Linkeš <juraj.linkes@pantheon.tech> > Sent: Wednesday, January 19, 2022 8:12 PM > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu; Dong, JunX > <junx.dong@intel.com> > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech> > Subject: [PATCH v2] framework/qemu_kvm: fix pylama errors > > Pylama found the following errors: > framework/qemu_kvm.py:1498: [E] E0602 Undefined variable > 'assgined_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E0602 Undefined variable > 'assinged_pcis_info' [pylint] > framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no > '__vf_has_been_assinged' member [pylint] > framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments > for method call [pylint] > framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as > first argument [pylint] > framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> > --- > Lijuan, please add additional people to review if needed. > --- Reviewed-by: Jun Dong <junx.dong@intel.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] framework/qemu_kvm: fix pylama errors 2022-01-25 5:12 ` Dong, JunX 2022-01-25 5:34 ` Dong, JunX @ 2022-01-25 6:16 ` Tu, Lijuan 1 sibling, 0 replies; 6+ messages in thread From: Tu, Lijuan @ 2022-01-25 6:16 UTC (permalink / raw) To: Dong, JunX, Juraj Linkeš, ohilyard; +Cc: dts > -----Original Message----- > From: Dong, JunX <junx.dong@intel.com> > Sent: 2022年1月25日 13:13 > To: Juraj Linkeš <juraj.linkes@pantheon.tech>; Tu, Lijuan <lijuan.tu@intel.com>; > ohilyard@iol.unh.edu > Cc: dts@dpdk.org > Subject: RE: [PATCH v2] framework/qemu_kvm: fix pylama errors > > > -----Original Message----- > > From: Juraj Linkeš <juraj.linkes@pantheon.tech> > > Sent: Wednesday, January 19, 2022 8:12 PM > > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu; Dong, JunX > > <junx.dong@intel.com> > > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech> > > Subject: [PATCH v2] framework/qemu_kvm: fix pylama errors > > > > Pylama found the following errors: > > framework/qemu_kvm.py:1498: [E] E0602 Undefined variable > > 'assgined_pcis_info' [pylint] > > framework/qemu_kvm.py:1508: [E] E0602 Undefined variable > > 'assinged_pcis_info' [pylint] > > framework/qemu_kvm.py:1508: [E] E1101 Instance of 'QEMUKvm' has no > > '__vf_has_been_assinged' member [pylint] > > framework/qemu_kvm.py:1587: [E] E1121 Too many positional arguments > > for method call [pylint] > > framework/qemu_kvm.py:1733: [E] E0213 Method should have "self" as > > first argument [pylint] > > framework/qemu_kvm.py:1750: [E] E1102 func is not callable [pylint] > > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> > > --- > > Lijuan, please add additional people to review if needed. > > --- > Reviewed-by Jun Dong <junx.dong@intel.com> Applied ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-25 6:17 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-12-06 12:21 [PATCH v1] framework/qemu_kvm: fix pylama errors Juraj Linkeš 2021-12-16 3:15 ` Dong, JunX 2022-01-19 12:11 ` [PATCH v2] " Juraj Linkeš 2022-01-25 5:12 ` Dong, JunX 2022-01-25 5:34 ` Dong, JunX 2022-01-25 6:16 ` Tu, Lijuan
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).