mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Support multiqueue virtio-blk
qemu 2.7.0 introduces multiqueue virtio-blk(commit 2f27059). This patch introduces a new attribute "queues". An example of the XML: <disk type='file' device='disk'> <driver name='qemu' type='qcow2' queues='4'/> The corresponding QEMU command line: -device virtio-blk-pci,scsi=off,num-queues=4,id=virtio-disk0 Signed-off-by: Lin Ma <lma@suse.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -5113,6 +5113,13 @@ virDomainDiskDefValidate(const virDomainDiskDef *disk)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (disk->queues && disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("queues attribute in disk driver element is only "
|
||||
"supported by virtio-blk"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8776,6 +8783,15 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
if ((tmp = virXMLPropString(cur, "queues")) &&
|
||||
virStrToLong_uip(tmp, NULL, 10, &def->queues) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("'queues' attribute must be positive number: %s"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
@@ -22030,6 +22046,8 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
|
||||
if (def->detect_zeroes)
|
||||
virBufferAsprintf(&driverBuf, " detect_zeroes='%s'", detect_zeroes);
|
||||
if (def->queues)
|
||||
virBufferAsprintf(&driverBuf, " queues='%u'", def->queues);
|
||||
|
||||
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
|
||||
|
||||
|
||||
@@ -668,6 +668,7 @@ struct _virDomainDiskDef {
|
||||
unsigned int iothread; /* unused = 0, > 0 specific thread # */
|
||||
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
|
||||
char *domain_name; /* backend domain name */
|
||||
unsigned int queues;
|
||||
virDomainVirtioOptionsPtr virtio;
|
||||
};
|
||||
|
||||
|
||||
@@ -2083,6 +2083,17 @@ qemuBuildDriveDevStr(const virDomainDef *def,
|
||||
? "on" : "off");
|
||||
}
|
||||
|
||||
if (disk->queues) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("num-queues property isn't supported by this "
|
||||
"QEMU binary"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
virBufferAsprintf(&opt, ",num-queues=%u", disk->queues);
|
||||
}
|
||||
|
||||
if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0)
|
||||
goto error;
|
||||
|
||||
|
||||
@@ -883,6 +883,9 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
|
||||
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int qemuDomainDefValidateDisk(const virDomainDiskDef *disk,
|
||||
virQEMUCapsPtr qemuCaps);
|
||||
|
||||
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob);
|
||||
|
||||
Reference in New Issue
Block a user