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

Feature #2911: Polising refactor

This commit is contained in:
Tino Vazquez 2014-09-19 11:28:35 +02:00
parent 2f3551ebb9
commit 880dac1401
3 changed files with 16 additions and 12 deletions

View File

@ -34,13 +34,14 @@ if !host_id
exit -1
end
vcenter_host = VCenterDriver::VCenterHost.new(host_id)
vi_client = VCenterDriver::VIClient.new host_id
vcenter_host = VCenterDriver::VCenterHost.new vi_client
cluster_info = vcenter_host.monitor_cluster
cluster_info << vcenter_host.monitor_host_systems
vm_monitor_info = vcenter_host.monitor_vms
cluster_info << "\nVM_POLL=YES"
cluster_info << "#{vm_monitor_info}" if !vm_monitor_info.empty?

View File

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

View File

@ -114,8 +114,10 @@ class VIClient
next if ccrs.nil?
@cluster = ccrs.find{ |ccr|
@host.name == ccr.name
@one_host.name == ccr.name
}
break if @cluster
}
return @cluster
@ -263,7 +265,7 @@ class VCenterVm
# Creates a new VIVm using a RbVmomi::VirtualMachine object
# @param vm_vi [RbVmomi::VirtualMachine] it will be used if not nil
########################################################################
def initialize(vm_vi, client)
def initialize(client, vm_vi )
@vm = vm_vi
@client = client
@ -274,7 +276,7 @@ class VCenterVm
@net_tx = 0
end
def self.deploy(host, xml_text, vmid)
def self.deploy(xml_text)
xml = REXML::Document.new xml_text