With the introduction of the hwuuid element it is possible to pass a separate
hardware UUID from the domain UUID for use by the guest.

In the case where the hwuuid element is present, it is the hardware UUID that
is visible to the guest and not the domain UUID so adjust the check in
virDomainDefCheckABIStabilityFlags() accordingly.

Signed-off-by: Mark Cave-Ayland <[email protected]>
---
 src/conf/domain_conf.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 281846dfbe..de0181f62b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -22226,15 +22226,28 @@ virDomainDefCheckABIStabilityFlags(virDomainDef *src,
         goto error;
     }
 
-    if (memcmp(src->uuid, dst->uuid, VIR_UUID_BUFLEN) != 0) {
-        char uuidsrc[VIR_UUID_STRING_BUFLEN];
-        char uuiddst[VIR_UUID_STRING_BUFLEN];
-        virUUIDFormat(src->uuid, uuidsrc);
-        virUUIDFormat(dst->uuid, uuiddst);
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain uuid %1$s does not match source %2$s"),
-                       uuiddst, uuidsrc);
-        goto error;
+    if (virUUIDIsValid(src->hw_uuid) && virUUIDIsValid(dst->hw_uuid)) {
+        if (memcmp(src->hw_uuid, dst->hw_uuid, VIR_UUID_BUFLEN) != 0) {
+            char uuidsrc[VIR_UUID_STRING_BUFLEN];
+            char uuiddst[VIR_UUID_STRING_BUFLEN];
+            virUUIDFormat(src->hw_uuid, uuidsrc);
+            virUUIDFormat(dst->hw_uuid, uuiddst);
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Target domain hwuuid %1$s does not match source 
%2$s"),
+                           uuiddst, uuidsrc);
+            goto error;
+        }
+    } else {
+        if (memcmp(src->uuid, dst->uuid, VIR_UUID_BUFLEN) != 0) {
+            char uuidsrc[VIR_UUID_STRING_BUFLEN];
+            char uuiddst[VIR_UUID_STRING_BUFLEN];
+            virUUIDFormat(src->uuid, uuidsrc);
+            virUUIDFormat(dst->uuid, uuiddst);
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Target domain uuid %1$s does not match source 
%2$s"),
+                           uuiddst, uuidsrc);
+            goto error;
+        }
     }
 
     if (src->genidRequested != dst->genidRequested) {
-- 
2.43.0

Reply via email to