summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-14 20:03:52 +0000
committerGerrit Code Review <review@openstack.org>2013-01-14 20:03:52 +0000
commitb097b59c375c853170954724bbc6bdfff24e08ea (patch)
tree3de371b300c7af4ecac41ffa97f56c44610b981e
parent4142a849274d233188df6f9a141ba62b738e9e8d (diff)
parent82b55c97d10a55e6a825261397816f6a7ad00fd7 (diff)
downloadnova-b097b59c375c853170954724bbc6bdfff24e08ea.tar.gz
nova-b097b59c375c853170954724bbc6bdfff24e08ea.tar.xz
nova-b097b59c375c853170954724bbc6bdfff24e08ea.zip
Merge "Fix addition of CPU features when running against legacy libvirt"
-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 a06cbdb78..471773389 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1455,6 +1455,7 @@ class LibvirtDriver(driver.ComputeDriver):
for hostfeat in hostcpu.features:
guestfeat = vconfig.LibvirtConfigGuestCPUFeature(hostfeat.name)
guestfeat.policy = "require"
+ guestcpu.features.append(guestfeat)
return guestcpu