mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
Add VM poll action
This commit is contained in:
1 parent
d8463f14d7
commit
74d473798f
1 file changed
+16
-10
@@ -28,17 +28,23 @@ end
|
||||
$: << RUBY_LIB_LOCATION
|
||||
$: << File.dirname(__FILE__)
|
||||
|
||||
require 'vcenter_driver'
|
||||
require 'vcenter_driver2'
|
||||
|
||||
deploy_id = ARGV[0]
|
||||
host = ARGV[1]
|
||||
vm_ref = ARGV[0]
|
||||
vc_cluster_name = ARGV[1]
|
||||
|
||||
host_id = VCenterDriver::VIClient.translate_hostname(host)
|
||||
vi_client = VCenterDriver::VIClient.new host_id
|
||||
host = VCenterDriver::VCenterHost.new vi_client
|
||||
vm = vi_client.find_vm_template(deploy_id)
|
||||
vm = VCenterDriver::VCenterVm.new(vi_client, vm)
|
||||
begin
|
||||
|
||||
vm.monitor(host)
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
|
||||
puts vm.info
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vi_client, vm_ref)
|
||||
|
||||
vm.monitor
|
||||
|
||||
puts vm.info
|
||||
|
||||
rescue Exception => e
|
||||
STDERR.puts "Cannot poll info for VM #{vm_ref} on vCenter cluster "\
|
||||
"#{vc_cluster_name} failed due to \"#{e.message}\""
|
||||
exit(-1)
|
||||
end
|
||||
Reference in new issue
Block a user