Merge "vmware: Handle folder renames in rescue cmd"

This commit is contained in:
Zuul 2021-05-01 18:31:08 +00:00 committed by Gerrit Code Review
commit 294b30b281
2 changed files with 5 additions and 3 deletions

View File

@ -407,7 +407,7 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
backing = vmwareapi_fake.DataObject() backing = vmwareapi_fake.DataObject()
backing.datastore = ds.ref backing.datastore = ds.ref
device.backing = backing device.backing = backing
vmdk = vm_util.VmdkInfo('[fake] uuid/root.vmdk', vmdk = vm_util.VmdkInfo('[fake] test (uuid)/root.vmdk',
'fake-adapter', 'fake-adapter',
'fake-disk', 'fake-disk',
'fake-capacity', 'fake-capacity',
@ -428,7 +428,8 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
uuid = self._instance.image_ref uuid = self._instance.image_ref
cache_path = ds.build_path('vmware_base', uuid, uuid + '.vmdk') cache_path = ds.build_path('vmware_base', uuid, uuid + '.vmdk')
rescue_path = ds.build_path(self._uuid, uuid + '-rescue.vmdk') vm_folder = ds_obj.DatastorePath.parse(vmdk.path).dirname
rescue_path = ds.build_path(vm_folder, uuid + '-rescue.vmdk')
mock_disk_copy.assert_called_once_with(self._session, dc_info.ref, mock_disk_copy.assert_called_once_with(self._session, dc_info.ref,
cache_path, rescue_path) cache_path, rescue_path)

View File

@ -1225,7 +1225,8 @@ class VMwareVMOps(object):
self._fetch_image_if_missing(context, vi) self._fetch_image_if_missing(context, vi)
# Get the rescue disk path # Get the rescue disk path
rescue_disk_path = datastore.build_path(instance.uuid, vm_folder = ds_obj.DatastorePath.parse(vmdk.path).dirname
rescue_disk_path = datastore.build_path(vm_folder,
"%s-rescue.%s" % (image_info.image_id, image_info.file_type)) "%s-rescue.%s" % (image_info.image_id, image_info.file_type))
# Copy the cached image to the be the rescue disk. This will be used # Copy the cached image to the be the rescue disk. This will be used