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 932648D35 for ; Wed, 12 Aug 2015 06:04:34 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 11 Aug 2015 21:04:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,658,1432623600"; d="scan'208";a="766939968" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 11 Aug 2015 21:04:32 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t7C44Vq4023838; Wed, 12 Aug 2015 12:04:31 +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 t7C44ST4010166; Wed, 12 Aug 2015 12:04:30 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t7C44SO0010162; Wed, 12 Aug 2015 12:04:28 +0800 From: Yong Liu To: dts@dpdk.org Date: Wed, 12 Aug 2015 12:04:27 +0800 Message-Id: <1439352267-10130-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] Support numa test in vm_power_manager suite 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: Wed, 12 Aug 2015 04:04:35 -0000 From: Marvin Liu Add set_vm_cpu API in qemu_libvirtd module. Skip load global configuration when user has been configured first. Start another VM with socket 1 cpus and check core mask correct on host. Signed-off-by: Marvin Liu diff --git a/conf/vm_power_manager.cfg b/conf/vm_power_manager.cfg index 5443730..c77819b 100644 --- a/conf/vm_power_manager.cfg +++ b/conf/vm_power_manager.cfg @@ -32,8 +32,6 @@ device = pf_idx=0,guestpci=00:08.0; pf_idx=1,guestpci=00:09.0; [vm1] -cpu = - number=4,cpupin=9 10 11 12; mem = size=4096; disk = diff --git a/framework/qemu_libvirt.py b/framework/qemu_libvirt.py index 339b380..de69d8f 100644 --- a/framework/qemu_libvirt.py +++ b/framework/qemu_libvirt.py @@ -145,6 +145,16 @@ class LibvirtKvm(VirtBase): memoryBacking = ET.SubElement(self.domain, 'memoryBacking') ET.SubElement(memoryBacking, 'hugepages') + def set_vm_cpu(self, **options): + """ + Set VM cpu. + """ + index = self.find_option_index('cpu') + if index: + self.params[index] = {'cpu': [options]} + else: + self.params.append({'cpu': [options]}) + def add_vm_cpu(self, **options): """ 'number' : '4' #number of vcpus diff --git a/framework/virt_base.py b/framework/virt_base.py index d0dfa1c..a2b56d7 100644 --- a/framework/virt_base.py +++ b/framework/virt_base.py @@ -113,7 +113,8 @@ class VirtBase(object): global_conf = conf.get_virt_config() for param in global_conf: for key in param.keys(): - self.__save_local_config(key, param[key]) + if self.find_option_index(key) is None: + self.__save_local_config(key, param[key]) def load_local_config(self, suite_name): """ diff --git a/tests/TestSuite_vm_power_manager.py b/tests/TestSuite_vm_power_manager.py index f06d245..f58fb45 100644 --- a/tests/TestSuite_vm_power_manager.py +++ b/tests/TestSuite_vm_power_manager.py @@ -249,6 +249,9 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): Check power management channel connected in multiple VMs """ vm_name = "vm1" + cpus = self.dut.get_core_list('1S/4C/1T', socket=1) + self.verify(len(cpus) == 4, "Can't allocate cores from numa 1") + vm2 = LibvirtKvm(self.dut, vm_name, self.suite) channels = [ {'path': '/tmp/powermonitor/%s.0' % @@ -262,12 +265,27 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): ] for channel in channels: vm2.add_vm_virtio_serial_channel(**channel) + + # start vm2 with socket 1 cpus + cpupin = '' + for cpu in cpus: + cpupin += '%s ' % cpu + vm2_cpus = {'number': '4', 'cpupin': cpupin[:-1]} + vm2.set_vm_cpu(**vm2_cpus) vm2_dut = vm2.start() self.dut.send_expect("add_vm %s" % vm_name, "vmpower>") self.dut.send_expect("add_channels %s all" % vm_name, "vmpower>") vm_info = self.dut.send_expect("show_vm %s" % vm_name, "vmpower>") + # check host core has correct mapped + cpu_idx = 0 + for cpu in cpus: + mask = dts.create_mask([cpu]) + cpu_map = '[%d]: Physical CPU Mask %s' % (cpu_idx, mask) + self.verify(cpu_map in vm_info, "Faile to map host cpu %s" % cpu) + cpu_idx += 1 + out = vm2_dut.build_dpdk_apps("examples/vm_power_manager/guest_cli") self.verify("Error" not in out, "Compilation error") self.verify("No such" not in out, "Compilation error") -- 1.9.3