From 1f6a7d47b0a774250ace2bcb90260ee63e426c4c Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Mon, 9 Sep 2013 12:13:10 +0200 Subject: [PATCH] feature #2135: skip VMware cancel when VM is not defined --- src/vmm_mad/remotes/vmware/vmware_driver.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb index c0660598d3..c8536d7315 100644 --- a/src/vmm_mad/remotes/vmware/vmware_driver.rb +++ b/src/vmm_mad/remotes/vmware/vmware_driver.rb @@ -109,12 +109,16 @@ class VMwareDriver # Cancels & undefine the VM # # ------------------------------------------------------------------------ # def cancel(deploy_id) - # Destroy the VM - rc, info = do_action("virsh -c #{@uri} destroy #{deploy_id}") + rc, info = do_action("virsh -c #{@uri} --readonly dominfo #{deploy_id}") - exit info if rc == false + if rc + # Destroy the VM + rc, info = do_action("virsh -c #{@uri} destroy #{deploy_id}") - OpenNebula.log_debug("Successfully canceled domain #{deploy_id}.") + exit info if rc == false + + OpenNebula.log_debug("Successfully canceled domain #{deploy_id}.") + end # Undefine the VM undefine_domain(deploy_id)