summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-08-03 23:11:03 -0400
committerRussell Bryant <rbryant@redhat.com>2012-08-06 15:09:33 -0400
commitabe509fae061f7c14d6b02e9718031e90cfb3ffa (patch)
treec66549e9ee5cc9fc835f9f852513c10ec0ab7ba4 /nova/tests
parent2ed2c411a982e297d6b756f8a21939fadb2a0a93 (diff)
Send full instance to compute live_migration.
Remove the instance_id parameter and send a full instance to live_migration in the compute manager. This cuts down on database access required by the compute manager. Part of blueprint no-db-messaging. Change-Id: Ic21f061702704ddeaa6925aac4ecad69b0e8de18
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py8
-rw-r--r--nova/tests/compute/test_rpcapi.py5
-rw-r--r--nova/tests/scheduler/test_scheduler.py14
3 files changed, 16 insertions, 11 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 8561d5124..5c6bc00d4 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1663,7 +1663,7 @@ class ComputeTestCase(BaseTestCase):
self.mox.StubOutWithMock(self.compute.compute_rpcapi,
'pre_live_migration')
self.compute.compute_rpcapi.pre_live_migration(c,
- mox.IsA(instance_ref), True, None, instance['host']).AndRaise(
+ mox.IsA(instance), True, None, instance['host']).AndRaise(
rpc.common.RemoteError('', '', ''))
# mocks for rollback
@@ -1687,7 +1687,8 @@ class ComputeTestCase(BaseTestCase):
self.mox.ReplayAll()
self.assertRaises(rpc_common.RemoteError,
self.compute.live_migration,
- c, inst_id, instance['host'], True)
+ c, dest=instance['host'], block_migration=True,
+ instance=rpcinst)
# cleanup
for bdms in db.block_device_mapping_get_all_by_instance(
@@ -1719,7 +1720,8 @@ class ComputeTestCase(BaseTestCase):
# start test
self.mox.ReplayAll()
- ret = self.compute.live_migration(c, inst_id, instance['host'])
+ ret = self.compute.live_migration(c, dest=instance['host'],
+ instance=instance)
self.assertEqual(ret, None)
# cleanup
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index ef9064a39..cfd00d505 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -188,6 +188,11 @@ class ComputeRpcAPITestCase(test.TestCase):
self._test_compute_api('inject_network_info', 'cast',
instance=self.fake_instance, version='1.19')
+ def test_live_migration(self):
+ self._test_compute_api('live_migration', 'cast',
+ instance=self.fake_instance, dest='dest',
+ block_migration='blockity_block', host='tsoh', version='1.40')
+
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',
diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py
index 3950d1ef6..cfb6d862d 100644
--- a/nova/tests/scheduler/test_scheduler.py
+++ b/nova/tests/scheduler/test_scheduler.py
@@ -409,7 +409,7 @@ class SchedulerTestCase(test.TestCase):
self.mox.StubOutWithMock(self.driver.compute_rpcapi,
'check_can_live_migrate_destination')
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
- self.mox.StubOutWithMock(driver, 'cast_to_compute_host')
+ self.mox.StubOutWithMock(compute_rpcapi.ComputeAPI, 'live_migration')
self.mox.StubOutWithMock(notifications, 'send_update')
dest = 'fake_host2'
@@ -431,9 +431,8 @@ class SchedulerTestCase(test.TestCase):
notifications.send_update(self.context, instance, instance,
service="scheduler")
- driver.cast_to_compute_host(self.context, instance['host'],
- 'live_migration', update_db=False,
- instance_id=instance['id'], dest=dest,
+ compute_rpcapi.ComputeAPI.live_migration(self.context,
+ host=instance['host'], instance=instance, dest=dest,
block_migration=block_migration)
self.mox.ReplayAll()
@@ -451,7 +450,7 @@ class SchedulerTestCase(test.TestCase):
self.mox.StubOutWithMock(rpc, 'call')
self.mox.StubOutWithMock(rpc, 'cast')
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
- self.mox.StubOutWithMock(driver, 'cast_to_compute_host')
+ self.mox.StubOutWithMock(compute_rpcapi.ComputeAPI, 'live_migration')
dest = 'fake_host2'
block_migration = True
@@ -498,9 +497,8 @@ class SchedulerTestCase(test.TestCase):
{"task_state": task_states.MIGRATING}).AndReturn(
(instance, instance))
- driver.cast_to_compute_host(self.context, instance['host'],
- 'live_migration', update_db=False,
- instance_id=instance_id, dest=dest,
+ compute_rpcapi.ComputeAPI.live_migration(self.context,
+ host=instance['host'], instance=instance, dest=dest,
block_migration=block_migration)
self.mox.ReplayAll()