1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #2398: If vCenter present, undefine VMs thorugh it to aovid orphaned VMs

This commit is contained in:
Tino Vazquez 2013-10-24 11:48:10 +02:00
parent ea95505ebf
commit f7f7b5c2fa

View File

@ -353,7 +353,20 @@ class VMwareDriver
# Undefines a domain in the ESX hypervisor
def undefine_domain(id)
rc, info = do_action("virsh -c #{@uri} undefine #{id}")
if @vcenter and !@vcenter.empty? and @datacenter and !@datacenter.empty?
undefine_uri =
"vpx://#{@vcenter}/#{@datacenter}/#{@host}/?no_verify=1"
else
undefine_uri = @uri
end
rc = false
30.times do
rc, info = do_action("virsh -c #{@undefine_uri} undefine #{id}")
break if rc
sleep 1
end
if rc == false
OpenNebula.log_error("Error undefining domain #{id}")