diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-09-26 22:48:17 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-09-26 22:48:17 +0000 |
| commit | 290659edee6e6f2d0e0d99a3058747b5e02ce7b9 (patch) | |
| tree | 7992dcbe0ac1c0b3a5476d33cce2a416575b2e04 | |
| parent | 02facfb9d482ea541eb6f180ca0e17160b9ecc6d (diff) | |
xenapi: make it easier to recover from failed migrations
If a migration/resize fails, the source VM may or may not have it's name
changed in xapi. This makes recovering from a failed migration more
difficult than it needs to be. Moving the rename to be done first
ensures that it always be renamed.
Change-Id: I9296aa67af01d4a832bc63bcb9b71ee20b1221cc
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 52cb9b17b..3f14b98b9 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -738,6 +738,12 @@ class VMOps(object): step=0, total_steps=RESIZE_TOTAL_STEPS) + # NOTE(sirp): in case we're resizing to the same host (for dev + # purposes), apply a suffix to name-label so the two VM records + # extant until a confirm_resize don't collide. + name_label = self._get_orig_vm_name_label(instance) + vm_utils.set_vm_name_label(self._session, vm_ref, name_label) + if resize_down: self._migrate_disk_resizing_down( context, instance, dest, instance_type, vm_ref, sr_path) @@ -745,12 +751,6 @@ class VMOps(object): self._migrate_disk_resizing_up( context, instance, dest, vm_ref, sr_path) - # NOTE(sirp): in case we're resizing to the same host (for dev - # purposes), apply a suffix to name-label so the two VM records - # extant until a confirm_resize don't collide. - name_label = self._get_orig_vm_name_label(instance) - vm_utils.set_vm_name_label(self._session, vm_ref, name_label) - # NOTE(sirp): disk_info isn't used by the xenapi driver, instead it # uses a staging-area (/images/instance<uuid>) and sequence-numbered # VHDs to figure out how to reconstruct the VDI chain after syncing |
