lib/fog/vsphere/requests/compute/vm_destroy.rb in fog-maestrodev-1.7.0.20121114190951 vs lib/fog/vsphere/requests/compute/vm_destroy.rb in fog-maestrodev-1.8.0.20130109172219
- old
+ new
@@ -4,17 +4,10 @@
class Real
def vm_destroy(options = {})
raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid'
- # Find the VM Object
- search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
- vm_mob_ref = @connection.searchIndex.FindAllByUuid(search_filter).first
-
- unless vm_mob_ref.kind_of? RbVmomi::VIM::VirtualMachine
- raise Fog::Vsphere::Errors::NotFound,
- "Could not find VirtualMachine with instance uuid #{options['instance_uuid']}"
- end
+ vm_mob_ref = get_vm_ref(options['instance_uuid'])
task = vm_mob_ref.Destroy_Task
task.wait_for_completion
{ 'task_state' => task.info.state }
end