Skip to content

Commit

Permalink
fix: Try to convert ESX VM UUID after hw upgrade
Browse files Browse the repository at this point in the history
* Card ID: CCT-606
* It is only draft ATM, because I cannot test it
  • Loading branch information
jirihnidek committed Jul 31, 2024
1 parent 3fa273a commit ea1ddc5
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions virtwho/virt/esx/esx.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,24 @@ 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"]
# self.logger.debug("Extra config: %s", extra_config.OptionValue)
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
Expand Down Expand Up @@ -419,7 +432,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",
Expand Down

0 comments on commit ea1ddc5

Please sign in to comment.