Merge "remove releng from Dockerfile and elsewhere"
[yardstick.git] / yardstick / benchmark / contexts / standalone / model.py
index a8943c3..14738da 100644 (file)
@@ -35,7 +35,7 @@ LOG = logging.getLogger(__name__)
 
 VM_TEMPLATE = """
 <domain type="kvm">
- <name>{vm_name}</name>
 <name>{vm_name}</name>
   <uuid>{random_uuid}</uuid>
   <memory unit="MB">{memory}</memory>
   <currentMemory unit="MB">{memory}</currentMemory>
@@ -43,6 +43,7 @@ VM_TEMPLATE = """
     <hugepages />
   </memoryBacking>
   <vcpu cpuset='{cpuset}'>{vcpu}</vcpu>
+ {cputune}
   <os>
     <type arch="x86_64" machine="pc-i440fx-utopic">hvm</type>
     <boot dev="hd" />
@@ -79,7 +80,13 @@ VM_TEMPLATE = """
       <source bridge="br-int" />
       <model type='virtio'/>
     </interface>
-   </devices>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+  </devices>
 </domain>
 """
 WAIT_FOR_BOOT = 30
@@ -211,9 +218,8 @@ class Libvirt(object):
         mac.set('address', vf_mac)
 
         source = ET.SubElement(interface, 'source')
-        addr = ET.SubElement(source, 'address')
         pci_address = PciAddress(vf_pci.strip())
-        cls._add_interface_address(addr, pci_address)
+        cls._add_interface_address(source, pci_address)
 
         pci_vm_address = PciAddress(vm_pci.strip())
         cls._add_interface_address(interface, pci_vm_address)
@@ -242,6 +248,7 @@ class Libvirt(object):
         hw_socket = flavor.get('hw_socket', '0')
         cpuset = Libvirt.pin_vcpu_for_perf(connection, hw_socket)
 
+        cputune = extra_spec.get('cputune', '')
         mac = StandaloneContextHelper.get_mac_address(0x00)
         image = cls.create_snapshot_qemu(connection, index,
                                          flavor.get("images", None))
@@ -252,7 +259,7 @@ class Libvirt(object):
             memory=memory, vcpu=vcpu, cpu=cpu,
             numa_cpus=numa_cpus,
             socket=socket, threads=threads,
-            vm_image=image, cpuset=cpuset)
+            vm_image=image, cpuset=cpuset, cputune=cputune)
 
         write_file(cfg, vm_xml)
 
@@ -269,6 +276,7 @@ class Libvirt(object):
         sys_obj = CpuSysCores(connection)
         soc_cpu = sys_obj.get_core_socket()
         sys_cpu = int(soc_cpu["cores_per_socket"])
+        socket = str(socket)
         cores = "%s-%s" % (soc_cpu[socket][0], soc_cpu[socket][sys_cpu - 1])
         if int(soc_cpu["thread_per_core"]) > 1:
             threads = "%s-%s" % (soc_cpu[socket][sys_cpu], soc_cpu[socket][-1])
@@ -284,7 +292,8 @@ class StandaloneContextHelper(object):
         super(StandaloneContextHelper, self).__init__()
 
     @staticmethod
-    def install_req_libs(connection, extra_pkgs=[]):
+    def install_req_libs(connection, extra_pkgs=None):
+        extra_pkgs = extra_pkgs or []
         pkgs = ["qemu-kvm", "libvirt-bin", "bridge-utils", "numactl", "fping"]
         pkgs.extend(extra_pkgs)
         cmd_template = "dpkg-query -W --showformat='${Status}\\n' \"%s\"|grep 'ok installed'"
@@ -301,7 +310,7 @@ class StandaloneContextHelper(object):
         return driver
 
     @classmethod
-    def get_nic_details(cls, connection, networks, dpdk_nic_bind):
+    def get_nic_details(cls, connection, networks, dpdk_devbind):
         for key, ports in networks.items():
             if key == "mgmt":
                 continue
@@ -311,11 +320,11 @@ class StandaloneContextHelper(object):
             driver = cls.get_kernel_module(connection, phy_ports, phy_driver)
 
             # Make sure that ports are bound to kernel drivers e.g. i40e/ixgbe
-            bind_cmd = "{dpdk_nic_bind} --force -b {driver} {port}"
+            bind_cmd = "{dpdk_devbind} --force -b {driver} {port}"
             lshw_cmd = "lshw -c network -businfo | grep '{port}'"
             link_show_cmd = "ip -s link show {interface}"
 
-            cmd = bind_cmd.format(dpdk_nic_bind=dpdk_nic_bind,
+            cmd = bind_cmd.format(dpdk_devbind=dpdk_devbind,
                                   driver=driver, port=ports['phy_port'])
             connection.execute(cmd)