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
'<instance-uuid>-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
This commit is contained in:
Gary Kotton 2014-02-09 23:51:50 -08:00
parent 29d390b895
commit 9bb9a77e41
2 changed files with 2 additions and 4 deletions

View File

@ -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))

View File

@ -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)