1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

F #4913: Fix esx hostname not sent in monitor info

This commit is contained in:
mcabrerizo 2017-04-10 17:41:15 +02:00
parent 2bd38bafa3
commit 8c30c1f7da
2 changed files with 13 additions and 7 deletions

View File

@ -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}"

View File

@ -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