# File lib/fog/vsphere/requests/compute/get_virtual_machine.rb, line 11 def get_vm_ref(id, dc = nil) vm = case id # UUID based when /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/ @connection.searchIndex.FindByUuid :uuid => id, :vmSearch => true, :instanceUuid => true, :datacenter => dc else # try to find based on VM name if dc get_raw_datacenter(dc).find_vm(id) else raw_datacenters.map { |d| d.find_vm(id) }.compact.first end end vm ? vm : raise(Fog::Compute::Vsphere::NotFound, "#{id} was not found") end