From 14129b4af8795a28a62b69897dc5cd6602353cc9 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 31 Jul 2012 15:31:55 -0400 Subject: Send a full instance in change_instance_metadata. Change the change_instance_metadata method of the compute rpc API to take a full instance over rpc instead of just the instance UUID. This cuts down on database access needed by nova-compute. These methods were moved in rpcapi.py and test_rpcapi.py but only because the rest of the file was in alphabetical order. The move puts it in the right place to maintain that order. Part of blueprint no-db-messaging. Change-Id: I7dd2fb7480010893f66c753b3d31a4556009efe0 --- nova/tests/compute/test_compute.py | 3 ++- nova/tests/compute/test_rpcapi.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index d8bf703ea..5cee6f94d 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3382,7 +3382,8 @@ class ComputeAPITestCase(BaseTestCase): def test_instance_metadata(self): meta_changes = [None] - def fake_change_instance_metadata(inst, ctxt, instance, diff): + def fake_change_instance_metadata(inst, ctxt, diff, instance=None, + instance_uuid=None): meta_changes[0] = diff self.stubs.Set(compute_rpcapi.ComputeAPI, 'change_instance_metadata', fake_change_instance_metadata) diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index 3c9806b57..e099a776c 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -50,7 +50,7 @@ class ComputeRpcAPITestCase(test.TestCase): methods_with_instance = [ 'add_fixed_ip_to_instance', 'attach_volume', - 'check_can_live_migrate_destination', + 'change_instance_metadata', 'check_can_live_migrate_destination', 'check_can_live_migrate_source', 'confirm_resize', 'detach_volume', 'finish_resize', 'finish_revert_resize', 'get_console_output', 'get_diagnostics', 'get_vnc_console', @@ -132,6 +132,11 @@ class ComputeRpcAPITestCase(test.TestCase): instance=self.fake_instance, volume_id='id', mountpoint='mp', version='1.9') + def test_change_instance_metadata(self): + self._test_compute_api('change_instance_metadata', 'cast', + instance=self.fake_instance, diff={}, + version='1.36') + def test_check_can_live_migrate_destination(self): self._test_compute_api('check_can_live_migrate_destination', 'call', version='1.10', instance=self.fake_instance, @@ -337,8 +342,3 @@ class ComputeRpcAPITestCase(test.TestCase): def test_unrescue_instance(self): self._test_compute_api('unrescue_instance', 'cast', instance=self.fake_instance, version='1.35') - - def test_change_instance_metadata(self): - self._test_compute_api('change_instance_metadata', 'cast', - instance=self.fake_instance, diff={}, - version='1.3') -- cgit