Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
docs/formatdomain.rst | 10 ++++++++++
src/conf/domain_conf.c | 12 +++++++++++-
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 3 ++-
src/conf/schemas/domaincommon.rng | 5 +++++
5 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 0d0812f08c..1fe93066bd 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2591,6 +2591,13 @@ paravirtualized driver is specified via the ``disk`` element.
<blockio logical_block_size='512' physical_block_size='4096'
discard_granularity='4096'/>
<target dev='hdj' bus='ide'/>
</disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='/var/lib/libvirt/images/rhelik.raw'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='4' unit='0'/>
+ <blockio max_unmap_size='1073741824'/>
+ </disk>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw'/>
<source pool='blk-pool0' volume='blk-pool0-vol0'/>
@@ -3439,6 +3446,9 @@ paravirtualized driver is specified via the ``disk`` element.
The smallest amount of data that can be discarded in a single operation.
It impacts the unmap operations and it must be a multiple of a
``logical_block_size``.
+ ``max_unmap_size``
+ The maximum size of an unmap operation that can be performed for scsi
+ disks.
Filesystems
~~~~~~~~~~~
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 950c9049ba..59eb9fb0c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8059,6 +8059,10 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
if (virXMLPropUInt(blockioNode, "discard_granularity", 10,
VIR_XML_PROP_NONE,
&def->blockio.discard_granularity) < 0)
return NULL;
+
+ if (virXMLPropUInt(blockioNode, "max_unmap_size", 10,
VIR_XML_PROP_NONE,
+ &def->blockio.max_unmap_size) < 0)
+ return NULL;
}
if ((driverNode = virXPathNode("./driver", ctxt))) {
@@ -22040,7 +22044,8 @@ virDomainDiskBlockIoDefFormat(virBuffer *buf,
{
if (def->blockio.logical_block_size > 0 ||
def->blockio.physical_block_size > 0 ||
- def->blockio.discard_granularity > 0) {
+ def->blockio.discard_granularity > 0 ||
+ def->blockio.max_unmap_size > 0) {
virBufferAddLit(buf, "<blockio");
if (def->blockio.logical_block_size > 0) {
virBufferAsprintf(buf,
@@ -22057,6 +22062,11 @@ virDomainDiskBlockIoDefFormat(virBuffer *buf,
" discard_granularity='%u'",
def->blockio.discard_granularity);
}
+ if (def->blockio.max_unmap_size > 0) {
+ virBufferAsprintf(buf,
+ " max_unmap_size='%u'",
+ def->blockio.max_unmap_size);
+ }
virBufferAddLit(buf, "/>\n");
}
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1621876a21..26f5fdbd92 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -580,6 +580,7 @@ struct _virDomainDiskDef {
unsigned int logical_block_size;
unsigned int physical_block_size;
unsigned int discard_granularity;
+ unsigned int max_unmap_size;
} blockio;
virDomainBlockIoTuneInfo blkdeviotune;
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 7e00b6451a..db2dd01985 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -467,7 +467,8 @@ virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
if (disk->blockio.logical_block_size > 0 ||
disk->blockio.physical_block_size > 0 ||
- disk->blockio.discard_granularity > 0) {
+ disk->blockio.discard_granularity > 0 ||
+ disk->blockio.max_unmap_size > 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("blockio is not supported with vhostuser disk"));
return -1;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index ee9c408a21..31897342f4 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -2481,6 +2481,11 @@
<data type="integer"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="max_unmap_size">
+ <data type="integer"/>
+ </attribute>
+ </optional>
</element>
</define>
<!--
--
2.41.0