There is no need to set VM status to ERROR on a failed migration

VM state should not be set to ERROR, when the
migration failed beauce libvirt is unavailble on the destination.

Fixes bug #1233184
Change-Id: I36e4ed3842d7e33c1082ec95f860629eee23224e
This commit is contained in:
Vladik Romanovsky
2013-10-16 15:07:23 -04:00
parent aa480d75c7
commit 6df1b872cb
2 changed files with 12 additions and 18 deletions

View File

@@ -712,8 +712,8 @@ class ComputeTaskManager(base.Base):
filter_properties=filter_properties, node=node)
except Exception as ex:
with excutils.save_and_reraise_exception():
updates = {'vm_state': vm_states.ERROR,
'task_state': None}
updates = {'vm_state': instance['vm_state'],
'task_state': None}
self._set_vm_state_and_notify(context, 'migrate_server',
updates, ex, request_spec)
if reservations:
@@ -738,6 +738,7 @@ class ComputeTaskManager(base.Base):
exception.DestinationHypervisorTooOld,
exception.InvalidLocalStorage,
exception.InvalidSharedStorage,
exception.HypervisorUnavailable,
exception.MigrationPreCheckError) as ex:
with excutils.save_and_reraise_exception():
#TODO(johngarbutt) - eventually need instance actions here
@@ -751,14 +752,11 @@ class ComputeTaskManager(base.Base):
expected_task_state=task_states.MIGRATING,),
ex, request_spec, self.db)
except Exception as ex:
with excutils.save_and_reraise_exception():
request_spec = {'instance_properties': {
'uuid': instance['uuid'], },
}
scheduler_utils.set_vm_state_and_notify(context,
'compute_task', 'migrate_server',
{'vm_state': vm_states.ERROR},
ex, request_spec, self.db)
LOG.error(_('Migration of instance %(instance_id)s to host'
' %(dest)s unexpectedly failed.'),
{'instance_id': instance['uuid'], 'dest': destination},
exc_info=True)
raise exception.MigrationError(reason=ex)
def build_instances(self, context, instances, image, filter_properties,
admin_password, injected_files, requested_networks,