summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-26 16:45:22 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-26 18:46:32 -0400
commitd5c3271b1159ea3dfce3c0bf56b75006784ee439 (patch)
treef1a07d430f26990985c7b4f94e213751a6ac1f04 /nova/tests
parent2203249e190535aff7799a689effff77743fba61 (diff)
Send a full instance via rpc for post_live_migration_at_destination.
Change the post_live_migration_at_destination 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. The method got moved in rpcapi.py, but that was just to restore alphabetical order. Part of blueprint no-db-messaging. Change-Id: Ib36cb065f838f644e97b6e82b39409737df15558
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py8
-rw-r--r--nova/tests/compute/test_rpcapi.py13
2 files changed, 9 insertions, 12 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 76b3666a7..9fcb004a4 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1658,9 +1658,9 @@ class ComputeTestCase(BaseTestCase):
# creating testdata
c = context.get_admin_context()
- inst_ref = self._create_fake_instance({
+ inst_ref = jsonutils.to_primitive(self._create_fake_instance({
'state_description': 'migrating',
- 'state': power_state.PAUSED})
+ 'state': power_state.PAUSED}))
inst_uuid = inst_ref['uuid']
inst_id = inst_ref['id']
@@ -1680,8 +1680,8 @@ class ComputeTestCase(BaseTestCase):
self.mox.StubOutWithMock(rpc, 'call')
rpc.call(c, rpc.queue_get_for(c, FLAGS.compute_topic, dest),
{"method": "post_live_migration_at_destination",
- "args": {'instance_id': inst_id, 'block_migration': False},
- "version": "1.0"}, None)
+ "args": {'instance': inst_ref, 'block_migration': False},
+ "version": "1.20"}, None)
self.mox.StubOutWithMock(self.compute.driver, 'unplug_vifs')
self.compute.driver.unplug_vifs(inst_ref, [])
rpc.call(c, 'network', {'method': 'setup_networks_on_host',
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index 181fbfa91..9644ce8d8 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -54,9 +54,9 @@ class ComputeRpcAPITestCase(test.TestCase):
'check_can_live_migrate_source', 'confirm_resize',
'detach_volume', 'finish_resize', 'finish_revert_resize',
'get_console_output', 'get_diagnostics', 'get_vnc_console',
- 'inject_file', 'inject_network_info',
- 'pause_instance', 'reboot_instance', 'suspend_instance',
- 'unpause_instance'
+ 'inject_file', 'inject_network_info', 'pause_instance',
+ 'post_live_migration_at_destination', 'reboot_instance',
+ 'suspend_instance', 'unpause_instance'
]
if 'rpcapi_class' in kwargs:
@@ -82,10 +82,7 @@ class ComputeRpcAPITestCase(test.TestCase):
instance = expected_msg['args']['instance']
del expected_msg['args']['instance']
if method in ['rollback_live_migration_at_destination',
- 'pre_live_migration', 'remove_volume_connection',
- 'post_live_migration_at_destination',
- 'check_can_live_migrate_destination',
- 'check_can_live_migrate_source']:
+ 'pre_live_migration', 'remove_volume_connection']:
expected_msg['args']['instance_id'] = instance['id']
else:
expected_msg['args']['instance_uuid'] = instance['uuid']
@@ -209,7 +206,7 @@ class ComputeRpcAPITestCase(test.TestCase):
def test_post_live_migration_at_destination(self):
self._test_compute_api('post_live_migration_at_destination', 'call',
instance=self.fake_instance, block_migration='block_migration',
- host='host')
+ host='host', version='1.20')
def test_pause_instance(self):
self._test_compute_api('pause_instance', 'cast',