diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index e115165ad2..aa7bb8da14 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3135,6 +3135,12 @@ paravirtualized driver is specified via the ``disk`` element. disk transient prevents the domain from participating in migration, snapshots, or blockjobs. Only supported in vmx hypervisor (:since:`Since 0.9.5`) and ``qemu`` hypervisor (:since:`Since 6.9.0`). + + In cases where the source image of the ```` disk is supposed to + be shared between multiple concurrently running VMs the optional + ``shareBacking`` attribute should be set to ``yes``. Note that hypervisor + drivers may need to hotplug such disk and thus it works only with + configurations supporting hotplug. :since:`Since 7.4.0` ``serial`` If present, this specify serial number of virtual hard drive. For example, it may look like ``WD-WMAP9A966149``. Not supported for diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 66a581c514..38f9d3f599 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1429,6 +1429,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e27154f22d..4f78b7b43d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9047,6 +9047,7 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, xmlNodePtr blockioNode; xmlNodePtr driverNode; xmlNodePtr mirrorNode; + xmlNodePtr transientNode; g_autoptr(virStorageSource) src = NULL; if (!(src = virDomainDiskDefParseSourceXML(xmlopt, node, ctxt, flags))) @@ -9155,9 +9156,15 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, } } - if (virXPathNode("./transient", ctxt)) + if ((transientNode = virXPathNode("./transient", ctxt))) { def->transient = true; + if (virXMLPropTristateBool(transientNode, "shareBacking", + VIR_XML_PROP_NONE, + &def->transientShareBacking) < 0) + return NULL; + } + if (virDomainDiskDefIotuneParse(def, ctxt) < 0) return NULL; @@ -23551,8 +23558,12 @@ virDomainDiskDefFormat(virBuffer *buf, virBufferAddLit(buf, "\n"); if (def->src->shared) virBufferAddLit(buf, "\n"); - if (def->transient) - virBufferAddLit(buf, "\n"); + if (def->transient) { + virBufferAddLit(buf, "transientShareBacking == VIR_TRISTATE_BOOL_YES) + virBufferAddLit(buf, " shareBacking='yes'"); + virBufferAddLit(buf, "/>\n"); + } virBufferEscapeString(buf, "%s\n", def->serial); virBufferEscapeString(buf, "%s\n", def->wwn); virBufferEscapeString(buf, "%s\n", def->vendor); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f38ab21a3b..bf1249571d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -575,6 +575,7 @@ struct _virDomainDiskDef { unsigned int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */ virDomainStartupPolicy startupPolicy; bool transient; + virTristateBool transientShareBacking; virDomainDeviceInfo info; virTristateBool rawio; virDomainDeviceSGIO sgio;