summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-12-17 15:35:06 +0000
committerDaniel P. Berrange <berrange@redhat.com>2013-01-14 19:06:13 +0000
commit82b55c97d10a55e6a825261397816f6a7ad00fd7 (patch)
tree5b994cc0526aaf51c1698e0250db97c10550859e
parent414886eafd18f5c1d58f97ab477597207d98acdc (diff)
downloadnova-82b55c97d10a55e6a825261397816f6a7ad00fd7.tar.gz
nova-82b55c97d10a55e6a825261397816f6a7ad00fd7.tar.xz
nova-82b55c97d10a55e6a825261397816f6a7ad00fd7.zip
Fix addition of CPU features when running against legacy libvirt
When running against an libvirt < 0.9.10 which lacks support for the 'host-model' CPU type, we must fake it by copying the host CPU model and features. Unfortunately the code was forgetting to append the new features to the CPU object feature list Bug: 1099527 Change-Id: I39c6df6e85d77763ad279961fd6f0da70ac2415e Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--nova/tests/test_libvirt.py6
-rw-r--r--nova/virt/libvirt/driver.py1
2 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index 53bb1b984..a1206d7fd 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -904,6 +904,9 @@ class LibvirtConnTestCase(test.TestCase):
cpu.model = "Opteron_G4"
cpu.vendor = "AMD"
+ cpu.features.append(vconfig.LibvirtConfigGuestCPUFeature("tm2"))
+ cpu.features.append(vconfig.LibvirtConfigGuestCPUFeature("ht"))
+
caps = vconfig.LibvirtConfigCaps()
caps.host = vconfig.LibvirtConfigCapsHost()
caps.host.cpu = cpu
@@ -927,6 +930,9 @@ class LibvirtConnTestCase(test.TestCase):
self.assertEquals(conf.cpu.mode, None)
self.assertEquals(conf.cpu.model, "Opteron_G4")
self.assertEquals(conf.cpu.vendor, "AMD")
+ self.assertEquals(len(conf.cpu.features), 2)
+ self.assertEquals(conf.cpu.features[0].name, "tm2")
+ self.assertEquals(conf.cpu.features[1].name, "ht")
def test_get_guest_cpu_config_custom_old(self):
def get_lib_version_stub(self):
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 42d9dd99b..415ec732c 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1472,6 +1472,7 @@ class LibvirtDriver(driver.ComputeDriver):
for hostfeat in hostcpu.features:
guestfeat = vconfig.LibvirtConfigGuestCPUFeature(hostfeat.name)
guestfeat.policy = "require"
+ guestcpu.features.append(guestfeat)
return guestcpu