Fixes usage of migrate_instance_start

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
This commit is contained in:
Jian Wen 2012-11-13 17:02:36 +08:00
parent f282a2c31f
commit ca1282ad7c
2 changed files with 3 additions and 2 deletions

View File

@ -351,7 +351,7 @@ class API(base.Base):
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)

View File

@ -117,7 +117,6 @@ class ApiTestCase(test.TestCase):
'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
@ -125,6 +124,7 @@ class ApiTestCase(test.TestCase):
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)
@ -139,6 +139,7 @@ class ApiTestCase(test.TestCase):
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)