Make VM machine type as a user configuration 59/64759/7
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Thu, 8 Nov 2018 08:44:20 +0000 (08:44 +0000)
committerVolodymyr Mytnyk <volodymyrx.mytnyk@intel.com>
Tue, 20 Nov 2018 14:02:20 +0000 (14:02 +0000)
For backward compatibility, the default value of this
option has been left unchanged.

JIRA: YARDSTICK-1528

Change-Id: I42ceca96501f1136cba27d85c2d82240bd45c10c
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
docs/testing/user/userguide/14-nsb-operation.rst
yardstick/benchmark/contexts/standalone/model.py
yardstick/tests/unit/benchmark/contexts/standalone/test_model.py

index c961558..7ec5b4e 100644 (file)
@@ -434,6 +434,43 @@ There two types of Standalone contexts available: OVS-DPDK and SRIOV.
 OVS-DPDK uses OVS network with DPDK drivers.
 SRIOV enables network traffic to bypass the software switch layer of the Hyper-V stack.
 
+Emulated machine type
+^^^^^^^^^^^^^^^^^^^^^
+
+For better performance test results of emulated VM spawned by Yardstick SA
+context (OvS-DPDK/SRIOV), it may be important to control the emulated machine
+type used by QEMU emulator. This attribute can be configured via TC definition
+in ``contexts`` section under ``extra_specs`` configuration.
+
+For example:
+
+.. code-block:: yaml
+
+  contexts:
+     ...
+     - type: StandaloneSriov
+       ...
+       flavor:
+         ...
+         extra_specs:
+           ...
+           machine_type: pc-i440fx-bionic
+
+Where, ``machine_type`` can be set to one of the emulated machine type
+supported by QEMU running on SUT platform. To get full list of supported
+emulated machine types, the following command can be used on the target SUT
+host.
+
+.. code-block:: yaml
+
+  # qemu-system-x86_64 -machine ?
+
+By default, the ``machine_type`` option is set to ``pc-i440fx-xenial`` which is
+suitable for running Ubuntu 16.04 VM image. So, if this type is not supported
+by the target platform or another VM image is used for stand alone (SA) context
+VM (e.g.: ``bionic`` image for Ubuntu 18.04), this configuration should be
+changed accordingly.
+
 Standalone with OVS-DPDK
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
index fda6671..aa5fdd3 100644 (file)
@@ -45,7 +45,7 @@ VM_TEMPLATE = """
   <vcpu cpuset='{cpuset}'>{vcpu}</vcpu>
  {cputune}
   <os>
-    <type arch="x86_64" machine="pc-i440fx-xenial">hvm</type>
+    <type arch="x86_64" machine="{machine}">hvm</type>
     <boot dev="hd" />
   </os>
   <features>
@@ -306,6 +306,7 @@ class Libvirt(object):
         cpuset = Libvirt.pin_vcpu_for_perf(connection, hw_socket)
 
         cputune = extra_spec.get('cputune', '')
+        machine = extra_spec.get('machine_type', 'pc-i440fx-xenial')
         mac = StandaloneContextHelper.get_mac_address(0x00)
         image = cls.create_snapshot_qemu(connection, index,
                                          flavor.get("images", None))
@@ -316,7 +317,8 @@ class Libvirt(object):
             memory=memory, vcpu=vcpu, cpu=cpu,
             numa_cpus=numa_cpus,
             socket=socket, threads=threads,
-            vm_image=image, cpuset=cpuset, cputune=cputune)
+            vm_image=image, cpuset=cpuset,
+            machine=machine, cputune=cputune)
 
         # Add CD-ROM device
         vm_xml = Libvirt.add_cdrom(cdrom_img, vm_xml)
index d880b41..e76a3ca 100644 (file)
@@ -55,7 +55,7 @@ class ModelLibvirtTestCase(unittest.TestCase):
         numa_cpus=0 - 10,
         socket=1, threads=1,
         vm_image="/var/lib/libvirt/images/yardstick-nsb-image.img",
-        cpuset=2 - 10, cputune='')
+        cpuset=2 - 10, cputune='', machine='pc')
 
     def setUp(self):
         self.pci_address_str = '0001:04:03.2'
@@ -352,7 +352,8 @@ class ModelLibvirtTestCase(unittest.TestCase):
         xml_ref = model.VM_TEMPLATE.format(vm_name='vm_name',
             random_uuid=_uuid, mac_addr=mac, memory='1024', vcpu='8', cpu='4',
             numa_cpus='0-7', socket='3', threads='2',
-            vm_image='qemu_image', cpuset='4,5', cputune='cool')
+            vm_image='qemu_image', cpuset='4,5', cputune='cool',
+            machine='pc-i440fx-xenial')
         xml_ref = model.Libvirt.add_cdrom(cdrom_img, xml_ref)
         self.assertEqual(xml_out, xml_ref)
         mock_get_mac_address.assert_called_once_with(0x00)