From 7f9874b8c4bceb6cf7dff1ecfd4729f9927195b2 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 10 Apr 2013 09:37:24 -0400 Subject: Fix issues with check_instance_shared_storage. Commit 52f6981aa35e27c48587ad2320891db8364edd02 added a new method to the compute rpc API. A test was not added to compute/test_rpcapi.py for this. I noticed when I hit a bug in a patch I'm working on that would have been caught by this test. The addition to the client side also missed adding the version number that was required for this method to be supported. Since the versioning wasn't set up fully, this patch goes ahead and adds the instance to the data being sent, as well. It's more consistent, even if not used (yet). Fix bug 1167356. Change-Id: I46055a666fe3cf4a923002f11d22c3b6a6d020e2 --- nova/compute/manager.py | 2 +- nova/compute/rpcapi.py | 4 +++- nova/tests/compute/test_rpcapi.py | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 687594ab9..e23b7c0e9 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3062,7 +3062,7 @@ class ComputeManager(manager.SchedulerDependentManager): raise exception.NotFound(_("Host %(host)s not found") % locals()) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - def check_instance_shared_storage(self, ctxt, data): + def check_instance_shared_storage(self, ctxt, instance, data): """Check if the instance files are shared :param context: security context diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 1ddadde75..dfa19517e 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -251,9 +251,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): def check_instance_shared_storage(self, ctxt, instance, data): instance_p = jsonutils.to_primitive(instance) return self.call(ctxt, self.make_msg('check_instance_shared_storage', + instance=instance_p, data=data), topic=_compute_topic(self.topic, ctxt, None, - instance)) + instance), + version='2.28') def confirm_resize(self, ctxt, instance, migration, host, reservations=None, cast=True): diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index a089e9dc6..2edf2e20f 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -122,6 +122,10 @@ class ComputeRpcAPITestCase(test.TestCase): instance=self.fake_instance, dest_check_data={"test": "data"}) + def test_check_instance_shared_storage(self): + self._test_compute_api('check_instance_shared_storage', 'call', + instance=self.fake_instance, data='foo', version='2.28') + def test_confirm_resize_cast(self): self._test_compute_api('confirm_resize', 'cast', instance=self.fake_instance, migration={'id': 'foo'}, -- cgit