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

Merge branch 'feature-1020' of git.opennebula.org:one into feature-1020

This commit is contained in:
Ruben S.Montero 2011-12-24 00:35:52 +01:00
commit 598fd63ba8
2 changed files with 18 additions and 6 deletions

View File

@ -60,11 +60,16 @@ class VMwareDriver
# ------------------------------------------------------------------------ #
# Deploy & define a VM based on its description file #
# ------------------------------------------------------------------------ #
def deploy(dfile)
# Define the VM
deploy_id = define_domain(dfile)
def deploy(dfile, id)
# Define the domain if it is not already defined (e.g. from UNKNOWN)
exit -1 if deploy_id.nil?
if not domain_defined?(id)
deploy_id = define_domain(dfile)
exit -1 if deploy_id.nil?
else
deploy_id = "one-#{id}"
end
OpenNebula.log_debug("Successfully defined domain #{deploy_id}.")
@ -273,8 +278,14 @@ class VMwareDriver
end
}
deploy_id.strip!
deploy_id.strip!
return deploy_id
end
def domain_defined?(one_id)
rc, info = do_action("virsh -c #{@uri} dominfo one-#{one_id}")
return rc
end
end

View File

@ -31,8 +31,9 @@ require 'vmwarelib'
dfile = ARGV[0]
host = ARGV[1]
id = ARGV[3]
vmware_drv = VMwareDriver.new(host)
vmware_drv = VMwareDriver.new(host, id)
puts vmware_drv.deploy(dfile)