Skip to content

Commit

Permalink
Fixes usage of migrate_instance_start
Browse files Browse the repository at this point in the history
Because migrate_instance_start is used to remove floating ips on the source
compute node, we need send the RPC to the source compute node instead of
the dest compute node.

Fixes bug 1078207

Change-Id: Ie993548944268e1ab3af0b89e74e1b54d8137802
  • Loading branch information
wenjianhn committed Nov 13, 2012
1 parent f282a2c commit ca1282a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nova/network/api.py
Expand Up @@ -351,7 +351,7 @@ def migrate_instance_start(self, context, instance, migration):
if self._is_multi_host(context, instance):
args['floating_addresses'] = \
self._get_floating_ip_addresses(context, instance)
args['host'] = migration['dest_compute']
args['host'] = migration['source_compute']

self.network_rpcapi.migrate_instance_start(context, **args)

Expand Down
3 changes: 2 additions & 1 deletion nova/tests/network/test_api.py
Expand Up @@ -117,14 +117,14 @@ def fake_get_floaters(*args, **kwargs):
'project_id': 'fake_project_id',
'floating_addresses': None}
if multi_host:
expected['host'] = 'fake_compute_dest'
expected['floating_addresses'] = ['fake_float1', 'fake_float2']
return fake_instance, fake_migration, expected

def test_migrate_instance_start_with_multhost(self):
info = {'kwargs': {}}
arg1, arg2, expected = self._stub_migrate_instance_calls(
'migrate_instance_start', True, info)
expected['host'] = 'fake_compute_source'
self.network_api.migrate_instance_start(self.context, arg1, arg2)
self.assertEqual(info['kwargs'], expected)

Expand All @@ -139,6 +139,7 @@ def test_migrate_instance_finish_with_multhost(self):
info = {'kwargs': {}}
arg1, arg2, expected = self._stub_migrate_instance_calls(
'migrate_instance_finish', True, info)
expected['host'] = 'fake_compute_dest'
self.network_api.migrate_instance_finish(self.context, arg1, arg2)
self.assertEqual(info['kwargs'], expected)

Expand Down

0 comments on commit ca1282a

Please sign in to comment.