diff options
| author | Hans Lindgren <hanlind@kth.se> | 2013-04-29 23:17:41 +0200 |
|---|---|---|
| committer | Hans Lindgren <hanlind@kth.se> | 2013-05-01 18:51:54 +0200 |
| commit | 9eb3dc7ed44d99652a17238724842e3067d46120 (patch) | |
| tree | 8085e6229863a874678bb03d0d32f7b661d3f1a7 /nova/virt | |
| parent | 3266bff670f6ab25ab8d850917898bf4ee2a705c (diff) | |
Reset migrating task state for MigrationError exceptions
Create an exception type for pre-check errors and add it to the list
of exceptions for which instance task state is reset to ACTIVE to
avoid cases where an instance get stuck in MIGRATING state.
Convert existing instances of raise MigrationError in scheduler and
driver pre-checks to have them raise the new MigrationPreCheckError
exception instead.
In addition, also make sure that expected exceptions are passed over
RPC silently.
Resolves bug 1171526.
Change-Id: I00fa0962e555f895dd98861684ec7767fed3b37b
Diffstat (limited to 'nova/virt')
| -rwxr-xr-x | nova/virt/libvirt/driver.py | 2 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index dc0af8539..c365c5fdd 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2968,7 +2968,7 @@ class LibvirtDriver(driver.ComputeDriver): "Disk of instance is too large(available" " on destination host:%(available)s " "< need:%(necessary)s)") - raise exception.MigrationError(reason=reason % locals()) + raise exception.MigrationPreCheckError(reason=reason % locals()) def _compare_cpu(self, cpu_info): """Checks the host cpu is compatible to a cpu given by xml. diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 48413ed7c..e7dd3cff0 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1625,7 +1625,7 @@ class VMOps(object): except KeyError: reason = _('Destination host:%(hostname)s must be in the same ' 'aggregate as the source server') - raise exception.MigrationError(reason=reason % locals()) + raise exception.MigrationPreCheckError(reason=reason % locals()) def _ensure_host_in_aggregate(self, context, hostname): self._get_host_uuid_from_aggregate(context, hostname) @@ -1644,7 +1644,8 @@ class VMOps(object): pifs = self._session.call_xenapi('PIF.get_all_records_where', expr) if len(pifs) != 1: - raise exception.MigrationError('No suitable network for migrate') + msg = _('No suitable network for migrate') + raise exception.MigrationPreCheckError(reason=msg) nwref = pifs[pifs.keys()[0]]['network'] try: @@ -1655,7 +1656,8 @@ class VMOps(object): options) except self._session.XenAPI.Failure as exc: LOG.exception(exc) - raise exception.MigrationError(_('Migrate Receive failed')) + msg = _('Migrate Receive failed') + raise exception.MigrationPreCheckError(reason=msg) return migrate_data def check_can_live_migrate_destination(self, ctxt, instance_ref, @@ -1703,8 +1705,8 @@ class VMOps(object): "VM.assert_can_migrate", vm_ref, migrate_data) except self._session.XenAPI.Failure as exc: LOG.exception(exc) - raise exception.MigrationError(_('VM.assert_can_migrate' - 'failed')) + msg = _('VM.assert_can_migrate failed') + raise exception.MigrationPreCheckError(reason=msg) return dest_check_data def _generate_vdi_map(self, destination_sr_ref, vm_ref): |
