diff -Nru nova-2014.1.1/debian/changelog nova-2014.1.1/debian/changelog --- nova-2014.1.1/debian/changelog 2014-06-24 12:47:59.000000000 -0300 +++ nova-2014.1.1/debian/changelog 2014-06-25 14:16:38.000000000 -0300 @@ -1,3 +1,11 @@ +nova (1:2014.1.1-0ubuntu2) trusty; urgency=high + + * Cherry picked two fixes from upstream. + - [2cebfd2] libvirt: convert cpu features attribute from list to a set (LP: #1267191) + - [b86a0e5] Fixes rdb backend image size (LP: #1219658) + + -- Rafael David Tinoco Wed, 25 Jun 2014 12:56:15 -0300 + nova (1:2014.1.1-0ubuntu1) trusty; urgency=medium * Resynchronize with stable/icehouse (867341f) (LP: #1328134): diff -Nru nova-2014.1.1/debian/patches/Fixes-rdb-backend-image-size.patch nova-2014.1.1/debian/patches/Fixes-rdb-backend-image-size.patch --- nova-2014.1.1/debian/patches/Fixes-rdb-backend-image-size.patch 1969-12-31 21:00:00.000000000 -0300 +++ nova-2014.1.1/debian/patches/Fixes-rdb-backend-image-size.patch 2014-06-25 14:16:05.000000000 -0300 @@ -0,0 +1,47 @@ +Description: Fixes rdb backend image size + +Author: Sam Morrison +Origin: upstream, Change-Id: I9e1d89201d79ee67157c962be469d7ff3e25ee21 +Bug-Ubuntu: 1219658 + +The original fix for bug 1219658 introduced a factor of 1024 error +in the resulting rbd image size. + +===== + +Original Fix: + +Description: Fix incorrect root partition size and compatible volume name + +Author: Haomai Wang +Origin: upstream, Change-Id: I3dc8d639b066eac35d190b8d4687c41c9f4d5824 +Bug-Ubuntu: 1219658 + +When using rbd backend, it needs to resize volume size if size presents. Else +we will get wrong image size. +Rbd volume always uses uuid as the main pattern of volume name, now change to +it is necessary. + +--- + nova/virt/libvirt/imagebackend.py | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/nova/virt/libvirt/imagebackend.py b/nova/virt/libvirt/imagebackend.py +index 6511496..f66b4f2 100644 +--- a/nova/virt/libvirt/imagebackend.py ++++ b/nova/virt/libvirt/imagebackend.py +@@ -655,10 +655,8 @@ class Rbd(Image): + return False + + def _resize(self, volume_name, size): +- size = int(size) * units.Ki +- + with RBDVolumeProxy(self, volume_name) as vol: +- vol.resize(size) ++ vol.resize(int(size)) + + def create_image(self, prepare_template, base, size, *args, **kwargs): + if self.rbd is None: +-- +1.9.1 + diff -Nru nova-2014.1.1/debian/patches/libvirt-convert-cpu-features-attribute-from-list-to-.patch nova-2014.1.1/debian/patches/libvirt-convert-cpu-features-attribute-from-list-to-.patch --- nova-2014.1.1/debian/patches/libvirt-convert-cpu-features-attribute-from-list-to-.patch 1969-12-31 21:00:00.000000000 -0300 +++ nova-2014.1.1/debian/patches/libvirt-convert-cpu-features-attribute-from-list-to-.patch 2014-06-25 14:07:57.000000000 -0300 @@ -0,0 +1,160 @@ +Description: libvirt: convert cpu features attribute from list to a set + +Currently, the cpu features list which is being sent to libvirt, +when creating a domain or calling compareCPU, must contain only +unique entries. Multiple issues arise when we are updating the +features attribute in LibvirtConfigCPU class (for example during +migration). + +This change will change the features attribute from being a list +to a set. This make the LibvirtConfigCPU class keep only unique +features. +Adjusting the LibvirtConfigCPUFeature class to support set +operations by overriding the __eq__, __ne__ and __hash__ +methods. + +Author: Vladik Romanovsky +Origin: upstream, Change-Id: I6350fe0e827c860aea77cc4fe56f18f5c1483580 +Bug-Ubuntu: #1303536 +Last-Update: 2014-06-25 + +--- + nova/tests/virt/libvirt/test_libvirt.py | 8 ++++---- + nova/tests/virt/libvirt/test_libvirt_config.py | 24 +++++++++++++++++++++++- + nova/virt/libvirt/config.py | 16 +++++++++++++--- + nova/virt/libvirt/driver.py | 2 +- + 4 files changed, 41 insertions(+), 9 deletions(-) + +diff --git a/nova/tests/virt/libvirt/test_libvirt.py b/nova/tests/virt/libvirt/test_libvirt.py +index 1f744b7..9139ab9 100644 +--- a/nova/tests/virt/libvirt/test_libvirt.py ++++ b/nova/tests/virt/libvirt/test_libvirt.py +@@ -2206,8 +2206,8 @@ class LibvirtConnTestCase(test.TestCase): + cpu.model = "Opteron_G4" + cpu.vendor = "AMD" + +- cpu.features.append(vconfig.LibvirtConfigGuestCPUFeature("tm2")) +- cpu.features.append(vconfig.LibvirtConfigGuestCPUFeature("ht")) ++ cpu.add_feature(vconfig.LibvirtConfigGuestCPUFeature("tm2")) ++ cpu.add_feature(vconfig.LibvirtConfigGuestCPUFeature("ht")) + + caps = vconfig.LibvirtConfigCaps() + caps.host = vconfig.LibvirtConfigCapsHost() +@@ -2235,8 +2235,8 @@ class LibvirtConnTestCase(test.TestCase): + self.assertEqual(conf.cpu.model, "Opteron_G4") + self.assertEqual(conf.cpu.vendor, "AMD") + self.assertEqual(len(conf.cpu.features), 2) +- self.assertEqual(conf.cpu.features[0].name, "tm2") +- self.assertEqual(conf.cpu.features[1].name, "ht") ++ self.assertEqual(conf.cpu.features.pop().name, "tm2") ++ self.assertEqual(conf.cpu.features.pop().name, "ht") + + def test_get_guest_cpu_config_custom_old(self): + def get_lib_version_stub(): +diff --git a/nova/tests/virt/libvirt/test_libvirt_config.py b/nova/tests/virt/libvirt/test_libvirt_config.py +index 2251bf8..fa65ebc 100644 +--- a/nova/tests/virt/libvirt/test_libvirt_config.py ++++ b/nova/tests/virt/libvirt/test_libvirt_config.py +@@ -235,8 +235,30 @@ class LibvirtConfigCPUTest(LibvirtConfigBaseTest): + x86_64 + Penryn + Intel ++ + ++ ++ """) ++ ++ def test_only_uniq_cpu_featues(self): ++ obj = config.LibvirtConfigCPU() ++ obj.model = "Penryn" ++ obj.vendor = "Intel" ++ obj.arch = "x86_64" ++ ++ obj.add_feature(config.LibvirtConfigCPUFeature("mtrr")) ++ obj.add_feature(config.LibvirtConfigCPUFeature("apic")) ++ obj.add_feature(config.LibvirtConfigCPUFeature("apic")) ++ obj.add_feature(config.LibvirtConfigCPUFeature("mtrr")) ++ ++ xml = obj.to_xml() ++ self.assertXmlEqual(xml, """ ++ ++ x86_64 ++ Penryn ++ Intel + ++ + + """) + +@@ -285,8 +307,8 @@ class LibvirtConfigGuestCPUTest(LibvirtConfigBaseTest): + x86_64 + Penryn + Intel +- + ++ + + """) + +diff --git a/nova/virt/libvirt/config.py b/nova/virt/libvirt/config.py +index a931b57..f32e178 100644 +--- a/nova/virt/libvirt/config.py ++++ b/nova/virt/libvirt/config.py +@@ -250,6 +250,15 @@ class LibvirtConfigCPUFeature(LibvirtConfigObject): + + return ft + ++ def __eq__(self, obj): ++ return obj.name == self.name ++ ++ def __ne__(self, obj): ++ return obj.name != self.name ++ ++ def __hash__(self): ++ return hash(self.name) ++ + + class LibvirtConfigCPU(LibvirtConfigObject): + +@@ -265,7 +274,7 @@ class LibvirtConfigCPU(LibvirtConfigObject): + self.cores = None + self.threads = None + +- self.features = [] ++ self.features = set() + + def parse_dom(self, xmldoc): + super(LibvirtConfigCPU, self).parse_dom(xmldoc) +@@ -305,13 +314,14 @@ class LibvirtConfigCPU(LibvirtConfigObject): + top.set("threads", str(self.threads)) + cpu.append(top) + +- for f in self.features: ++ # sorting the features to allow more predictable tests ++ for f in sorted(self.features, key=lambda x: x.name): + cpu.append(f.format_dom()) + + return cpu + + def add_feature(self, feat): +- self.features.append(feat) ++ self.features.add(feat) + + + class LibvirtConfigGuestCPUFeature(LibvirtConfigCPUFeature): +diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py +index df367dd..7402363 100644 +--- a/nova/virt/libvirt/driver.py ++++ b/nova/virt/libvirt/driver.py +@@ -2888,7 +2888,7 @@ class LibvirtDriver(driver.ComputeDriver): + for hostfeat in hostcpu.features: + guestfeat = vconfig.LibvirtConfigGuestCPUFeature(hostfeat.name) + guestfeat.policy = "require" +- guestcpu.features.append(guestfeat) ++ guestcpu.add_feature(guestfeat) + + return guestcpu + +-- +1.9.1 + diff -Nru nova-2014.1.1/debian/patches/series nova-2014.1.1/debian/patches/series --- nova-2014.1.1/debian/patches/series 2014-06-24 12:47:59.000000000 -0300 +++ nova-2014.1.1/debian/patches/series 2014-06-25 12:55:40.000000000 -0300 @@ -4,3 +4,5 @@ arm-console-patch.patch update-run-tests.patch libvirt-Handle-unsupported-host-capabilities.patch +libvirt-convert-cpu-features-attribute-from-list-to-.patch +Fixes-rdb-backend-image-size.patch