From aa9ed53e5ccd6ee7b9af0ba5bb7b1d30ea3a3391 Mon Sep 17 00:00:00 2001 From: sergiojvg Date: Wed, 17 Apr 2019 05:08:42 -0500 Subject: [PATCH] F #2505: Fix detach disk with snapshots for vcenter (#3240) --- src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb | 2 +- src/vmm_mad/remotes/vcenter/detach_disk | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb index 07e638b9bb1..1e83a52b872 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb @@ -2023,7 +2023,7 @@ def destroy_disk(disk) detachable= !(one_vm["LCM_STATE"].to_i == 11 && !disk.managed?) detachable = detachable && disk.exists? - raise "Can not detach disk. Not supported on current configuration" unless detachable + return unless detachable detach_disk(disk) disk.destroy() diff --git a/src/vmm_mad/remotes/vcenter/detach_disk b/src/vmm_mad/remotes/vcenter/detach_disk index e0958f82456..3e9ff831b62 100755 --- a/src/vmm_mad/remotes/vcenter/detach_disk +++ b/src/vmm_mad/remotes/vcenter/detach_disk @@ -42,10 +42,6 @@ begin vm = VCenterDriver::VirtualMachine.new_without_id(vi_client, vm_ref) - if vm.has_snapshots? - raise 'vCenter doesn\'t allow to remove a virtual disk if it\'s part ' \ - 'of a snapshot of the virtual machine.' - end rescue StandardError => e message = "Detach DISK for VM #{vm_ref} on vCenter cluster " \ "#{vc_cluster_name} failed due to \"#{e.message}\"."