Revision 8c30c1f7

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/host.rb
325 325
        host_id = one_host["ID"] if one_host
326 326

  
327 327

  
328
        # Extract CPU info for each esx host in cluster
329
        esx_host_cpu = {}
328
        # Extract CPU info and name for each esx host in cluster
329
        esx_hosts = {}
330 330
        @item.host.each do |esx_host|
331
            esx_host_cpu[esx_host._ref] = esx_host.summary.hardware.cpuMhz.to_f
331
            info = {}
332
            info[:name] = esx_host.name
333
            info[:cpu]  = esx_host.summary.hardware.cpuMhz.to_f
334
            esx_hosts[esx_host._ref] = info
332 335
        end
333 336

  
334 337
        @monitored_vms = Set.new
......
425 428
        vms.each do |vm_ref,info|
426 429
            begin
427 430
                vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, @vi_client)
431
                esx_host = esx_hosts[info["runtime.host"]._ref]
432
                info[:esx_host_name] = esx_host[:name]
433
                info[:esx_host_cpu] = esx_host[:cpu]
428 434
                info[:cluster_name] = cluster_name
429 435
                info[:cluster_ref] = cluster_ref
430 436
                info[:vc_uuid] = vc_uuid
......
465 471
                    vm.one_item if vm.get_vm_id
466 472
                end
467 473

  
468
                vm.monitor(esx_host_cpu,stats)
474
                vm.monitor(stats)
469 475

  
470 476
                vm_name = "#{info["name"]} - #{cluster_name}"
471 477

  
src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
2329 2329
    # monitoring
2330 2330
    ############################################################################
2331 2331

  
2332
    def monitor(esx_host_cpu, stats)
2332
    def monitor(stats)
2333 2333

  
2334 2334
        reset_monitor
2335 2335

  
......
2339 2339

  
2340 2340
        return if @state != VM_STATE[:active]
2341 2341

  
2342
        cpuMhz =  esx_host_cpu[@vm_info["runtime.host"]._ref]
2342
        cpuMhz =  @vm_info[:esx_host_cpu]
2343 2343

  
2344 2344
        @monitor[:used_memory] = @vm_info["summary.quickStats.hostMemoryUsage"].to_f * 1024
2345 2345

  
......
2440 2440
        diskrdiops  = @monitor[:diskrdiops]
2441 2441
        diskwriops  = @monitor[:diskwriops]
2442 2442

  
2443
        esx_host      = @vm_info["cluster_name"].to_s
2443
        esx_host      = @vm_info[:esx_host_name].to_s
2444 2444
        guest_state   = @vm_info["guest.guestState"].to_s
2445 2445
        vmware_tools  = @vm_info["guest.toolsRunningStatus"].to_s
2446 2446
        vmtools_ver   = @vm_info["guest.toolsVersion"].to_s

Also available in: Unified diff