Skip to content

Commit

Permalink
Be more selective when searching for virtual disks
Browse files Browse the repository at this point in the history
[#82580826]
  • Loading branch information
tylerschultz committed Dec 11, 2014
1 parent bcc9dec commit ed23c0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bosh_vsphere_cpi/lib/cloud/vsphere/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def detach_disk(vm_cid, disk_cid)
devices = @cloud_searcher.get_property(vm, Vim::VirtualMachine, 'config.hardware.device', ensure_all: true)
virtual_disk =
devices.find do |device|
device.kind_of?(Vim::Vm::Device::VirtualDisk) && device.backing.file_name.include?(disk_cid)
device.kind_of?(Vim::Vm::Device::VirtualDisk) && device.backing.file_name.end_with?("/#{disk_cid}.vmdk")
end
raise Bosh::Clouds::DiskNotAttached.new(true), "Disk (#{disk_cid}) is not attached to VM (#{vm_cid})" if virtual_disk.nil?

Expand All @@ -550,7 +550,7 @@ def detach_disk(vm_cid, disk_cid)
virtual_disk =
devices.find do |device|
device.kind_of?(Vim::Vm::Device::VirtualDisk) &&
device.backing.file_name.include?(disk_cid)
device.backing.file_name.end_with?("/#{disk_cid}.vmdk")
end
break if virtual_disk.nil?
sleep(1.0)
Expand Down

0 comments on commit ed23c0d

Please sign in to comment.