diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b3b8c543d5..3dc638f0de 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28336,17 +28336,29 @@ virDomainDefFormatFeatures(virBufferPtr buf, return virXMLFormatElement(buf, "features", NULL, &childBuf); } - -/* This internal version appends to an existing buffer - * (possibly with auto-indent), rather than flattening - * to string. - * Return -1 on failure. */ int virDomainDefFormatInternal(virDomainDefPtr def, virCapsPtr caps, unsigned int flags, virBufferPtr buf, virDomainXMLOptionPtr xmlopt) +{ + return virDomainDefFormatInternalSetRootName(def, caps, flags, buf, + xmlopt, "domain"); +} + + +/* This internal version appends to an existing buffer + * (possibly with auto-indent), rather than flattening + * to string. + * Return -1 on failure. */ +int +virDomainDefFormatInternalSetRootName(virDomainDefPtr def, + virCapsPtr caps, + unsigned int flags, + virBufferPtr buf, + virDomainXMLOptionPtr xmlopt, + const char *rootname) { unsigned char *uuid; char uuidstr[VIR_UUID_STRING_BUFLEN]; @@ -28371,7 +28383,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, if (def->id == -1) flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE; - virBufferAsprintf(buf, "id); if (def->namespaceData && def->ns.format) @@ -28853,7 +28865,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, virDomainSEVDefFormat(buf, def->sev); virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virBufferAsprintf(buf, "\n", rootname); if (virBufferCheckError(buf) < 0) goto error; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index af80c2b7ab..82631ecb07 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3080,6 +3080,12 @@ int virDomainDefFormatInternal(virDomainDefPtr def, unsigned int flags, virBufferPtr buf, virDomainXMLOptionPtr xmlopt); +int virDomainDefFormatInternalSetRootName(virDomainDefPtr def, + virCapsPtr caps, + unsigned int flags, + virBufferPtr buf, + virDomainXMLOptionPtr xmlopt, + const char *rootname); int virDomainDiskSourceFormat(virBufferPtr buf, virStorageSourcePtr src,