From 3c176c3ffaef6fea32d9a8a6e271d2656bf47075 Mon Sep 17 00:00:00 2001 From: Yun Mao Date: Sat, 25 Aug 2012 10:34:58 -0400 Subject: Correct live_migration rpc call in test self.driver.compute_rpcapi.live_migration should be the correct way to issue live_migration call instead of compute_rpcapi.ComputeAPI.live_migration, because the ComputeAPI is a class, not an instance of the class. This technically does not matter because the method is moxed out anyway for testing, but still it is confusing. Partially fix bug 1037183 Change-Id: Id41520a44fb9cfc19e269427ee42493e5dc52f5b --- nova/tests/scheduler/test_scheduler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index bbb63ab51..c94b4a615 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -411,7 +411,8 @@ 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(compute_rpcapi.ComputeAPI, 'live_migration') + self.mox.StubOutWithMock(self.driver.compute_rpcapi, + 'live_migration') self.mox.StubOutWithMock(notifications, 'send_update') dest = 'fake_host2' @@ -433,8 +434,7 @@ class SchedulerTestCase(test.TestCase): (instance, instance)) notifications.send_update(self.context, instance, instance, service="scheduler") - - compute_rpcapi.ComputeAPI.live_migration(self.context, + self.driver.compute_rpcapi.live_migration(self.context, host=instance['host'], instance=instance, dest=dest, block_migration=block_migration, migrate_data={}) @@ -453,7 +453,8 @@ 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(compute_rpcapi.ComputeAPI, 'live_migration') + self.mox.StubOutWithMock(self.driver.compute_rpcapi, + 'live_migration') dest = 'fake_host2' block_migration = True @@ -500,7 +501,7 @@ class SchedulerTestCase(test.TestCase): {"task_state": task_states.MIGRATING}).AndReturn( (instance, instance)) - compute_rpcapi.ComputeAPI.live_migration(self.context, + self.driver.compute_rpcapi.live_migration(self.context, host=instance['host'], instance=instance, dest=dest, block_migration=block_migration, migrate_data={}) -- cgit