From 093bdd6edff7ec391145018a0d3ce8e9dc1f84ff Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 29 May 2012 18:39:07 -0400 Subject: Add pre_live_migration() to the compute rpcapi. Part of bug 1006467. This patch adds pre_live_migration() to the compute rpcapi. It is used by the compute manager. Change-Id: I70fb66ad194837faa1139e644888c4a7c7a5a0a6 --- nova/tests/compute/test_compute.py | 15 +++++++++------ nova/tests/compute/test_rpcapi.py | 8 +++++++- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index f1903bd4c..e218fe60b 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -1447,8 +1447,9 @@ class ComputeTestCase(BaseTestCase): {"method": "pre_live_migration", "args": {'instance_id': inst_ref['id'], 'block_migration': True, - 'disk': None} - }).AndRaise(rpc.common.RemoteError('', '', '')) + 'disk': None}, + "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION + }, None).AndRaise(rpc.common.RemoteError('', '', '')) # mocks for rollback rpc.call(c, 'network', {'method': 'setup_networks_on_host', @@ -1485,10 +1486,12 @@ class ComputeTestCase(BaseTestCase): # create self.mox.StubOutWithMock(rpc, 'call') - rpc.call(c, topic, {"method": "pre_live_migration", - "args": {'instance_id': instance_id, - 'block_migration': False, - 'disk': None}}) + rpc.call(c, topic, + {"method": "pre_live_migration", + "args": {'instance_id': instance_id, + 'block_migration': False, + 'disk': None}, + "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None) # start test self.mox.ReplayAll() diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index 95edb3622..b817d04af 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -57,7 +57,8 @@ class ComputeRpcAPITestCase(test.TestCase): if 'instance' in expected_msg['args']: instance = expected_msg['args']['instance'] del expected_msg['args']['instance'] - if method in ['rollback_live_migration_at_destination']: + if method in ['rollback_live_migration_at_destination', + 'pre_live_migration']: expected_msg['args']['instance_id'] = instance['id'] else: expected_msg['args']['instance_uuid'] = instance['uuid'] @@ -172,6 +173,11 @@ class ComputeRpcAPITestCase(test.TestCase): self._test_compute_api('power_on_instance', 'cast', instance=self.fake_instance) + def test_pre_live_migration(self): + self._test_compute_api('pre_live_migration', 'call', + instance=self.fake_instance, block_migration='block_migration', + disk='disk', host='host') + def test_reboot_instance(self): self._test_compute_api('reboot_instance', 'cast', instance=self.fake_instance, reboot_type='type') -- cgit