Skip to content

Commit 294b30b

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "vmware: Handle folder renames in rescue cmd"
2 parents c0c2888 + 472825a commit 294b30b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

nova/tests/unit/virt/vmwareapi/test_vmops.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def test_rescue(self, mock_get_ds_by_ref, mock_power_on, mock_reconfigure,
407407
backing = vmwareapi_fake.DataObject()
408408
backing.datastore = ds.ref
409409
device.backing = backing
410-
vmdk = vm_util.VmdkInfo('[fake] uuid/root.vmdk',
410+
vmdk = vm_util.VmdkInfo('[fake] test (uuid)/root.vmdk',
411411
'fake-adapter',
412412
'fake-disk',
413413
'fake-capacity',
@@ -428,7 +428,8 @@ def test_rescue(self, mock_get_ds_by_ref, mock_power_on, mock_reconfigure,
428428

429429
uuid = self._instance.image_ref
430430
cache_path = ds.build_path('vmware_base', uuid, uuid + '.vmdk')
431-
rescue_path = ds.build_path(self._uuid, uuid + '-rescue.vmdk')
431+
vm_folder = ds_obj.DatastorePath.parse(vmdk.path).dirname
432+
rescue_path = ds.build_path(vm_folder, uuid + '-rescue.vmdk')
432433

433434
mock_disk_copy.assert_called_once_with(self._session, dc_info.ref,
434435
cache_path, rescue_path)

nova/virt/vmwareapi/vmops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,8 @@ def rescue(self, context, instance, network_info, image_meta):
12251225
self._fetch_image_if_missing(context, vi)
12261226

12271227
# Get the rescue disk path
1228-
rescue_disk_path = datastore.build_path(instance.uuid,
1228+
vm_folder = ds_obj.DatastorePath.parse(vmdk.path).dirname
1229+
rescue_disk_path = datastore.build_path(vm_folder,
12291230
"%s-rescue.%s" % (image_info.image_id, image_info.file_type))
12301231

12311232
# Copy the cached image to the be the rescue disk. This will be used

0 commit comments

Comments
 (0)