diff --git a/src/im_mad/remotes/lib/vcenter_cluster.rb b/src/im_mad/remotes/lib/vcenter_cluster.rb index add5ad2297..f9835b2937 100644 --- a/src/im_mad/remotes/lib/vcenter_cluster.rb +++ b/src/im_mad/remotes/lib/vcenter_cluster.rb @@ -637,7 +637,7 @@ class Cluster # 'ones' : VMs in OpenNebula #--------------------------------------------------------------------------- def vms_info(vm_type) - cmd = "#{File.dirname(__FILE__)}/vcenter_monitor_vms.rb #{@host.id} #{vm_type}" + cmd = "#{File.dirname(__FILE__)}/vcenter_monitor_vms.rb #{@host.id} #{vm_type} \"#{connection[:ccr]}\"" str_info, _stderr, _status = Open3.capture3(cmd) return str_info end diff --git a/src/im_mad/remotes/lib/vcenter_monitor_vms.rb b/src/im_mad/remotes/lib/vcenter_monitor_vms.rb index 482e33b9c6..e9d35da8f4 100755 --- a/src/im_mad/remotes/lib/vcenter_monitor_vms.rb +++ b/src/im_mad/remotes/lib/vcenter_monitor_vms.rb @@ -41,17 +41,18 @@ CONFIG = VCenterConf.new host_id = ARGV[0] vm_type = ARGV[1] +ccr = ARGV[2] begin vi_client = VCenterDriver::VIClient.new_from_host(host_id) - cluster = Cluster.new(host_id, vi_client) + cluster = VCenterDriver::ClusterComputeResource.new_from_ref(ccr, vi_client) - str_info , _ltime = cluster.monitor_vms(@host.id, vm_type) + str_info , _ltime = cluster.monitor_vms(host_id, vm_type) puts str_info rescue StandardError => e - message = "Monitoring of VM #{vm_id} on vCenter cluster #{cluster_name} " \ + message = "Monitoring of VMs on vCenter cluster #{host_id} " \ " failed due to \"#{e.message}\"." OpenNebula.log_error(message) if VCenterDriver::CONFIG[:debug_information]