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 <mark.caveayland@nutanix.com>
---
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
On Fri, Sep 26, 2025 at 10:37:38 +0100, Mark Cave-Ayland wrote: > 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 <mark.caveayland@nutanix.com> > --- > 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)) { This would allow removing or adding hw_uuid. It must be present in both definitions or none of them. > + 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) { The hw UUID should be checked in addition to domain UUID. Libvirt uses domain UUID to identify domains internally and changing it is definitely not supported. So while it is not guest visible in this case, we have to make sure we don't replace domain XML with a new one with different UUID. Thus I would keep the check here unless we already check domain UUID before even doing ABI stability checks, of course. Jirka
© 2016 - 2025 Red Hat, Inc.