Skip to content

Commit

Permalink
F #2505: Fix detach disk with snapshots for vcenter (#3240)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiojvg authored and Tino Vázquez committed Apr 17, 2019
1 parent 186d1f2 commit aa9ed53
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions src/vmm_mad/remotes/vcenter/detach_disk
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"."
Expand Down

0 comments on commit aa9ed53

Please sign in to comment.