From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1232AC450 for ; Thu, 18 Jun 2015 05:07:06 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 17 Jun 2015 20:07:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,636,1427785200"; d="scan'208";a="745553127" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2015 20:07:05 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t5I374De009079; Thu, 18 Jun 2015 11:07:04 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t5I371CR016931; Thu, 18 Jun 2015 11:07:03 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t5I3713p016927; Thu, 18 Jun 2015 11:07:01 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 18 Jun 2015 11:06:42 +0800 Message-Id: <1434596804-16846-8-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1434596804-16846-1-git-send-email-yong.liu@intel.com> References: <1434596804-16846-1-git-send-email-yong.liu@intel.com> Subject: [dts] [dts 7/9] Optimize VF devices creation and network devices pass-through function X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 03:07:07 -0000 From: Marvin Liu Add pt devices list in qemu_kvm module which can support devices free in virtual scenario module. Support netdevie object get by pci address. Signed-off-by: Marvin Liu diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index 8e0582a..6320a43 100644 --- a/framework/qemu_kvm.py +++ b/framework/qemu_kvm.py @@ -88,6 +88,9 @@ class QEMUKvm(VirtBase): self.char_idx = 0 self.netdev_idx = 0 + # devices pass-through into vm + self.pt_devices = [] + def set_vm_default(self): self.set_vm_name(self.vm_name) self.set_vm_enable_kvm() @@ -534,6 +537,7 @@ class QEMUKvm(VirtBase): if 'opt_host' in options.keys() and \ options['opt_host']: dev_boot_line += separator + 'host=%s' % options['opt_host'] + self.pt_devices.append(options['opt_host']) if 'opt_addr' in options.keys() and \ options['opt_addr']: dev_boot_line += separator + 'addr=%s' % options['opt_addr'] @@ -773,7 +777,7 @@ class QEMUKvm(VirtBase): cpus = self.virt_pool.alloc_cpu(vm=self.vm_name, corelist=req_cpus) if len(req_cpus) != len(cpus): - self.host_logger.warn("VCPUs not enough, required [ %s ], just [ %s ]" % + self.host_logger.warning("VCPUs not enough, required [ %s ], just [ %s ]" % (req_cpus, cpus)) raise Exception("No enough required vcpus!!!") @@ -904,6 +908,9 @@ class QEMUKvm(VirtBase): return ip return '' + def get_vm_pt_devices(self): + return self.pt_devices + def __control_session(self, command, *args): """ Use the qemu guest agent service to control VM. @@ -935,10 +942,9 @@ class QEMUKvm(VirtBase): return out - def stop(self): + def _stop_vm(self): """ Stop VM. """ self.__control_session('powerdown') time.sleep(5) - self.virt_pool.free_all_resource(self.vm_name) diff --git a/framework/settings.py b/framework/settings.py index 19ebe6b..d3cdf80 100644 --- a/framework/settings.py +++ b/framework/settings.py @@ -189,3 +189,14 @@ def accepted_nic(pci_id): return True return False + +def get_netdev(crb, pci): + for port in crb.ports_info: + if pci == port['pci']: + return port['port'] + if 'vfs_port' in port.keys(): + for vf in port['vfs_port']: + if pci == vf.pci: + return vf + + return None diff --git a/framework/test_case.py b/framework/test_case.py index a519691..5013123 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -49,7 +49,10 @@ class TestCase(object): for portid in range(len(self.dut.ports_info)): nic_type = self.dut.ports_info[portid]['type'] self.nics.append(nic_name_from_type(nic_type)) - self.nic = self.nics[0] + if len(self.nics): + self.nic = self.nics[0] + else: + self.nic = '' def set_up_all(self): pass -- 1.9.3