From c45eb1fe80e6e224b0617fb3d789949c0d0b8dd1 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 8 Aug 2012 17:59:56 -0400 Subject: Fix stale instances being sent over rpc. There were a number of places in compute/api.py that were calling self.update() for an instance, but not sending an instance that contains those updates over rpc. This patch fixes them. The changes to the unit tests were required because its stubs were returning an instance without a host set in some cases. So, the result of self.update() had no host and the rpcapi would blow up since it had no idea where to send the message. This patch does not fix self.update() before prep_resize, because it is being addressed in this patch: https://review.openstack.org/#/c/11050/ Change-Id: I4efc922a6a0af0605d4d63012d55ff8473211fd5 --- nova/tests/api/openstack/compute/test_server_actions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py index 851fb57f2..f062dd5a9 100644 --- a/nova/tests/api/openstack/compute/test_server_actions.py +++ b/nova/tests/api/openstack/compute/test_server_actions.py @@ -41,7 +41,7 @@ def return_server_not_found(context, uuid): def instance_update(context, instance_uuid, kwargs): - inst = fakes.stub_instance(INSTANCE_IDS[instance_uuid]) + inst = fakes.stub_instance(INSTANCE_IDS[instance_uuid], host='fake_host') return (inst, inst) @@ -463,7 +463,8 @@ class ServerActionsControllerTest(test.TestCase): update(context, mox.IgnoreArg(), image_ref=self._image_href, task_state=task_states.REBUILDING, - progress=0, **attributes).AndReturn(None) + progress=0, **attributes).AndReturn( + fakes.stub_instance(1, host='fake_host')) self.mox.ReplayAll() self.controller._action_rebuild(req, FAKE_UUID, body) -- cgit