1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

conf: add queue_size option to disk

The option "queue-size" for virtio-blk was added in qemu-2.12.0, and
default value increased from qemu-5.0.0.

However, increasing this value may lead to drop of random access
performance.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Hiroki Narukawa 2021-09-09 12:34:46 +09:00 committed by Peter Krempa
parent 240bdcbc93
commit 36560f3551
4 changed files with 22 additions and 1 deletions

View File

@ -2474,7 +2474,7 @@ paravirtualized driver is specified via the ``disk`` element.
<target dev='vdc' bus='virtio'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' queues='4'/>
<driver name='qemu' type='qcow2' queues='4' queue_size='256' />
<source file='/var/lib/libvirt/images/domain.qcow'/>
<backingStore type='file'>
<format type='qcow2'/>
@ -3085,6 +3085,8 @@ paravirtualized driver is specified via the ``disk`` element.
(QEMU 2.1)`
- The optional ``queues`` attribute specifies the number of virt queues for
virtio-blk. ( :since:`Since 3.9.0` )
- The optional ``queue_size`` attribute specifies the size of each virt
queue for virtio-blk. ( :since:`Since 7.8.0` )
- For virtio disks, `Virtio-specific options <#elementsVirtio>`__ can also
be set. ( :since:`Since 3.5.0` )
- The optional ``metadata_cache`` subelement controls aspects related to the

View File

@ -2363,6 +2363,11 @@
<ref name="positiveInteger"/>
</attribute>
</optional>
<optional>
<attribute name="queue_size">
<ref name="positiveInteger"/>
</attribute>
</optional>
<ref name="virtioOptions"/>
<optional>
<element name="metadata_cache">

View File

@ -8931,6 +8931,9 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
if (virXMLPropUInt(cur, "queues", 10, VIR_XML_PROP_NONE, &def->queues) < 0)
return -1;
if (virXMLPropUInt(cur, "queue_size", 10, VIR_XML_PROP_NONE, &def->queue_size) < 0)
return -1;
return 0;
}
@ -20774,6 +20777,13 @@ virDomainDiskDefCheckABIStability(virDomainDiskDef *src,
return false;
}
if (src->queue_size != dst->queue_size) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target disk queue size %u does not match source %u"),
dst->queues, src->queues);
return false;
}
if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
@ -23424,6 +23434,9 @@ virDomainDiskDefFormatDriver(virBuffer *buf,
if (disk->queues)
virBufferAsprintf(&attrBuf, " queues='%u'", disk->queues);
if (disk->queue_size)
virBufferAsprintf(&attrBuf, " queue_size='%u'", disk->queue_size);
virDomainVirtioOptionsFormat(&attrBuf, disk->virtio);
if (disk->src->metadataCacheMaxSize > 0) {

View File

@ -584,6 +584,7 @@ struct _virDomainDiskDef {
virDomainDiskDetectZeroes detect_zeroes;
char *domain_name; /* backend domain name */
unsigned int queues;
unsigned int queue_size;
virDomainDiskModel model;
virDomainVirtioOptions *virtio;