Optimize live_migrate_instance
https://github.com/openstack/python-novaclient/blob/ master/novaclient/v2/servers.py#L468 From nova api version 2.25(Mitaka release), the default value of block_migration is None which is mapped to 'auto'. So we can remove 'block_migration' from live_migrate_instance. Change-Id: I75a581d3146824b1146e2acf5a7fbe4f8368a4e8
This commit is contained in:
@@ -112,18 +112,9 @@ class Migrate(base.BaseAction):
|
||||
result = nova.live_migrate_instance(instance_id=self.instance_uuid,
|
||||
dest_hostname=destination)
|
||||
except nova_helper.nvexceptions.ClientException as e:
|
||||
if e.code == 400:
|
||||
LOG.debug("Live migration of instance %s failed. "
|
||||
"Trying to live migrate using block migration."
|
||||
% self.instance_uuid)
|
||||
result = nova.live_migrate_instance(
|
||||
instance_id=self.instance_uuid,
|
||||
dest_hostname=destination,
|
||||
block_migration=True)
|
||||
else:
|
||||
LOG.debug("Nova client exception occurred while live "
|
||||
"migrating instance %s.Exception: %s" %
|
||||
(self.instance_uuid, e))
|
||||
LOG.debug("Nova client exception occurred while live "
|
||||
"migrating instance %s.Exception: %s" %
|
||||
(self.instance_uuid, e))
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
LOG.critical("Unexpected error occurred. Migration failed for "
|
||||
|
||||
Reference in New Issue
Block a user