From e4d3d56377317eefa7fae0de488d2be1ec6c2858 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Mon, 29 Jan 2018 11:13:48 -0500 Subject: [PATCH] Add VM UUID to event payload When a VM is disconnected the VM's UUID is the only property which can be used to link the VM to other entities e.g. events. https://bugzilla.redhat.com/show_bug.cgi?id=1538996 --- lib/VMwareWebService/MiqVimEventMonitor.rb | 3 +++ lib/VMwareWebService/VimPropMaps.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/VMwareWebService/MiqVimEventMonitor.rb b/lib/VMwareWebService/MiqVimEventMonitor.rb index 3f19619..f9c1295 100644 --- a/lib/VMwareWebService/MiqVimEventMonitor.rb +++ b/lib/VMwareWebService/MiqVimEventMonitor.rb @@ -120,7 +120,10 @@ def fixupEvent(event) next unless (eventVmObj = event[vmStr]) addVirtualMachine(eventVmObj['vm']) if ADD_VM_EVENTS.include?(event['eventType']) next unless (vmObj = virtualMachinesByMor_locked[eventVmObj['vm']]) + eventVmObj['path'] = vmObj['summary']['config']['vmPathName'] + eventVmObj['uuid'] = vmObj['summary']['config']['uuid'] + removeVirtualMachine(eventVmObj['vm']) if event['eventType'] == 'VmRemovedEvent' end end diff --git a/lib/VMwareWebService/VimPropMaps.rb b/lib/VMwareWebService/VimPropMaps.rb index eae1983..8c060e9 100644 --- a/lib/VMwareWebService/VimPropMaps.rb +++ b/lib/VMwareWebService/VimPropMaps.rb @@ -551,6 +551,7 @@ module VimPropMaps :baseName => "@virtualMachines", :keyPath => ['summary', 'config', 'vmPathName'], :props => [ + "summary.config.uuid", "summary.config.vmPathName", "summary.runtime.host" ]