test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] Support numa test in vm_power_manager suite
Date: Wed, 12 Aug 2015 12:04:27 +0800	[thread overview]
Message-ID: <1439352267-10130-1-git-send-email-yong.liu@intel.com> (raw)

From: Marvin Liu <yong.liu@intel.com>

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 <yong.liu@intel.com>

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

                 reply	other threads:[~2015-08-12  4:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439352267-10130-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).