From 02aa2bc15cdf2261a4543d0f14aac491925cb37b Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Wed, 31 Jul 2024 17:20:09 +0200 Subject: [PATCH] fix: Try to convert ESX VM UUID after hw upgrade * Card ID: CCT-606 * It is only draft ATM, because I cannot test it --- virtwho/virt/esx/esx.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/virtwho/virt/esx/esx.py b/virtwho/virt/esx/esx.py index 7164a07a..ab53899b 100644 --- a/virtwho/virt/esx/esx.py +++ b/virtwho/virt/esx/esx.py @@ -326,11 +326,23 @@ def getVmUuid(self, vm): From: 78563412-AB90-EFCD-1234-567890ABCDEF To: 12345678-90AB-CDEF-1234-567890ABCDEF """ + smbios_version_27 = None s = vm['config.uuid'] + + # Try to some crazy heuristics + if "config.extraConfig" in vm: + extra_config = vm["config.extraConfig"] + for item in extra_config.OptionValue: + if item.key == "acpi.smbiosVersion2.7": + if item.value == "TRUE": + smbios_version_27 = True + elif item.value == "FALSE": + smbios_version_27 = False + if 'config.version' not in vm: return s version = int(vm['config.version'].split('-')[1]) - if (version >= 13): + if version >= 13 or smbios_version_27 is False: return s[6:8] + s[4:6] + s[2:4] + s[0:2] + "-" + s[11:13] + s[9:11] + "-" + s[16:18] + s[14:16] + s[18:] else: return s @@ -419,7 +431,14 @@ def createFilter(self): pfs = self.propertyFilterSpec() pfs.objectSet = [oSpec] pfs.propSet = [ - self.createPropertySpec("VirtualMachine", ["config.uuid", "config.version", "runtime.powerState"]), + self.createPropertySpec("VirtualMachine", + [ + "config.uuid", + "config.version", + "runtime.powerState", + "config.extraConfig" + ] + ), self.createPropertySpec("ClusterComputeResource", ["name"]), self.createPropertySpec("HostSystem", ["name", "vm",