diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/host.rb b/src/vmm_mad/remotes/lib/vcenter_driver/host.rb index e526b11e25..ed86f10941 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/host.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/host.rb @@ -325,10 +325,13 @@ class ClusterComputeResource host_id = one_host["ID"] if one_host - # Extract CPU info for each esx host in cluster - esx_host_cpu = {} + # Extract CPU info and name for each esx host in cluster + esx_hosts = {} @item.host.each do |esx_host| - esx_host_cpu[esx_host._ref] = esx_host.summary.hardware.cpuMhz.to_f + info = {} + info[:name] = esx_host.name + info[:cpu] = esx_host.summary.hardware.cpuMhz.to_f + esx_hosts[esx_host._ref] = info end @monitored_vms = Set.new @@ -425,6 +428,9 @@ class ClusterComputeResource vms.each do |vm_ref,info| begin vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, @vi_client) + esx_host = esx_hosts[info["runtime.host"]._ref] + info[:esx_host_name] = esx_host[:name] + info[:esx_host_cpu] = esx_host[:cpu] info[:cluster_name] = cluster_name info[:cluster_ref] = cluster_ref info[:vc_uuid] = vc_uuid @@ -465,7 +471,7 @@ class ClusterComputeResource vm.one_item if vm.get_vm_id end - vm.monitor(esx_host_cpu,stats) + vm.monitor(stats) vm_name = "#{info["name"]} - #{cluster_name}" diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb index 5e0ba30726..50209070b4 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb @@ -2329,7 +2329,7 @@ class VirtualMachine < Template # monitoring ############################################################################ - def monitor(esx_host_cpu, stats) + def monitor(stats) reset_monitor @@ -2339,7 +2339,7 @@ class VirtualMachine < Template return if @state != VM_STATE[:active] - cpuMhz = esx_host_cpu[@vm_info["runtime.host"]._ref] + cpuMhz = @vm_info[:esx_host_cpu] @monitor[:used_memory] = @vm_info["summary.quickStats.hostMemoryUsage"].to_f * 1024 @@ -2440,7 +2440,7 @@ class VirtualMachine < Template diskrdiops = @monitor[:diskrdiops] diskwriops = @monitor[:diskwriops] - esx_host = @vm_info["cluster_name"].to_s + esx_host = @vm_info[:esx_host_name].to_s guest_state = @vm_info["guest.guestState"].to_s vmware_tools = @vm_info["guest.toolsRunningStatus"].to_s vmtools_ver = @vm_info["guest.toolsVersion"].to_s