1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-08 20:58:17 +03:00

Feature #2911: Fix deploy action for vcenter

This commit is contained in:
Tino Vazquez 2014-09-19 12:25:10 +02:00
parent bde46c78c0
commit 89eb429922
2 changed files with 9 additions and 7 deletions

View File

@ -34,10 +34,10 @@ host = ARGV[1]
id = ARGV[2]
begin
puts VCenterDriver::VCenterVm.deploy dfile
puts VCenterDriver::VCenterVm.deploy File.read(dfile)
exit 0
rescue Exception => e
STDERR.puts "Deploy of VM #{id} on host #{host} with #{dfile} failed \
due to #{e.message}"
STDERR.puts "Deploy of VM #{id} on host #{host} with #{dfile} failed " +
"due to \"#{e.message}\""
end

View File

@ -103,7 +103,7 @@ class VIClient
end
}
if @dc.nil? || @cluser.nil?
if @dc.nil? || @cluster.nil?
raise "Cannot find DataCenter or ClusterComputeResource for host."
end
end
@ -239,7 +239,7 @@ class VCenterHost < ::OpenNebula::Host
number = -1
number = name.split('-').last if (name =~ /^one-\d*$/)
vm = VCenterVm.new(v, @client)
vm = VCenterVm.new(@client, v)
vm.monitor
str_info << "\nVM = ["
@ -299,13 +299,15 @@ class VCenterVm
uuid = uuid.text
vmid = xml.root.elements["/VM/ID"].text
hid = xml.root.elements["//HISTORY_RECORDS/HISTORY/HID"]
raise "Cannot find host id in deployment file history." if hid.nil?
connection = VIClient.new(hid)
connection = VIClient.new(hid)
vc_template= connection.find_vm_template(uuid)
vc_template = connection.find_vm_template(uuid)
relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
:diskMoveType => :moveChildMostDiskBacking,