From 7c489cbdf45cdc9c4fb6d1ecfed52fe8702ed52f Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 25 Jul 2012 15:59:47 -0400 Subject: Send a full instance via rpc for check_can_live_migrate_source. Change the check_can_live_migrate_source 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. Part of blueprint no-db-messaging. Change-Id: Ifc655fb86c94adc9a64e878a89a77342313cace2 --- nova/tests/compute/test_compute.py | 8 ++++---- nova/tests/compute/test_rpcapi.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index e2c736c54..6ccf2e312 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -1404,7 +1404,8 @@ class ComputeTestCase(BaseTestCase): def test_check_can_live_migrate_source_works_correctly(self): """Confirm check_can_live_migrate_source works on positive path""" context = self.context.elevated() - inst_ref = self._create_fake_instance({'host': 'fake_host_2'}) + inst_ref = jsonutils.to_primitive(self._create_fake_instance( + {'host': 'fake_host_2'})) inst_id = inst_ref["id"] dest = "fake_host_1" @@ -1413,14 +1414,13 @@ class ComputeTestCase(BaseTestCase): 'check_can_live_migrate_source') dest_check_data = {"test": "data"} - db.instance_get(context, inst_id).AndReturn(inst_ref) self.compute.driver.check_can_live_migrate_source(context, inst_ref, dest_check_data) self.mox.ReplayAll() - self.compute.check_can_live_migrate_source(context, inst_id, - dest_check_data) + self.compute.check_can_live_migrate_source(context, + dest_check_data=dest_check_data, instance=inst_ref) def test_check_can_live_migrate_destination_works_correctly(self): """Confirm check_can_live_migrate_destination works on positive path""" diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index 6d9e32fc7..9be465ca9 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -50,7 +50,8 @@ class ComputeRpcAPITestCase(test.TestCase): methods_with_instance = [ 'add_fixed_ip_to_instance', 'attach_volume', - 'check_can_live_migrate_destination', 'get_console_output', + 'check_can_live_migrate_destination', + 'check_can_live_migrate_source', 'get_console_output', 'pause_instance', 'reboot_instance', 'suspend_instance', 'unpause_instance' ] @@ -139,7 +140,7 @@ class ComputeRpcAPITestCase(test.TestCase): def test_check_can_live_migrate_source(self): self._test_compute_api('check_can_live_migrate_source', 'call', - version='1.2', instance=self.fake_instance, + version='1.11', instance=self.fake_instance, dest_check_data={"test": "data"}) def test_confirm_resize_cast(self): -- cgit