From 9bb9a77e41b009cb940e98feda666dd8d806c862 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 9 Feb 2014 23:51:50 -0800 Subject: [PATCH] VMware: fix instance rescue bug Commit I6448cb929e9afce814d0580eada91b8fd37befa3 added object support to the rescue operations. This exposed a bug in the VMware driver which was caught by the minesweeper. A rescue instance is named '-rescue'. In the past this name was updated on the instance, now it is passed as a parameter to the spawn method. Change-Id: I633614c6c634d41a32a9b1b70d941e9bfdcadedd Closes-bug: #1278149 --- nova/tests/virt/vmwareapi/test_driver_api.py | 2 +- nova/virt/vmwareapi/vmops.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/nova/tests/virt/vmwareapi/test_driver_api.py b/nova/tests/virt/vmwareapi/test_driver_api.py index fe866a4b1993..69b1a7e45901 100644 --- a/nova/tests/virt/vmwareapi/test_driver_api.py +++ b/nova/tests/virt/vmwareapi/test_driver_api.py @@ -402,7 +402,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase): """ self._create_vm() - inst_file_path = '[%s] %s/fake_name.vmdk' % (self.ds, self.uuid) + inst_file_path = '[%s] %s/%s.vmdk' % (self.ds, self.uuid, self.uuid) cache = ('[%s] vmware_base/fake_image_uuid/fake_image_uuid.vmdk' % self.ds) self.assertTrue(vmwareapi_fake.get_file(inst_file_path)) diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index a4b225202682..a50cb6740010 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -522,7 +522,7 @@ class VMwareVMOps(object): # the cache into the instance directory. If we are using # linked clone it is references from the cache directory dest_folder = instance['uuid'] - dest_name = instance['name'] + dest_name = instance_name dest_vmdk_name = "%s/%s.vmdk" % (dest_folder, dest_name) dest_vmdk_path = vm_util.build_datastore_path( @@ -1084,7 +1084,6 @@ class VMwareVMOps(object): self.power_off(instance) r_instance = copy.deepcopy(instance) - r_instance['name'] = r_instance['name'] + self._rescue_suffix instance_name = r_instance['uuid'] + self._rescue_suffix self.spawn(context, r_instance, image_meta, None, None, network_info, @@ -1123,7 +1122,6 @@ class VMwareVMOps(object): r_instance = copy.deepcopy(instance) instance_name = r_instance['uuid'] + self._rescue_suffix - r_instance['name'] = r_instance['name'] + self._rescue_suffix # detach the original instance disk from the rescue disk vm_rescue_ref = vm_util.get_vm_ref_from_name(self._session, instance_name)