diff options
| author | Pádraig Brady <P@draigBrady.com> | 2012-05-16 15:08:31 (GMT) |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2012-05-16 17:23:38 (GMT) |
| commit | 07d81d731fa63911310629d5aa9b86860238defa (patch) | |
| tree | 198f37c60cd4261f8de1f5892b67429a3d63a716 | |
| parent | f06420060ef4e630c254d659b19a2ce0b88e4221 (diff) | |
| download | openstack-nova-07d81d73.zip openstack-nova-07d81d73.tar.gz openstack-nova-07d81d73.tar.bz2 | |
Updated patches from master-patches
Note I manually modified the QuantumManager-..start-dnsmasq...patch
so that it excludes a hunk already applied in an earlier patch.
git can handle this but patch can't. I've asked git upstream
for how to avoid this issue with format-patch generated patches,
but pending that I've modified the patch manually to delete
the Authors part.
21 files changed, 930 insertions, 29 deletions
diff --git a/0013-enforce-quota-on-security-group-rules.patch b/0009-Implement-quotas-for-security-groups.patch index 23c1173..781228f 100644 --- a/0013-enforce-quota-on-security-group-rules.patch +++ b/0009-Implement-quotas-for-security-groups.patch @@ -1,12 +1,11 @@ -From 8ed501ea6d75228b3490a7c0176cd2f7501d0180 Mon Sep 17 00:00:00 2001 +From a67db4586f70ed881d65e80035b2a25be195ce64 Mon Sep 17 00:00:00 2001 From: Dan Prince <dprince@redhat.com> -Date: Thu, 19 Apr 2012 14:57:16 +0100 -Subject: [PATCH] enforce quota on security group rules +Date: Wed, 11 Apr 2012 21:21:02 -0400 +Subject: [PATCH] Implement quotas for security groups. -There is no limit on the number of security group rules a user can create. -By creating a very large set of rules, an unreasonable number of -iptables rules will be created on compute nodes, resulting in a denial -of service. +Fixes LP Bug #969545 for Essex. + +Change-Id: I3c6a34b43f0e997b45d5e0f97faadd6720bf7752 --- nova/api/ec2/cloud.py | 12 +++++++ nova/api/openstack/compute/contrib/quotas.py | 2 +- diff --git a/0010-Delete-fixed_ips-when-network-is-deleted.patch b/0010-Delete-fixed_ips-when-network-is-deleted.patch new file mode 100644 index 0000000..03ce059 --- /dev/null +++ b/0010-Delete-fixed_ips-when-network-is-deleted.patch @@ -0,0 +1,87 @@ +From 015744e92e601036ddcd77bd2fbed966172cb759 Mon Sep 17 00:00:00 2001 +From: Vishvananda Ishaya <vishvananda@gmail.com> +Date: Tue, 3 Apr 2012 11:30:57 -0700 +Subject: [PATCH] Delete fixed_ips when network is deleted + + * adds failing test + * adds exception that is raised when network is in use + * fixes bug 754900 + +Change-Id: Ib95dc5927561b979b1eea237d4d6dc323483d4a5 +--- + nova/db/sqlalchemy/api.py | 13 +++++++++++++ + nova/exception.py | 4 ++++ + nova/tests/test_db_api.py | 19 +++++++++++++++++++ + 3 files changed, 36 insertions(+), 0 deletions(-) + +diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py +index f2c3062..03ac987 100644 +--- a/nova/db/sqlalchemy/api.py ++++ b/nova/db/sqlalchemy/api.py +@@ -1898,8 +1898,21 @@ def network_create_safe(context, values): + def network_delete_safe(context, network_id): + session = get_session() + with session.begin(): ++ result = session.query(models.FixedIp).\ ++ filter_by(network_id=network_id).\ ++ filter_by(deleted=False).\ ++ filter_by(allocated=True).\ ++ all() ++ if result: ++ raise exception.NetworkInUse(network_id=network_id) + network_ref = network_get(context, network_id=network_id, + session=session) ++ session.query(models.FixedIp).\ ++ filter_by(network_id=network_id).\ ++ filter_by(deleted=False).\ ++ update({'deleted': True, ++ 'updated_at': literal_column('updated_at'), ++ 'deleted_at': utils.utcnow()}) + session.delete(network_ref) + + +diff --git a/nova/exception.py b/nova/exception.py +index eb0bf38..da067b6 100644 +--- a/nova/exception.py ++++ b/nova/exception.py +@@ -525,6 +525,10 @@ class StorageRepositoryNotFound(NotFound): + message = _("Cannot find SR to read/write VDI.") + + ++class NetworkInUse(NovaException): ++ message = _("Network %(network_id)s is still in use.") ++ ++ + class NetworkNotCreated(NovaException): + message = _("%(req)s is required to create a network.") + +diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py +index 8b73580..28f3558 100644 +--- a/nova/tests/test_db_api.py ++++ b/nova/tests/test_db_api.py +@@ -136,6 +136,25 @@ class DbApiTestCase(test.TestCase): + db_network = db.network_get(ctxt, network.id) + self.assertEqual(network.uuid, db_network.uuid) + ++ def test_network_delete_safe(self): ++ ctxt = context.get_admin_context() ++ values = {'host': 'localhost', 'project_id': 'project1'} ++ network = db.network_create_safe(ctxt, values) ++ db_network = db.network_get(ctxt, network.id) ++ values = {'network_id': network['id'], 'address': 'fake1'} ++ address1 = db.fixed_ip_create(ctxt, values) ++ values = {'network_id': network['id'], ++ 'address': 'fake2', ++ 'allocated': True} ++ address2 = db.fixed_ip_create(ctxt, values) ++ self.assertRaises(exception.NetworkInUse, ++ db.network_delete_safe, ctxt, network['id']) ++ db.fixed_ip_update(ctxt, address2, {'allocated': False}) ++ network = db.network_delete_safe(ctxt, network['id']) ++ ctxt = ctxt.elevated(read_deleted='yes') ++ fixed_ip = db.fixed_ip_get_by_address(ctxt, address1) ++ self.assertTrue(fixed_ip['deleted']) ++ + def test_network_create_with_duplicate_vlan(self): + ctxt = context.get_admin_context() + values1 = {'host': 'localhost', 'project_id': 'project1', 'vlan': 1} diff --git a/0011-Xen-Pass-session-to-destroy_vdi.patch b/0011-Xen-Pass-session-to-destroy_vdi.patch new file mode 100644 index 0000000..2212baa --- /dev/null +++ b/0011-Xen-Pass-session-to-destroy_vdi.patch @@ -0,0 +1,25 @@ +From 6c68ef55d966e6c8a2591886535a1590a6da72ad Mon Sep 17 00:00:00 2001 +From: Renuka Apte <renuka.apte@citrix.com> +Date: Wed, 25 Apr 2012 15:55:14 -0700 +Subject: [PATCH] Xen: Pass session to destroy_vdi + +fixes bug 988615 + +Change-Id: I34c59ff536abfdff9221cdb3d9ecc45d1e7a1a90 +--- + nova/virt/xenapi/volumeops.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/nova/virt/xenapi/volumeops.py b/nova/virt/xenapi/volumeops.py +index 2f3aafb..8333c08 100644 +--- a/nova/virt/xenapi/volumeops.py ++++ b/nova/virt/xenapi/volumeops.py +@@ -63,7 +63,7 @@ class VolumeOps(object): + if vdi_ref is None: + raise exception.Error(_('Could not find VDI ref')) + +- vm_utils.VMHelper.destroy_vdi(vdi_ref) ++ vm_utils.VMHelper.destroy_vdi(self._session, vdi_ref) + + def create_sr(self, label, params): + LOG.debug(_("Creating SR %s") % label) diff --git a/0012-add-libvirt_inject_key-flag.patch b/0012-add-libvirt_inject_key-flag.patch new file mode 100644 index 0000000..81f726a --- /dev/null +++ b/0012-add-libvirt_inject_key-flag.patch @@ -0,0 +1,33 @@ +From 5ab505191c3600fc4f4b7b128a04f5c9c8f74bc1 Mon Sep 17 00:00:00 2001 +From: Peng Yong <ppyy@pubyun.com> +Date: Mon, 2 Apr 2012 23:36:20 +0800 +Subject: [PATCH] add libvirt_inject_key flag fix bug #971640 + +Change-Id: I48efc5babdd9b233342a33c87c461aabf5f5915b +--- + nova/virt/libvirt/connection.py | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py +index 888be92..1a00db6 100644 +--- a/nova/virt/libvirt/connection.py ++++ b/nova/virt/libvirt/connection.py +@@ -105,6 +105,9 @@ libvirt_opts = [ + default=False, + help='Inject the admin password at boot time, ' + 'without an agent.'), ++ cfg.BoolOpt('libvirt_inject_key', ++ default=True, ++ help='Inject the ssh public key at boot time'), + cfg.BoolOpt('use_usb_tablet', + default=True, + help='Sync virtual and real mouse cursors in Windows VMs'), +@@ -1294,7 +1297,7 @@ class LibvirtConnection(driver.ComputeDriver): + self._create_local(basepath('disk.config'), 64, unit='M', + fs_format='msdos', label=label) # 64MB + +- if instance['key_data']: ++ if FLAGS.libvirt_inject_key and instance['key_data']: + key = str(instance['key_data']) + else: + key = None diff --git a/0013-Cloudpipe-tap-vpn-not-always-working.patch b/0013-Cloudpipe-tap-vpn-not-always-working.patch new file mode 100644 index 0000000..0ce7544 --- /dev/null +++ b/0013-Cloudpipe-tap-vpn-not-always-working.patch @@ -0,0 +1,51 @@ +From 7c64de95f422add711bcdf5821310435e7be0199 Mon Sep 17 00:00:00 2001 +From: Cor Cornelisse <cor@hyves.nl> +Date: Fri, 6 Apr 2012 15:54:16 +0200 +Subject: [PATCH] Cloudpipe tap vpn not always working + +Fixes bug 975043 + +Since Essex, all instances will have an eth0 MAC address in the range +of FA:16:3E, which is near the end of the MAC address space. + +When openvpn is started, a TAP interface is created with a random +generated MAC address. Chances are high the generated MAC address is +lower in value than the eth0 MAC address. Once the tap interface is +added to the bridge interface, the bridge interface will no longer have +the eth0 MAC address, but take over the TAP MAC address. This is a +feature of the linux kernel, whereby a bridge interface will take the +MAC address with the lowest value amongst its interfaces. After the ARP +entries expire, this will result in the cloudpipe instance being no +longer reachable. + +This fix, randomly generates a MAC address starting with FA:17:3E, which +is greater than FA, and will thus ensure the brige will keep the eth0 MAC +address. + +Change-Id: I0bd994b6dc7a92738ed23cd62ee42a021fd394e2 +--- + nova/cloudpipe/bootscript.template | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/nova/cloudpipe/bootscript.template b/nova/cloudpipe/bootscript.template +index 94dea3f..0fe38b7 100755 +--- a/nova/cloudpipe/bootscript.template ++++ b/nova/cloudpipe/bootscript.template +@@ -24,6 +24,10 @@ export VPN_IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 + export BROADCAST=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f3 | awk '{print $$1}'` + export DHCP_MASK=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f4 | awk '{print $$1}'` + export GATEWAY=`netstat -r | grep default | cut -d' ' -f10` ++# Need a higher valued MAC address than eth0, to prevent the TAP MAC address ++# from becoming the bridge MAC address. Since Essex eth0 MAC starts with ++# FA:16:3E, we'll thus generate a MAC starting with FA:17:3E to be higher than eth0. ++export RANDOM_TAP_MAC=`openssl rand -hex 8 | sed 's/\(..\)/\1:/g' | cut -b-8 | awk '{print "FA:17:3E:"$$1}'` + + DHCP_LOWER=`echo $$BROADCAST | awk -F. '{print $$1"."$$2"."$$3"." $$4 - ${num_vpn} }'` + DHCP_UPPER=`echo $$BROADCAST | awk -F. '{print $$1"."$$2"."$$3"." $$4 - 1 }'` +@@ -47,5 +51,6 @@ sed -i -e s/max-clients\ 1/max-clients\ 10/g server.conf + echo "push \"route ${dmz_net} ${dmz_mask} $$GATEWAY\"" >> server.conf + echo "duplicate-cn" >> server.conf + echo "crl-verify /etc/openvpn/crl.pem" >> server.conf ++echo "lladdr $$RANDOM_TAP_MAC" >> server.conf + + /etc/init.d/openvpn start diff --git a/0014-Don-t-leak-RPC-connections-on-timeouts-or-other-exce.patch b/0014-Don-t-leak-RPC-connections-on-timeouts-or-other-exce.patch new file mode 100644 index 0000000..db2b4d3 --- /dev/null +++ b/0014-Don-t-leak-RPC-connections-on-timeouts-or-other-exce.patch @@ -0,0 +1,37 @@ +From 48a07680b46b9973cd7de1b30ae80bd93861e1bb Mon Sep 17 00:00:00 2001 +From: Chris Behrens <cbehrens@codestud.com> +Date: Wed, 25 Apr 2012 17:34:53 +0000 +Subject: [PATCH] Don't leak RPC connections on timeouts or other exceptions + +Fixes bug 968843 + +Change-Id: I9e0f1e306cab203bf4c865050b7a45f96127062e +--- + nova/rpc/amqp.py | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) + +diff --git a/nova/rpc/amqp.py b/nova/rpc/amqp.py +index 444ade4..4ebd9a4 100644 +--- a/nova/rpc/amqp.py ++++ b/nova/rpc/amqp.py +@@ -39,6 +39,7 @@ from nova import flags + from nova import local + from nova import log as logging + import nova.rpc.common as rpc_common ++from nova import utils + + LOG = logging.getLogger(__name__) + +@@ -296,7 +297,11 @@ class MulticallWaiter(object): + if self._done: + raise StopIteration + while True: +- self._iterator.next() ++ try: ++ self._iterator.next() ++ except Exception: ++ with utils.save_and_reraise_exception(): ++ self.done() + if self._got_ending: + self.done() + raise StopIteration diff --git a/0015-Fixes-bug-987335.patch b/0015-Fixes-bug-987335.patch new file mode 100644 index 0000000..e7737f6 --- /dev/null +++ b/0015-Fixes-bug-987335.patch @@ -0,0 +1,41 @@ +From 108e74b3e770a1d12eda5ed8dea7ca58d5e90cff Mon Sep 17 00:00:00 2001 +From: Alvaro Lopez Garcia <aloga@ifca.unican.es> +Date: Mon, 23 Apr 2012 16:40:38 +0200 +Subject: [PATCH] Fixes bug 987335. + +Revert bug introduced by commit a837f92e that removed +console_log from get_console_output() + +Change-Id: I22a14b5f50c2df0486420b38137328ac87844c1f +--- + nova/virt/libvirt/connection.py | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py +index 888be92..eb0649b 100644 +--- a/nova/virt/libvirt/connection.py ++++ b/nova/virt/libvirt/connection.py +@@ -1006,6 +1006,7 @@ class LibvirtConnection(driver.ComputeDriver): + + self._chown_console_log_for_instance(instance['name']) + data = self._flush_libvirt_console(pty) ++ console_log = self._get_console_log_path(instance_name) + fpath = self._append_to_file(data, console_log) + + return libvirt_utils.load_file(fpath) +@@ -1147,9 +1148,12 @@ class LibvirtConnection(driver.ComputeDriver): + libvirt_utils.mkfs('swap', target) + + @staticmethod +- def _chown_console_log_for_instance(instance_name): +- console_log = os.path.join(FLAGS.instances_path, instance_name, +- 'console.log') ++ def _get_console_log_path(instance_name): ++ return os.path.join(FLAGS.instances_path, instance_name, ++ 'console.log') ++ ++ def _chown_console_log_for_instance(self, instance_name): ++ console_log = self._get_console_log_path(instance_name) + if os.path.exists(console_log): + libvirt_utils.chown(console_log, os.getuid()) + diff --git a/0016-Fix-timeout-in-EC2-CloudController.create_image.patch b/0016-Fix-timeout-in-EC2-CloudController.create_image.patch new file mode 100644 index 0000000..cd705f7 --- /dev/null +++ b/0016-Fix-timeout-in-EC2-CloudController.create_image.patch @@ -0,0 +1,29 @@ +From 1209af45525ed5a58d620a9da92939d39a3d2d9f Mon Sep 17 00:00:00 2001 +From: Eoghan Glynn <eglynn@redhat.com> +Date: Fri, 27 Apr 2012 15:11:57 +0100 +Subject: [PATCH] Fix timeout in EC2 CloudController.create_image() + +Fixes bug 989764 + +The timeout bounding the wait for the instance to stop is intended +to be 1 hour, but the code incorrectly specifies 60 hours instead +(no practical client is going to wait that long for a response). + +Change-Id: I7aa4b539393df15f3b2c950cf7aeca4691ed3d73 +--- + nova/api/ec2/cloud.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py +index 9e2a22e..52def33 100644 +--- a/nova/api/ec2/cloud.py ++++ b/nova/api/ec2/cloud.py +@@ -1614,7 +1614,7 @@ class CloudController(object): + # NOTE(yamahata): timeout and error. 1 hour for now for safety. + # Is it too short/long? + # Or is there any better way? +- timeout = 1 * 60 * 60 * 60 ++ timeout = 1 * 60 * 60 + if time.time() > start_time + timeout: + raise exception.EC2APIError( + _('Couldn\'t stop instance with in %d sec') % timeout) diff --git a/0017-Update-KillFilter-to-handle-deleted-exe-s.patch b/0017-Update-KillFilter-to-handle-deleted-exe-s.patch new file mode 100644 index 0000000..ef4267b --- /dev/null +++ b/0017-Update-KillFilter-to-handle-deleted-exe-s.patch @@ -0,0 +1,61 @@ +From facb936f0bfc6c78fdce93785078e78223b0ddf7 Mon Sep 17 00:00:00 2001 +From: Dan Prince <dprince@redhat.com> +Date: Wed, 28 Mar 2012 22:00:11 -0400 +Subject: [PATCH] Update KillFilter to handle 'deleted' exe's. + +Updates KillFilter so that it handles the case where the executable +linked to by /proc/PID/exe is updated or deleted. + +Fixes LP Bug #967931. + +Also added a unit test to test that 'deleted' exe's are +filtered correctly. + +(cherry picked from commit b24c11b and commit 3d28e3d) + +Change-Id: I368a01383bf62b64b7579d573b8b84640dec03ae +--- + nova/rootwrap/filters.py | 4 ++++ + nova/tests/test_nova_rootwrap.py | 14 ++++++++++++++ + 2 files changed, 18 insertions(+), 0 deletions(-) + +diff --git a/nova/rootwrap/filters.py b/nova/rootwrap/filters.py +index a8fd513..a51ecae 100755 +--- a/nova/rootwrap/filters.py ++++ b/nova/rootwrap/filters.py +@@ -117,6 +117,10 @@ class KillFilter(CommandFilter): + return False + try: + command = os.readlink("/proc/%d/exe" % int(args[1])) ++ # NOTE(dprince): /proc/PID/exe may have ' (deleted)' on ++ # the end if an executable is updated or deleted ++ if command.endswith(" (deleted)"): ++ command = command[:command.rindex(" ")] + if command not in self.args[1]: + # Affected executable not in accepted list + return False +diff --git a/nova/tests/test_nova_rootwrap.py b/nova/tests/test_nova_rootwrap.py +index ee687ea..ca2626b 100644 +--- a/nova/tests/test_nova_rootwrap.py ++++ b/nova/tests/test_nova_rootwrap.py +@@ -103,6 +103,20 @@ class RootwrapTestCase(test.TestCase): + usercmd = ['kill', 'notapid'] + self.assertFalse(f.match(usercmd)) + ++ def test_KillFilter_deleted_exe(self): ++ """Makes sure deleted exe's are killed correctly""" ++ # See bug #967931. ++ def fake_readlink(blah): ++ return '/bin/commandddddd (deleted)' ++ ++ f = filters.KillFilter("/bin/kill", "root", ++ [""], ++ ["/bin/commandddddd"]) ++ usercmd = ['kill', 1234] ++ # Providing no signal should work ++ self.stubs.Set(os, 'readlink', fake_readlink) ++ self.assertTrue(f.match(usercmd)) ++ + def test_ReadFileFilter(self): + goodfn = '/good/file.name' + f = filters.ReadFileFilter(goodfn) diff --git a/0018-Get-unit-tests-functional-in-OS-X.patch b/0018-Get-unit-tests-functional-in-OS-X.patch new file mode 100644 index 0000000..4e381ff --- /dev/null +++ b/0018-Get-unit-tests-functional-in-OS-X.patch @@ -0,0 +1,51 @@ +From 76b525ab22ac63282153e5a7eb9cf5947da10413 Mon Sep 17 00:00:00 2001 +From: Matt Stephenson <mattstep@mattstep.net> +Date: Tue, 3 Apr 2012 14:38:09 -0700 +Subject: [PATCH] Get unit tests functional in OS X + +* Add detection for directio to ensure the python runtime is built with O_DIRECT +* Extend stubbing in test_libvirt to also stub out _supports_direct_io + +Change-Id: Id793d4039311396f0b3c3a52d2a1d951ec3c5e48 +(cherry picked from commit cf7c0a7c10723495953be9bf99aedbe3838e0787) +--- + nova/tests/test_libvirt.py | 7 +++++++ + nova/virt/libvirt/connection.py | 6 ++++++ + 2 files changed, 13 insertions(+), 0 deletions(-) + +diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py +index cdc9121..5163b32 100644 +--- a/nova/tests/test_libvirt.py ++++ b/nova/tests/test_libvirt.py +@@ -899,6 +899,13 @@ class LibvirtConnTestCase(test.TestCase): + + self.stubs.Set(os, 'open', os_open_stub) + ++ def connection_supports_direct_io_stub(*args, **kwargs): ++ return directio_supported ++ ++ self.stubs.Set(connection.LibvirtConnection, ++ '_supports_direct_io', ++ connection_supports_direct_io_stub) ++ + user_context = context.RequestContext(self.user_id, self.project_id) + instance_ref = db.instance_create(user_context, self.test_instance) + network_info = _fake_network_info(self.stubs, 1) +diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py +index 5facc10..00345d2 100644 +--- a/nova/virt/libvirt/connection.py ++++ b/nova/virt/libvirt/connection.py +@@ -1037,7 +1037,13 @@ class LibvirtConnection(driver.ComputeDriver): + + @staticmethod + def _supports_direct_io(dirpath): ++ ++ if not hasattr(os, 'O_DIRECT'): ++ LOG.debug("This python runtime does not support direct I/O") ++ return False ++ + testfile = os.path.join(dirpath, ".directio.test") ++ + hasDirectIO = True + try: + f = os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT) diff --git a/0019-Introduced-flag-base_dir_name.-Fixes-bug-973194.patch b/0019-Introduced-flag-base_dir_name.-Fixes-bug-973194.patch new file mode 100644 index 0000000..094f4d9 --- /dev/null +++ b/0019-Introduced-flag-base_dir_name.-Fixes-bug-973194.patch @@ -0,0 +1,179 @@ +From 7028d66ae97c68f888a2bbf2d3b431702f72b4c5 Mon Sep 17 00:00:00 2001 +From: Mandar Vaze <mandar.vaze@vertex.co.in> +Date: Thu, 5 Apr 2012 01:33:34 -0700 +Subject: [PATCH] Introduced flag base_dir_name. Fixes bug 973194 + +rebased from master. + +If user faces locking related problem when two nova-compute hosts +sharing same disk area via nfs, try to download same image into +cache concurrently - Then base_dir_name can be set to "_base_$my_ip" in +nova.conf + +Default value for base_dir_name is "_base" thus retaining existing +behavior. + +Change-Id: Icff10ed75ba83f7256731614dc9e01e578b347a4 +--- + Authors | 1 + + nova/compute/manager.py | 6 ++++++ + nova/tests/test_imagecache.py | 8 +++++--- + nova/tests/test_libvirt.py | 7 ++++--- + nova/virt/libvirt/connection.py | 3 ++- + nova/virt/libvirt/imagecache.py | 6 ++++-- + 6 files changed, 22 insertions(+), 9 deletions(-) + +diff --git a/Authors b/Authors +index a229313..b9ad28b 100644 +--- a/Authors ++++ b/Authors +@@ -122,6 +122,7 @@ Likitha Shetty <likitha.shetty@citrix.com> + Loganathan Parthipan <parthipan@hp.com> + Lorin Hochstein <lorin@nimbisservices.com> + Lvov Maxim <usrleon@gmail.com> ++Mandar Vaze <mandar.vaze@vertex.co.in> + Mandell Degerness <mdegerne@gmail.com> + Mark McClain <mark.mcclain@dreamhost.com> + Mark McLoughlin <markmc@redhat.com> +diff --git a/nova/compute/manager.py b/nova/compute/manager.py +index 48e135b..053e80e 100644 +--- a/nova/compute/manager.py ++++ b/nova/compute/manager.py +@@ -28,6 +28,7 @@ terminating it. + **Related Flags** + + :instances_path: Where instances are kept on disk ++:base_dir_name: Where cached images are stored under instances_path + :compute_driver: Name of class that is used to handle virtualization, loaded + by :func:`nova.utils.import_object` + +@@ -72,6 +73,11 @@ compute_opts = [ + cfg.StrOpt('instances_path', + default='$state_path/instances', + help='where instances are stored on disk'), ++ cfg.StrOpt('base_dir_name', ++ default='_base', ++ help="where cached images are stored under $instances_path" ++ "This is NOT full path - just a folder name" ++ "For per-compute-host cached images, Set to _base_$my_ip"), + cfg.StrOpt('compute_driver', + default='nova.virt.connection.get_connection', + help='Driver to use for controlling virtualization'), +diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py +index 9cf4003..f1d5aa5 100644 +--- a/nova/tests/test_imagecache.py ++++ b/nova/tests/test_imagecache.py +@@ -36,6 +36,7 @@ from nova.virt.libvirt import utils as virtutils + + + flags.DECLARE('instances_path', 'nova.compute.manager') ++flags.DECLARE('base_dir_name', 'nova.compute.manager') + FLAGS = flags.FLAGS + + LOG = log.getLogger(__name__) +@@ -155,7 +156,7 @@ class ImageCacheManagerTestCase(test.TestCase): + self.stubs.Set(virtutils, 'get_disk_backing_file', + lambda x: 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm') + +- found = os.path.join(FLAGS.instances_path, '_base', ++ found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name, + 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm') + + image_cache_manager = imagecache.ImageCacheManager() +@@ -177,7 +178,7 @@ class ImageCacheManagerTestCase(test.TestCase): + lambda x: ('e97222e91fc4241f49a7f520d1dcf446751129b3_' + '10737418240')) + +- found = os.path.join(FLAGS.instances_path, '_base', ++ found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name, + 'e97222e91fc4241f49a7f520d1dcf446751129b3_' + '10737418240') + +@@ -198,7 +199,7 @@ class ImageCacheManagerTestCase(test.TestCase): + self.stubs.Set(virtutils, 'get_disk_backing_file', + lambda x: 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm') + +- found = os.path.join(FLAGS.instances_path, '_base', ++ found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name, + 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm') + + image_cache_manager = imagecache.ImageCacheManager() +@@ -521,6 +522,7 @@ class ImageCacheManagerTestCase(test.TestCase): + hashed_42 = '92cfceb39d57d914ed8b14d0e37643de0797ae56' + + self.flags(instances_path='/instance_path') ++ self.flags(base_dir_name='_base') + self.flags(remove_unused_base_images=True) + + base_file_list = ['00000001', +diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py +index cdc9121..f12cad4 100644 +--- a/nova/tests/test_libvirt.py ++++ b/nova/tests/test_libvirt.py +@@ -322,7 +322,7 @@ class CacheConcurrencyTestCase(test.TestCase): + self.flags(instances_path='nova.compute.manager') + + def fake_exists(fname): +- basedir = os.path.join(FLAGS.instances_path, '_base') ++ basedir = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name) + if fname == basedir: + return True + return False +@@ -1317,9 +1317,10 @@ class LibvirtConnTestCase(test.TestCase): + if os.path.isdir(path): + shutil.rmtree(path) + +- path = os.path.join(FLAGS.instances_path, '_base') ++ path = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name) + if os.path.isdir(path): +- shutil.rmtree(os.path.join(FLAGS.instances_path, '_base')) ++ shutil.rmtree(os.path.join(FLAGS.instances_path, ++ FLAGS.base_dir_name)) + + def test_get_host_ip_addr(self): + conn = connection.LibvirtConnection(False) +diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py +index 5facc10..f1e5680 100644 +--- a/nova/virt/libvirt/connection.py ++++ b/nova/virt/libvirt/connection.py +@@ -1090,7 +1090,8 @@ class LibvirtConnection(driver.ComputeDriver): + + generating = 'image_id' not in kwargs + if not os.path.exists(target): +- base_dir = os.path.join(FLAGS.instances_path, '_base') ++ base_dir = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name) ++ + if not os.path.exists(base_dir): + libvirt_utils.ensure_tree(base_dir) + base = os.path.join(base_dir, fname) +diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py +index f92376a..adf8214 100644 +--- a/nova/virt/libvirt/imagecache.py ++++ b/nova/virt/libvirt/imagecache.py +@@ -58,6 +58,7 @@ imagecache_opts = [ + ] + + flags.DECLARE('instances_path', 'nova.compute.manager') ++flags.DECLARE('base_dir_name', 'nova.compute.manager') + FLAGS = flags.FLAGS + FLAGS.register_opts(imagecache_opts) + +@@ -178,7 +179,8 @@ class ImageCacheManager(object): + 'backing': backing_file}) + + backing_path = os.path.join(FLAGS.instances_path, +- '_base', backing_file) ++ FLAGS.base_dir_name, ++ backing_file) + if not backing_path in inuse_images: + inuse_images.append(backing_path) + +@@ -372,7 +374,7 @@ class ImageCacheManager(object): + # created, but may remain from previous versions. + self._reset_state() + +- base_dir = os.path.join(FLAGS.instances_path, '_base') ++ base_dir = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name) + if not os.path.exists(base_dir): + LOG.debug(_('Skipping verification, no base directory at %s'), + base_dir) diff --git a/0020-Fix-bug-983206-_try_convert-parsing-string.patch b/0020-Fix-bug-983206-_try_convert-parsing-string.patch new file mode 100644 index 0000000..7b4a028 --- /dev/null +++ b/0020-Fix-bug-983206-_try_convert-parsing-string.patch @@ -0,0 +1,103 @@ +From 21e918a8f6e0fd144287ff7fc2ab3d262ac9edd7 Mon Sep 17 00:00:00 2001 +From: Joe Gordon <jogo@cloudscaling.com> +Date: Fri, 13 Apr 2012 15:12:04 -0400 +Subject: [PATCH] Fix bug 983206 : _try_convert parsing string + +* _try_convert in ec2utils.py didn't handle strings starting with "0x" +* Added tests to cover bug +* Add better float support +* remove unused complex number support + +Change-Id: I382d36f4a8671bcceccfa1ebdbae89a9d2aca207 +(cherry picked from commit c95162e52899618fc269fb536f6a2d3b26b7794d) +--- + nova/api/ec2/ec2utils.py | 35 +++++++++++------------------------ + nova/tests/test_api.py | 12 ++++++++++++ + 2 files changed, 23 insertions(+), 24 deletions(-) + +diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py +index 1a6bb96..0f4aeb0 100644 +--- a/nova/api/ec2/ec2utils.py ++++ b/nova/api/ec2/ec2utils.py +@@ -166,6 +166,10 @@ def _try_convert(value): + * try conversion to int, float, complex, fallback value + + """ ++ def _negative_zero(value): ++ epsilon = 1e-7 ++ return 0 if abs(value) < epsilon else value ++ + if len(value) == 0: + return '' + if value == 'None': +@@ -175,31 +179,14 @@ def _try_convert(value): + return True + if lowered_value == 'false': + return False +- valueneg = value[1:] if value[0] == '-' else value +- if valueneg == '0': +- return 0 +- if valueneg == '': +- return value +- if valueneg[0] == '0': +- if valueneg[1] in 'xX': +- return int(value, 16) +- elif valueneg[1] in 'bB': +- return int(value, 2) +- else: +- try: +- return int(value, 8) +- except ValueError: +- pass +- try: +- return int(value) +- except ValueError: +- pass +- try: +- return float(value) +- except ValueError: +- pass ++ for prefix, base in [('0x', 16), ('0b', 2), ('0', 8), ('', 10)]: ++ try: ++ if lowered_value.startswith((prefix, "-" + prefix)): ++ return int(lowered_value, base) ++ except ValueError: ++ pass + try: +- return complex(value) ++ return _negative_zero(float(value)) + except ValueError: + return value + +diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py +index baaee98..a52319f 100644 +--- a/nova/tests/test_api.py ++++ b/nova/tests/test_api.py +@@ -96,8 +96,10 @@ class XmlConversionTestCase(test.TestCase): + conv = ec2utils._try_convert + self.assertEqual(conv('None'), None) + self.assertEqual(conv('True'), True) ++ self.assertEqual(conv('TRUE'), True) + self.assertEqual(conv('true'), True) + self.assertEqual(conv('False'), False) ++ self.assertEqual(conv('FALSE'), False) + self.assertEqual(conv('false'), False) + self.assertEqual(conv('0'), 0) + self.assertEqual(conv('42'), 42) +@@ -107,6 +109,16 @@ class XmlConversionTestCase(test.TestCase): + self.assertEqual(conv('-0x57'), -0x57) + self.assertEqual(conv('-'), '-') + self.assertEqual(conv('-0'), 0) ++ self.assertEqual(conv('0.0'), 0.0) ++ self.assertEqual(conv('1e-8'), 0.0) ++ self.assertEqual(conv('-1e-8'), 0.0) ++ self.assertEqual(conv('0xDD8G'), '0xDD8G') ++ self.assertEqual(conv('0XDD8G'), '0XDD8G') ++ self.assertEqual(conv('-stringy'), '-stringy') ++ self.assertEqual(conv('stringy'), 'stringy') ++ self.assertEqual(conv('add'), 'add') ++ self.assertEqual(conv('remove'), 'remove') ++ self.assertEqual(conv(''), '') + + + class Ec2utilsTestCase(test.TestCase): diff --git a/0021-QuantumManager-will-start-dnsmasq-during-startup.-Fi.patch b/0021-QuantumManager-will-start-dnsmasq-during-startup.-Fi.patch new file mode 100644 index 0000000..3f37ff0 --- /dev/null +++ b/0021-QuantumManager-will-start-dnsmasq-during-startup.-Fi.patch @@ -0,0 +1,50 @@ +From 26dc6b75c73f10c2da7628ce59e225d1006d9d1c Mon Sep 17 00:00:00 2001 +From: Mandar Vaze <mandar.vaze@vertex.co.in> +Date: Wed, 11 Apr 2012 01:43:22 -0700 +Subject: [PATCH] QuantumManager will start dnsmasq during startup. Fixes bug + 977759 + +Added _setup_network_on_host method, which calls update_dhcp +if quantum_use_dhcp is set. + +Change-Id: I193212037873001a03da7b7a484f61a5c13b5de8 +--- + Authors | 1 + + nova/network/quantum/manager.py | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 0 deletions(-) + +diff --git a/nova/network/quantum/manager.py b/nova/network/quantum/manager.py +index eb0f389..498b5f0 100644 +--- a/nova/network/quantum/manager.py ++++ b/nova/network/quantum/manager.py +@@ -88,6 +88,7 @@ class QuantumManager(manager.FloatingIP, manager.FlatManager): + def init_host(self): + # Initialize general L3 networking + self.l3driver.initialize() ++ super(QuantumManager, self).init_host() + # Initialize floating ip support (only works for nova ipam currently) + if FLAGS.quantum_ipam_lib == 'nova.network.quantum.nova_ipam_lib': + LOG.debug("Initializing FloatingIP support") +@@ -107,6 +108,22 @@ class QuantumManager(manager.FloatingIP, manager.FlatManager): + for c in cidrs: + self.l3driver.initialize_network(c) + ++ # Similar to FlatDHCPMananger, except we check for quantum_use_dhcp flag ++ # before we try to update_dhcp ++ def _setup_network_on_host(self, context, network): ++ """Sets up network on this host.""" ++ network['dhcp_server'] = self._get_dhcp_ip(context, network) ++ self.l3driver.initialize_gateway(network) ++ ++ if FLAGS.quantum_use_dhcp and not FLAGS.fake_network: ++ dev = self.driver.get_dev(network) ++ self.driver.update_dhcp(context, dev, network) ++ if FLAGS.use_ipv6: ++ self.driver.update_ra(context, dev, network) ++ gateway = utils.get_my_linklocal(dev) ++ self.db.network_update(context, network['id'], ++ {'gateway_v6': gateway}) ++ + def _update_network_host(self, context, net_uuid): + """Set the host column in the networks table: note that this won't + work with multi-host but QuantumManager doesn't support that diff --git a/0022-Fixes-bug-952176.patch b/0022-Fixes-bug-952176.patch new file mode 100644 index 0000000..2447930 --- /dev/null +++ b/0022-Fixes-bug-952176.patch @@ -0,0 +1,28 @@ +From 9e9a554cba9e52430c2b2857bed744aba2ff8f9e Mon Sep 17 00:00:00 2001 +From: MotoKen <motokentsai@gmail.com> +Date: Mon, 9 Apr 2012 10:33:55 +0800 +Subject: [PATCH] Fixes bug 952176 + +Checks if value is string or not before decode. + +Change-Id: I3f839770fdd7b00223ce02b95b2a265d903fa00e +--- + bin/nova-manage | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/bin/nova-manage b/bin/nova-manage +index c0009bc..f5491bc 100755 +--- a/bin/nova-manage ++++ b/bin/nova-manage +@@ -1721,8 +1721,10 @@ def main(): + for k, v in fn_kwargs.items(): + if v is None: + del fn_kwargs[k] +- else: ++ elif isinstance(v, basestring): + fn_kwargs[k] = v.decode('utf-8') ++ else: ++ fn_kwargs[k] = v + + fn_args = [arg.decode('utf-8') for arg in fn_args] + diff --git a/0023-Fix-nova.tests.test_nova_rootwrap-on-Fedora-17.patch b/0023-Fix-nova.tests.test_nova_rootwrap-on-Fedora-17.patch new file mode 100644 index 0000000..c95fcf3 --- /dev/null +++ b/0023-Fix-nova.tests.test_nova_rootwrap-on-Fedora-17.patch @@ -0,0 +1,38 @@ +From e5e890f3117c792544d6a87d887543d502d1cb55 Mon Sep 17 00:00:00 2001 +From: Russell Bryant <rbryant@redhat.com> +Date: Tue, 1 May 2012 18:29:04 -0400 +Subject: [PATCH] Fix nova.tests.test_nova_rootwrap on Fedora 17. + +Fix bug 992916 + +This patch resolves a unit test failure on Fedora 17. The root cause is +that 'sleep' is '/usr/bin/sleep' instead of '/bin/sleep'. Update the +test to allow that. + +Change-Id: I5c8e04baec7159a8c10c9beb96cff58fd383e71c +--- + nova/tests/test_nova_rootwrap.py | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nova/tests/test_nova_rootwrap.py b/nova/tests/test_nova_rootwrap.py +index ca2626b..4cd6818 100644 +--- a/nova/tests/test_nova_rootwrap.py ++++ b/nova/tests/test_nova_rootwrap.py +@@ -69,7 +69,7 @@ class RootwrapTestCase(test.TestCase): + p = subprocess.Popen(["/bin/sleep", "5"]) + f = filters.KillFilter("/bin/kill", "root", + ["-ALRM"], +- ["/bin/sleep"]) ++ ["/bin/sleep", "/usr/bin/sleep"]) + usercmd = ['kill', '-9', p.pid] + # Incorrect signal should fail + self.assertFalse(f.match(usercmd)) +@@ -79,7 +79,7 @@ class RootwrapTestCase(test.TestCase): + + f = filters.KillFilter("/bin/kill", "root", + ["-9", ""], +- ["/bin/sleep"]) ++ ["/bin/sleep", "/usr/bin/sleep"]) + usercmd = ['kill', '-9', os.getpid()] + # Our own PID does not match /bin/sleep, so it should fail + self.assertFalse(f.match(usercmd)) diff --git a/0009-ensure-atomic-manipulation-of-libvirt-disk-images.patch b/0024-ensure-atomic-manipulation-of-libvirt-disk-images.patch index ed791d7..f4a760f 100644 --- a/0009-ensure-atomic-manipulation-of-libvirt-disk-images.patch +++ b/0024-ensure-atomic-manipulation-of-libvirt-disk-images.patch @@ -1,4 +1,4 @@ -From 5f41789556eb850732ebaa2fe3f175209ce2c198 Mon Sep 17 00:00:00 2001 +From 6a3eabcd01981c6ccead47e2b610bd82b5d6be80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com> Date: Fri, 16 Mar 2012 03:43:49 +0000 Subject: [PATCH] ensure atomic manipulation of libvirt disk images @@ -169,10 +169,10 @@ index 1e0ae0a..626f3ff 100644 return metadata diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py -index 888be92..2ade19a 100644 +index 31e6511..dc16d05 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py -@@ -1094,7 +1094,8 @@ class LibvirtConnection(driver.ComputeDriver): +@@ -1105,7 +1105,8 @@ class LibvirtConnection(driver.ComputeDriver): @utils.synchronized(fname) def call_if_not_exists(base, fn, *args, **kwargs): if not os.path.exists(base): @@ -182,7 +182,7 @@ index 888be92..2ade19a 100644 if cow or not generating: call_if_not_exists(base, fn, *args, **kwargs) -@@ -1110,8 +1111,9 @@ class LibvirtConnection(driver.ComputeDriver): +@@ -1121,8 +1122,9 @@ class LibvirtConnection(driver.ComputeDriver): size_gb = size / (1024 * 1024 * 1024) cow_base += "_%d" % size_gb if not os.path.exists(cow_base): @@ -194,7 +194,7 @@ index 888be92..2ade19a 100644 libvirt_utils.create_cow_image(cow_base, target) elif not generating: libvirt_utils.copy_image(base, target) -@@ -1121,7 +1123,8 @@ class LibvirtConnection(driver.ComputeDriver): +@@ -1132,7 +1134,8 @@ class LibvirtConnection(driver.ComputeDriver): if size: disk.extend(target, size) @@ -204,7 +204,7 @@ index 888be92..2ade19a 100644 @staticmethod def _create_local(target, local_size, unit='G', -@@ -1291,8 +1294,9 @@ class LibvirtConnection(driver.ComputeDriver): +@@ -1305,8 +1308,9 @@ class LibvirtConnection(driver.ComputeDriver): project_id=instance['project_id'],) elif config_drive: label = 'config' @@ -214,5 +214,5 @@ index 888be92..2ade19a 100644 + self._create_local(basepath('disk.config'), 64, unit='M', + fs_format='msdos', label=label) # 64MB - if instance['key_data']: + if FLAGS.libvirt_inject_key and instance['key_data']: key = str(instance['key_data']) diff --git a/0010-Ensure-we-don-t-access-the-net-when-building-docs.patch b/0025-Ensure-we-don-t-access-the-net-when-building-docs.patch index df40317..0f49ded 100644 --- a/0010-Ensure-we-don-t-access-the-net-when-building-docs.patch +++ b/0025-Ensure-we-don-t-access-the-net-when-building-docs.patch @@ -1,4 +1,4 @@ -From 3057a7b6d56a6ad26d70af516fd28ee55938eb64 Mon Sep 17 00:00:00 2001 +From 73185a4a4abe3dc87efa7ec1b4e60f98c049b75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com> Date: Fri, 6 Jan 2012 12:16:34 +0000 Subject: [PATCH] Ensure we don't access the net when building docs diff --git a/0011-fix-useexisting-deprecation-warnings.patch b/0026-fix-useexisting-deprecation-warnings.patch index 856cd7a..dbc3a07 100644 --- a/0011-fix-useexisting-deprecation-warnings.patch +++ b/0026-fix-useexisting-deprecation-warnings.patch @@ -1,4 +1,4 @@ -From a2760a769da807184deb0f45ea6ec5f84afd5251 Mon Sep 17 00:00:00 2001 +From bf7f18bf91718babb30e8ded89410667bc940320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com> Date: Thu, 8 Mar 2012 16:32:30 +0000 Subject: [PATCH] fix useexisting deprecation warnings diff --git a/0012-support-a-configurable-libvirt-injection-partition.patch b/0027-support-a-configurable-libvirt-injection-partition.patch index deeb2f4..343b50e 100644 --- a/0012-support-a-configurable-libvirt-injection-partition.patch +++ b/0027-support-a-configurable-libvirt-injection-partition.patch @@ -1,4 +1,4 @@ -From fe56b346bb01559248a1ea3c59c2a4baf95f3646 Mon Sep 17 00:00:00 2001 +From 862cb7a4bad82f7347f495ad3a91df31cad79214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com> Date: Wed, 18 Apr 2012 23:27:31 +0100 Subject: [PATCH] support a configurable libvirt injection partition @@ -47,13 +47,13 @@ index 4fb5dda..11959b2 100644 else: self.mapped_device = map_path diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py -index 2ade19a..5a9db4e 100644 +index dc16d05..81fd587 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py -@@ -105,6 +105,11 @@ libvirt_opts = [ - default=False, - help='Inject the admin password at boot time, ' - 'without an agent.'), +@@ -108,6 +108,11 @@ libvirt_opts = [ + cfg.BoolOpt('libvirt_inject_key', + default=True, + help='Inject the ssh public key at boot time'), + cfg.IntOpt('libvirt_inject_partition', + default=1, + help='The partition to inject to : ' @@ -62,7 +62,7 @@ index 2ade19a..5a9db4e 100644 cfg.BoolOpt('use_usb_tablet', default=True, help='Sync virtual and real mouse cursors in Windows VMs'), -@@ -1271,12 +1276,11 @@ class LibvirtConnection(driver.ComputeDriver): +@@ -1285,12 +1290,11 @@ class LibvirtConnection(driver.ComputeDriver): cow=FLAGS.use_cow_images, swap_mb=swap_mb) diff --git a/0028-handle-updated-qemu-img-info-output.patch b/0028-handle-updated-qemu-img-info-output.patch new file mode 100644 index 0000000..bb453f3 --- /dev/null +++ b/0028-handle-updated-qemu-img-info-output.patch @@ -0,0 +1,55 @@ +From 4099a82112d192ba01cb3c5fb3a71b5ef8bb7683 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com> +Date: Wed, 16 May 2012 13:44:46 +0100 +Subject: [PATCH] handle updated qemu-img info output + +Originally `qemu-img info` always output an (actual path: ...) +even if it was duplicated with that already on the line. + + $ instances=/var/lib/nova/instances/ + $ qemu-img info $instances/instance-00000017/disk | grep 'backing' + backing file: $instances/_base/24083... (actual path: $the_same) + +Whereas after the change referenced at: +https://lists.gnu.org/archive/html/qemu-devel/2012-05/msg01468.html +It suppresses a duplicate (actual path:) + + $ instances=/var/lib/nova/instances/ + $ qemu-img info $instances/instance-00000017/disk | grep 'backing' + backing file: $instances/_base/24083... + +* nova/virt/libvirt/utils.py (get_disk_backing_file): +Avoid an indexError exception when parsing the newer format. +Fixes bug 1000261 + +Change-Id: Ie2889b6da8a5c93e0e874e7a330529f6e6e71b0b +--- + nova/virt/libvirt/utils.py | 14 +++++++++++--- + 1 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py +index db7e11b..977eda8 100644 +--- a/nova/virt/libvirt/utils.py ++++ b/nova/virt/libvirt/utils.py +@@ -92,10 +92,18 @@ def get_disk_backing_file(path): + :returns: a path to the image's backing store + """ + out, err = execute('qemu-img', 'info', path) +- backing_file = [i.split('actual path:')[1].strip()[:-1] +- for i in out.split('\n') if 0 <= i.find('backing file')] ++ backing_file = None ++ ++ for line in out.split('\n'): ++ if line.startswith('backing file: '): ++ if 'actual path: ' in line: ++ backing_file = line.split('actual path: ')[1][:-1] ++ else: ++ backing_file = line.split('backing file: ')[1] ++ break + if backing_file: +- backing_file = os.path.basename(backing_file[0]) ++ backing_file = os.path.basename(backing_file) ++ + return backing_file + + diff --git a/openstack-nova.spec b/openstack-nova.spec index 8f1bff9..6817eaa 100644 --- a/openstack-nova.spec +++ b/openstack-nova.spec @@ -2,7 +2,7 @@ Name: openstack-nova Version: 2012.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: OpenStack Compute (nova) Group: Applications/System @@ -41,11 +41,26 @@ Patch0005: 0005-Fix-errors-in-os-networks-extension.patch Patch0006: 0006-Create-compute.api.BaseAPI-for-compute-APIs-to-use.patch Patch0007: 0007-Populate-image-properties-with-project_id-again.patch Patch0008: 0008-Use-project_id-in-ec2.cloud._format_image.patch -Patch0009: 0009-ensure-atomic-manipulation-of-libvirt-disk-images.patch -Patch0010: 0010-Ensure-we-don-t-access-the-net-when-building-docs.patch -Patch0011: 0011-fix-useexisting-deprecation-warnings.patch -Patch0012: 0012-support-a-configurable-libvirt-injection-partition.patch -Patch0013: 0013-enforce-quota-on-security-group-rules.patch +Patch0009: 0009-Implement-quotas-for-security-groups.patch +Patch0010: 0010-Delete-fixed_ips-when-network-is-deleted.patch +Patch0011: 0011-Xen-Pass-session-to-destroy_vdi.patch +Patch0012: 0012-add-libvirt_inject_key-flag.patch +Patch0013: 0013-Cloudpipe-tap-vpn-not-always-working.patch +Patch0014: 0014-Don-t-leak-RPC-connections-on-timeouts-or-other-exce.patch +Patch0015: 0015-Fixes-bug-987335.patch +Patch0016: 0016-Fix-timeout-in-EC2-CloudController.create_image.patch +Patch0017: 0017-Update-KillFilter-to-handle-deleted-exe-s.patch +Patch0018: 0018-Get-unit-tests-functional-in-OS-X.patch +Patch0019: 0019-Introduced-flag-base_dir_name.-Fixes-bug-973194.patch +Patch0020: 0020-Fix-bug-983206-_try_convert-parsing-string.patch +Patch0021: 0021-QuantumManager-will-start-dnsmasq-during-startup.-Fi.patch +Patch0022: 0022-Fixes-bug-952176.patch +Patch0023: 0023-Fix-nova.tests.test_nova_rootwrap-on-Fedora-17.patch +Patch0024: 0024-ensure-atomic-manipulation-of-libvirt-disk-images.patch +Patch0025: 0025-Ensure-we-don-t-access-the-net-when-building-docs.patch +Patch0026: 0026-fix-useexisting-deprecation-warnings.patch +Patch0027: 0027-support-a-configurable-libvirt-injection-partition.patch +Patch0028: 0028-handle-updated-qemu-img-info-output.patch BuildArch: noarch BuildRequires: intltool @@ -193,6 +208,21 @@ This package contains documentation files for nova. %patch0011 -p1 %patch0012 -p1 %patch0013 -p1 +%patch0014 -p1 +%patch0015 -p1 +%patch0016 -p1 +%patch0017 -p1 +%patch0018 -p1 +%patch0019 -p1 +%patch0020 -p1 +%patch0021 -p1 +%patch0022 -p1 +%patch0023 -p1 +%patch0024 -p1 +%patch0025 -p1 +%patch0026 -p1 +%patch0027 -p1 +%patch0028 -p1 find . \( -name .gitignore -o -name .placeholder \) -delete @@ -394,6 +424,10 @@ fi %endif %changelog +* Wed May 16 2012 Pádraig Brady <P@draigBrady.com> - 2012.1-5 +- Sync up with Essex stable branch +- Handle updated qemu-img info output + * Wed May 09 2012 Alan Pevec <apevec@redhat.com> - 2012.1-4 - Remove the socat dependency no longer needed by Essex |
