Make compute rpcapi 'live_migration' backward compatible

This commit[1] added compute rpcapi version 4.2 which introduced a new
argument 'migration' when calling 'live_migration' method, but the code
did not ensure the backward compatibility with older version compute
node.

When calling 'live_migration' method with 'migration' argument on older
version(like Kilo) of nova compute node, a "TypeError: live_migration()
got an unexpected keyword argument 'migration'" will be threw up.

[1]2f4e64a7cf

Change-Id: Ie5c498d34e7c4c6573d611abd592c25f1bcb4f44
Closes-Bug: #1576048
(cherry picked from commit 34b8336a41)
This commit is contained in:
Wenzhi Yu 2016-04-28 16:06:57 +08:00
parent aeb3ccf2f3
commit 0942228fd6
2 changed files with 1 additions and 1 deletions

View File

@ -645,6 +645,7 @@ class ComputeAPI(object):
pre_migration_result=True)
if not self.client.can_send_version(version):
version = '4.0'
args.pop('migration')
cctxt = self.client.prepare(server=host, version=version)
cctxt.cast(ctxt, 'live_migration', instance=instance,
dest=dest, block_migration=block_migration,

View File

@ -620,7 +620,6 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
callargs={'instance': 'foo',
'dest': 'foo',
'block_migration': False,
'migration': None,
'migrate_data': {
'pre_live_migration_result': {}}},
callret=None,