From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04DC0A0C52; Wed, 24 Nov 2021 14:47:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D379F411FE; Wed, 24 Nov 2021 14:47:52 +0100 (CET) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id 959C1411E6 for ; Wed, 24 Nov 2021 14:47:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id 077FD10DDB9; Wed, 24 Nov 2021 14:47:50 +0100 (CET) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iNyAVqa15OH9; Wed, 24 Nov 2021 14:47:49 +0100 (CET) Received: from service-node1.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id 5ADC910DDB0; Wed, 24 Nov 2021 14:47:49 +0100 (CET) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: lijuan.tu@intel.com, ohilyard@iol.unh.edu Cc: dts@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH v1] framework/virt_*: fix pylama errors Date: Wed, 24 Nov 2021 14:47:48 +0100 Message-Id: <1637761668-4060-1-git-send-email-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Pylama found the following errors: framework/virt_base.py:271: [E] E1101 Instance of 'VirtBase' has no 'add_vm_login' member [pylint] framework/virt_base.py:274: [E] E1101 Instance of 'VirtBase' has no '_attach_vm' member [pylint] framework/virt_base.py:319: [E] E1101 Instance of 'VirtBase' has no '_quick_start_vm' member [pylint] framework/virt_base.py:413: [E] E1111 Assigning result of a function call, where the function has no return [pylint] framework/virt_base.py:416: [E] E1101 Instance of 'VirtBase' has no 'get_vm_login' member [pylint] framework/virt_base.py:88: [E] E1111 Assigning result of a function call, where the function has no return [pylint] framework/virt_dut.py:73: [E] E1003 Bad first argument 'Dut' given to super() [pylint] framework/virt_resource.py:242: [E] E1101 Instance of 'VirtResource' has no '__port_isused' member [pylint] framework/virt_resource.py:246: [E] E0602 Undefined variable 'core' [pylint] framework/virt_resource.py:247: [E] E0602 Undefined variable 'core' [pylint] framework/virt_scene.py:350: [E] E1101 Instance of 'VirtScene' has no 'tester' member [pylint] framework/virt_scene.py:393: [E] E1101 Instance of 'VirtScene' has no 'vm_dut' member [pylint] framework/virt_scene.py:397: [E] E1101 Instance of 'VirtScene' has no 'tester' member [pylint] framework/virt_scene.py:458: [E] E1123 Unexpected keyword argument 'auto_portmap' in method call [pylint] framework/virt_scene.py:510: [E] E0102 class already defined line 38 [pylint] framework/virt_scene.py:517: [E] E1101 Instance of 'QEMUKvm' has no 'params' member [pylint] Signed-off-by: Juraj Linkeš --- Lijuan, please add additional people to review if needed. --- framework/dut.py | 11 +++++++---- framework/project_dpdk.py | 5 +++-- framework/virt_base.py | 28 ++++++++++++++++++++++++++-- framework/virt_dut.py | 2 +- framework/virt_resource.py | 7 +++++-- framework/virt_scene.py | 13 +++++++------ 6 files changed, 49 insertions(+), 17 deletions(-) diff --git a/framework/dut.py b/framework/dut.py index dc3fc874..f4355f40 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -62,10 +62,13 @@ class Dut(Crb): CORE_LIST_CACHE_KEY = 'dut_core_list' PCI_DEV_CACHE_KEY = 'dut_pci_dev_info' - def __init__(self, crb, serializer, dut_id): - self.NAME = 'dut' + LOG_NAME_SEP + '%s' % crb['My IP'] - super(Dut, self).__init__(crb, serializer, self.NAME, alt_session=True, dut_id=dut_id) - + def __init__(self, crb, serializer, + name=None, alt_session=True, dut_id=0): + if not name: + name = 'dut' + LOG_NAME_SEP + '%s' % crb['My IP'] + self.NAME = name + super(Dut, self).__init__(crb, serializer, name, + alt_session=alt_session, dut_id=dut_id) self.host_init_flag = False self.number_of_cores = 0 self.tester = None diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index 9927bcc1..75613a1d 100644 --- a/framework/project_dpdk.py +++ b/framework/project_dpdk.py @@ -60,8 +60,9 @@ class DPDKdut(Dut): build, memory and kernel module. """ - def __init__(self, crb, serializer, dut_id): - super(DPDKdut, self).__init__(crb, serializer, dut_id) + def __init__(self, crb, serializer, name=None, alt_session=True, dut_id=0): + super(DPDKdut, self).__init__(crb, serializer, name, alt_session, + dut_id) self.testpmd = None def set_target(self, target, bind_dev=True): diff --git a/framework/virt_base.py b/framework/virt_base.py index 148a4d18..ef117062 100644 --- a/framework/virt_base.py +++ b/framework/virt_base.py @@ -104,7 +104,7 @@ class VirtBase(object): """ Get the virtual type, such as KVM, XEN or LIBVIRT. """ - NotImplemented + raise NotImplementedError def has_virtual_ability(self): """ @@ -118,6 +118,30 @@ class VirtBase(object): """ NotImplemented + def get_vm_login(self): + """ + Get VM credentials. + """ + raise NotImplementedError + + def add_vm_login(self): + """ + Add VM credentials. + """ + raise NotImplementedError + + def _attach_vm(self): + """ + Attach VM. + """ + raise NotImplementedError + + def _quick_start_vm(self): + """ + Quick start VM. + """ + raise NotImplementedError + def load_global_config(self): """ Load global configure in the path DTS_ROOT_PATH/conf. @@ -230,7 +254,7 @@ class VirtBase(object): """ Get the VM IP. """ - NotImplemented + raise NotImplementedError def get_pci_mappings(self): """ diff --git a/framework/virt_dut.py b/framework/virt_dut.py index bde65667..de892879 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -70,7 +70,7 @@ class VirtDut(DPDKdut): self.vm_ip = crb['IP'] self.NAME = 'virtdut' + LOG_NAME_SEP + '%s' % self.vm_ip # do not create addition alt_session - super(Dut, self).__init__(crb, serializer, self.NAME, alt_session=False, dut_id=self.dut_id) + super(VirtDut, self).__init__(crb, serializer, self.NAME, alt_session=False, dut_id=self.dut_id) # load port config from suite cfg self.suite = suite diff --git a/framework/virt_resource.py b/framework/virt_resource.py index 8a19f1b2..3163372d 100644 --- a/framework/virt_resource.py +++ b/framework/virt_resource.py @@ -70,6 +70,9 @@ class VirtResource(object): # save allocated cores and related vm self.allocated_info = {} + def __port_isused(self, pci): + return pci in self.used_ports + def __port_used(self, pci): index = self.ports.index(pci) self.used_ports[index] = pci @@ -243,8 +246,8 @@ class VirtResource(object): print("Port %s has been used!!!" % pci) else: if self.__port_on_socket(pci, socket) is True: - self.__port_used(core) - ports.append(core) + self.__port_used(pci) + ports.append(pci) if vm not in self.allocated_info: self.allocated_info[vm] = {} diff --git a/framework/virt_scene.py b/framework/virt_scene.py index cc36a09b..d82012b1 100644 --- a/framework/virt_scene.py +++ b/framework/virt_scene.py @@ -347,7 +347,7 @@ class VirtScene(object): elif cmd['type'] == 'host': crb = self.host_dut elif cmd['type'] == 'tester': - crb = self.tester + crb = self.tester_dut else: crb = self.host_dut @@ -390,11 +390,11 @@ class VirtScene(object): def run_post_cmds(self): for cmd in self.post_cmds: if cmd['type'] == 'vm': - crb = self.vm_dut + crb = None elif cmd['type'] == 'host': crb = self.host_dut elif cmd['type'] == 'tester': - crb = self.tester + crb = self.tester_dut else: crb = self.host_dut @@ -456,7 +456,6 @@ class VirtScene(object): topo = self.get_cputopo(scene_params) try: vm_dut = vm.start(load_config=False, set_target=False, - auto_portmap=self.auto_portmap, cpu_topo=topo) if vm_dut is None: raise Exception("Set up VM ENV failed!") @@ -507,16 +506,18 @@ class VirtScene(object): if __name__ == "__main__": - class QEMUKvm(): + class QEMUKvmTmp(): def __init__(self, dut, vm_name, suite_name): print(vm_name) print(suite_name) def start(self): - print(self.params) + print(self.__dict__) return True + QEMUKvm = QEMUKvmTmp + class simple_dev(object): def __init__(self, pci): -- 2.20.1