Merge "VMware: Handle missing volume vmdk during detach"
This commit is contained in:
@@ -538,6 +538,8 @@ class VMwareVolumeOpsTestCase(test.NoDBTestCase):
|
||||
rp = mock.sentinel.rp
|
||||
get_res_pool_of_host.return_value = rp
|
||||
|
||||
detach_disk_from_vm.side_effect = [
|
||||
oslo_vmw_exceptions.FileNotFoundException]
|
||||
instance = self._instance
|
||||
volume_ref = mock.sentinel.volume_ref
|
||||
vm_ref = mock.sentinel.vm_ref
|
||||
|
||||
@@ -491,8 +491,12 @@ class VMwareVolumeOps(object):
|
||||
# Volume's backing is relocated now; detach the old vmdk if not done
|
||||
# already.
|
||||
if not detached:
|
||||
self.detach_disk_from_vm(volume_ref, instance, original_device,
|
||||
destroy_disk=True)
|
||||
try:
|
||||
self.detach_disk_from_vm(volume_ref, instance,
|
||||
original_device, destroy_disk=True)
|
||||
except oslo_vmw_exceptions.FileNotFoundException:
|
||||
LOG.debug("Original volume backing %s is missing, no need "
|
||||
"to detach it", original_device.backing.fileName)
|
||||
|
||||
# Attach the current volume to the volume_ref
|
||||
self.attach_disk_to_vm(volume_ref, instance,
|
||||
|
||||
Reference in New Issue
Block a user