From 46e98cfeb8463c68f912052ace036b490774a89f Mon Sep 17 00:00:00 2001 From: Nikola Dipanov Date: Wed, 30 Sep 2015 16:24:28 +0100 Subject: [PATCH] Revert "Store correct VirtCPUTopology" This reverts commit 8358936a24cd223046580ddfa3bfb37a943abc91. The bug patch being reverted was trying to fix is not a bug bug at all but is actually by design. The NUMA cell CPU topology was meant to carry information about threads that we want to expose to the single cell based on how it was fitted with regards to threading on the host, so that we can expose this information to the guest OS if possible for optimal performance. The final topology exposed to the guest takes this information into account as well as any request for particular topology passed in by the user and decides on the final solution. There is no reason to store this as it will be different for different hosts. We want to revert this as it is really not something that we want to be doing, and will make it easier to cleanly fix 1501358. Change-Id: Iae06c468c076337b9d6e85d0d0dc85a063b827d1 Partial-bug: 1501358 Partial-bug: 1467927 --- nova/tests/unit/virt/libvirt/test_driver.py | 27 --------------------- nova/virt/hardware.py | 1 - nova/virt/libvirt/driver.py | 4 --- 3 files changed, 32 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 8c922b4a5b..cb32e1a124 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -4478,33 +4478,6 @@ class LibvirtConnTestCase(test.NoDBTestCase): self.assertEqual(conf.cpu.cores, 1) self.assertEqual(conf.cpu.threads, 1) - @mock.patch.object(host.Host, "has_min_version", return_value=True) - def test_get_guest_cpu_config_numa_topology(self, mock_has_min_version): - drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) - instance_ref = objects.Instance(**self.test_instance) - instance_ref.flavor.vcpus = 2 - instance_ref.numa_topology = objects.InstanceNUMATopology(cells=[ - objects.InstanceNUMACell( - id=0, - cpuset=set([0, 1]), - memory=1024, - cpu_pinning={})]) - image_meta = objects.ImageMeta.from_dict(self.test_image_meta) - disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type, - instance_ref, - image_meta) - - self.assertIsNone(instance_ref.numa_topology.cells[0].cpu_topology) - - drvr._get_guest_config(instance_ref, - _fake_network_info(self.stubs, 1), - image_meta, disk_info) - - topo = instance_ref.numa_topology.cells[0].cpu_topology - self.assertIsNotNone(topo) - self.assertEqual(topo.cores * topo.sockets * topo.threads, - instance_ref.flavor.vcpus) - def test_get_guest_cpu_topology(self): instance_ref = objects.Instance(**self.test_instance) instance_ref.flavor.vcpus = 8 diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index 2622b59e77..9bc8a3ac12 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -708,7 +708,6 @@ def _pack_instance_onto_cores(available_siblings, instance_cell, host_cell_id): pinning = zip(sorted(instance_cell.cpuset), itertools.chain(*sliced_sibs)) - # NOTE(sfinucan) - this may be overriden later on by the drivers topology = (instance_cell.cpu_topology or objects.VirtCPUTopology(sockets=1, cores=len(sliced_sibs), diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index e3a32bfbdb..45560451e0 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -3203,10 +3203,6 @@ class LibvirtDriver(driver.ComputeDriver): topology = hardware.get_best_cpu_topology( flavor, image_meta, numa_topology=instance_numa_topology) - if instance_numa_topology: - for cell in instance_numa_topology.cells: - cell.cpu_topology = topology - cpu.sockets = topology.sockets cpu.cores = topology.cores cpu.threads = topology.threads