VMware: Handle missing volume vmdk during detach
During storage vMotion (live migration of a virtual machine and its disk files from one datastore to another), the volume's vmdk may be moved to the instance's datastore folder. We handle this case during detach volume by catching FileNotFoundException raised by shadow VM relocate operation. The shadow VM relocate will be NOP if the source and the destination datastores are the same. In this case, the subsequent detach disk device from shadow VM will fail if the volume vmdk is missing. Handling this case by catching and ignoring FileNotFoundException raised by the detach operation. Change-Id: I33ad36b147f040364514d8097a1dfc363c50b0b7 Closes-Bug: #1704196 Co-Authored-By: vbala@vmware.com Co-Authored-By: mrstarke@gmail.com
This commit is contained in:
parent
247f9b8120
commit
fee8409208
|
@ -537,6 +537,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
|
||||
|
|
|
@ -490,8 +490,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,
|
||||
|
|
Loading…
Reference in New Issue