diff --git a/nova-powervc/powervc/nova/common/exception.py b/nova-powervc/powervc/nova/common/exception.py index 9f07128..1760089 100644 --- a/nova-powervc/powervc/nova/common/exception.py +++ b/nova-powervc/powervc/nova/common/exception.py @@ -10,6 +10,7 @@ class BlockMigrationException(exception.NovaException): message = _("PowerVC does not support block migration.") super(BlockMigrationException, self).__init__(message=message) + class LiveMigrationException(exception.NovaException): """User attempted to perform live migration with block migration.""" def __init__(self, uuid): diff --git a/nova-powervc/powervc/nova/driver/compute/manager.py b/nova-powervc/powervc/nova/driver/compute/manager.py index afc986f..0b64ab4 100644 --- a/nova-powervc/powervc/nova/driver/compute/manager.py +++ b/nova-powervc/powervc/nova/driver/compute/manager.py @@ -52,6 +52,7 @@ CONF = cfg.CONF # store the deleted powervc instance uuids deleted_pvc_ids = set() + class PowerVCCloudManager(manager.Manager): def __init__(self, compute_driver=None, *args, **kwargs): diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/service.py b/nova-powervc/powervc/nova/driver/virt/powervc/service.py index 4678fc3..aefd4e2 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -1206,12 +1206,12 @@ class PowerVCService(object): current_host != orig_host): LOG.info(_("Instance %s completed migration.") % pvc_server.id) raise loopingcall.LoopingCallDone(True) - if ((pvc_server.status == pvc_vm_states.ACTIVE or - pvc_server.status == pvc_vm_states.ERROR) and - pvc_task_state == None and current_host == orig_host): + if pvc_task_state is None and current_host == orig_host and\ + pvc_server.status in (pvc_vm_states.ACTIVE, + pvc_vm_states.ERROR): LOG.error('Instance %s failed to migrate to another host, ' 'please check with PowerVC console error message or ' - 'log file',pvc_server.id) + 'log file', pvc_server.id) raise LiveMigrationException(pvc_server.id) timer = loopingcall.FixedIntervalLoopingCall(_wait_for_live_migration)