Exemple #1
0
 def test_pin_vcpu_for_perf(self, mock_update_interrupts_hugepages_perf,
                            mock_CpuSysCores):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "a", ""))
         ssh.return_value = ssh_mock
     status = Libvirt.pin_vcpu_for_perf(ssh_mock, "vm_0", 4)
     self.assertIsNotNone(status)
Exemple #2
0
    def setup_ovs_dpdk_context(self):
        nodes = []

        self.configure_nics_for_ovs_dpdk()

        for index, (key, vnf) in enumerate(OrderedDict(self.servers).items()):
            cfg = '/tmp/vm_ovs_%d.xml' % index
            vm_name = "vm_%d" % index

            # 1. Check and delete VM if already exists
            Libvirt.check_if_vm_exists_and_delete(vm_name, self.connection)

            vcpu, mac = Libvirt.build_vm_xml(self.connection, self.vm_flavor,
                                             cfg, vm_name, index)
            # 2: Cleanup already available VMs
            for idx, (vkey, vfs) in enumerate(
                    OrderedDict(vnf["network_ports"]).items()):
                if vkey == "mgmt":
                    continue
                self._enable_interfaces(index, vfs, cfg)

            # copy xml to target...
            self.connection.put(cfg, cfg)

            #    FIXME: launch through libvirt
            LOG.info("virsh create ...")
            Libvirt.virsh_create_vm(self.connection, cfg)

            #    5: Tunning for better performace
            Libvirt.pin_vcpu_for_perf(self.connection, vm_name, vcpu)
            self.vm_names.append(vm_name)

            # build vnf node details
            nodes.append(
                self.vnf_node.generate_vnf_instance(self.vm_flavor,
                                                    self.networks,
                                                    self.host_mgmt.get('ip'),
                                                    key, vnf, mac))

        return nodes
 def test_pin_vcpu_for_perf(self, mock_update_interrupts_hugepages_perf,
                            mock_get_numa_nodes):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "a", ""))
         ssh.return_value = ssh_mock
     mock_get_numa_nodes.return_value = {
         '1': [18, 19, 20, 21],
         '0': [0, 1, 2, 3]
     }
     status = Libvirt.pin_vcpu_for_perf(ssh_mock, "vm_0", 4)
     self.assertIsNone(status)