On Fri, May 15, 2026 at 10:14:53AM +0200, Peter Krempa wrote:
On Fri, May 15, 2026 at 09:52:01 +0200, Martin Kletzander via Devel wrote:
From: Martin Kletzander <[email protected]>

The difference is that the usual UUID is supposed to be unique per host
and instanceUuid should be unique across the whole cluster.  One could
think of them as HUID and CUID (as the first "U" does apparently mean
something else in the Broadcom world).  That _would_ be fine for our
scenario.  However, that piece of information turns out to be false as
well and the UUID we were using (`config.uuid`, or in VMX the
`uuid.bios`) can be the same in two machines on the same host.

Fortunately the `FindByUuid()` function can also search for VMs based on
their `instanceUuid`, dictated by the so far omitted third parameter.
Unfortunately that parameter is not parsed (or at least properly) before
vSphere API 4.0 (the documentation says 2.0, but we are not using that
namespace and 4.0 is the lowest we can target), which we are not
specifying in the server returns a 500 HTTP error if we use the
`instanceUuid` parameter.

So this patch adds the `SOAPAction: urn:vim25/4.0` header to the cURL
requests which makes that `FindByUuid()` function work even with the
`instanceUuid` set, but without any extra labor.

After that this patch also changes all UUIDs to be parsed from the
`config.instanceUuid` (or `vc.uuid` in the VMX, but there's a fallback
to the old `uuid.bios`) and adjusts tests accordingly.

To give users (and management applications) the possibility to revert
back to the previous (legacy) behaviour a new URI query parameter is
introduced, called `legacy_uuid` which, if set to `1`, still keeps the
code working as it did before this patch.

Last, but not least it changes the parameter to aforementioned function
to be true (unless the legacy behaviour is requested, of course) and
henceforth all searching ought to be done with the more unique ID.

Resolves: https://redhat.atlassian.net/browse/RHEL-174300
Signed-off-by: Martin Kletzander <[email protected]>
---
 docs/drvesx.rst                          |  9 +++++
 src/esx/esx_driver.c                     | 43 ++++++++++++++++--------
 src/esx/esx_util.c                       | 11 ++++++
 src/esx/esx_util.h                       |  1 +
 src/esx/esx_vi.c                         | 32 +++++++++++++++---
 src/esx/esx_vi.h                         |  3 ++
 src/vmx/vmx.c                            | 12 +++++--
 tests/vmx2xmldata/esx-in-the-wild-10.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-11.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-12.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-13.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-14.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-15.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-16.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-17.xml |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-5.xml  |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-6.xml  |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-7.xml  |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-8.xml  |  2 +-
 tests/vmx2xmldata/esx-in-the-wild-9.xml  |  2 +-
 20 files changed, 104 insertions(+), 33 deletions(-)

diff --git a/docs/drvesx.rst b/docs/drvesx.rst
index 84416562ba3f..0fd9c865fbf2 100644
--- a/docs/drvesx.rst
+++ b/docs/drvesx.rst
@@ -156,6 +156,15 @@ The driver understands the extra parameters shown below.
 |                 |                             | ``no_verify`` is set        |
 |                 |                             | to ``1``.                   |
 +-----------------+-----------------------------+-----------------------------+
+| ``legacy_uuid`` | ``0`` or ``1``              | If set to ``1``, the driver |
+|                 |                             | will track VMs based on     |
+|                 |                             | their "Host-unique" UUID.   |
+|                 |                             | If set to ``0`` it will use |
+|                 |                             | the "Cluster-unique" UUID   |
+|                 |                             | instead. The default value  |
+|                 |                             | is ``0``.                   |
+|                 |                             | :since:`Since 12.4.0`.      |
++-----------------+-----------------------------+-----------------------------+

IMO you should also add a paragraph outlining this change and pointing
to this parameter into drvesx.rst document at least in the extent of
what you wrote to NEWS.rst.

The entry in the table doesn't IMO seem to convey the implications of
the parameter.


The most complicated thing was how to think of what and how to write it.
I took a stab at it and since this version is missing the changes in the
tests I had to go with an embarrassing v4...

Thanks for the review.

Attachment: signature.asc
Description: PGP signature

Reply via email to