Skip to content

Commit

Permalink
Correct live_migration rpc call in test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maoy committed Aug 27, 2012
1 parent 5e012d8 commit 3c176c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nova/tests/scheduler/test_scheduler.py
Expand Up @@ -411,7 +411,8 @@ def test_live_migration_basic(self):
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'
Expand All @@ -433,8 +434,7 @@ def test_live_migration_basic(self):
(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={})

Expand All @@ -453,7 +453,8 @@ def test_live_migration_all_checks_pass(self):
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
Expand Down Expand Up @@ -500,7 +501,7 @@ def test_live_migration_all_checks_pass(self):
{"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={})

Expand Down

0 comments on commit 3c176c3

Please sign in to comment.