There is a case that locking hits a bug and users wants to disable locking like bug in Linux kernel. This commit adds option to configure locking for file source. Signed-off-by: Hiroki Narukawa <hnarukaw@xxxxxxxxxxxxx> --- docs/formatdomain.rst | 5 +++++ src/conf/domain_conf.c | 8 ++++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/conf/storage_source_conf.h | 3 +++ 4 files changed, 21 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 0a4f9d9000..95869d573c 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2782,6 +2782,11 @@ paravirtualized driver is specified via the ``disk`` element. via the filesystem. The filename passed via ``file`` can still be used to generate paths to write into image metadata when doing block operations but libvirt will not access these natively. + + :since:`Since 10.1.0` a new optional attribute ``locking`` can be added + which can take "on" or "off". Basically this option should be kept + default, but it can be used explicitly for workaround about bug in + locking. ``block`` The ``dev`` attribute specifies the fully-qualified path to the host device to serve as the disk. :since:`Since 0.0.3` diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3597959e33..b7cefffc7c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7563,6 +7563,10 @@ virDomainStorageSourceParse(xmlNodePtr node, ctxt, flags) < 0) return -1; + if (virXMLPropTristateSwitch(node, "locking", VIR_XML_PROP_NONE, + &src->locking) < 0) + return -1; + /* People sometimes pass a bogus '' source path when they mean to omit the * source element completely (e.g. CDROM without media). This is just a * little compatibility check to help those broken apps */ @@ -22544,6 +22548,10 @@ virDomainDiskSourceFormat(virBuffer *buf, if (attrIndex && src->id != 0) virBufferAsprintf(&attrBuf, " index='%u'", src->id); + if (src->locking) + virBufferEscapeString(&attrBuf, " locking='%s'", + virTristateSwitchTypeToString(src->locking)); + if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0) return -1; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index df44cd9857..8ccb1dd162 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -1789,6 +1789,11 @@ <ref name="positiveInteger"/> </attribute> </optional> + <optional> + <attribute name="locking"> + <ref name="virOnOff"/> + </attribute> + </optional> <optional> <element name="slices"> <element name="slice"> diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 05b4bda16c..3984614a3d 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -356,6 +356,9 @@ struct _virStorageSource { /* image is shared across hosts */ bool shared; + /* intended to use for workaround */ + virTristateSwitch locking; + /* backing chain of the storage source */ virStorageSource *backingStore; -- 2.25.1 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx