From 290659edee6e6f2d0e0d99a3058747b5e02ce7b9 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 26 Sep 2012 22:48:17 +0000 Subject: 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 --- nova/virt/xenapi/vmops.py | 12 ++++++------ 1 file 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) and sequence-numbered # VHDs to figure out how to reconstruct the VDI chain after syncing -- cgit