summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-05-29 18:39:07 -0400
committerRussell Bryant <rbryant@redhat.com>2012-05-31 15:19:31 -0400
commit093bdd6edff7ec391145018a0d3ce8e9dc1f84ff (patch)
tree81f47a5cd2b7edaf1abad37dba5172ffde2c01c6 /nova/tests
parent3a829e3543b8a346fce95f71cd51f68e7c4aae41 (diff)
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
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py15
-rw-r--r--nova/tests/compute/test_rpcapi.py8
2 files changed, 16 insertions, 7 deletions
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')