summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-25 15:59:47 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-25 20:44:20 -0400
commit7c489cbdf45cdc9c4fb6d1ecfed52fe8702ed52f (patch)
tree384471b70f4da1d9008d2963e65f54a5ab50bdec /nova/tests
parenta6f06782157a5cd3384ae63d723f98e01c0792a1 (diff)
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
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py8
-rw-r--r--nova/tests/compute/test_rpcapi.py5
2 files changed, 7 insertions, 6 deletions
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):