On Sun, Oct 01, 2017 at 01:15:36AM +0800, Lin Ma wrote:
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(a)suse.com>
---
docs/formatdomain.html.in | 6 +++-
docs/schemas/domaincommon.rng | 5 ++++
src/conf/domain_conf.c | 18 ++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 7 +++++
src/qemu/qemu_domain.c | 24 +++++++++++++++
src/qemu/qemu_domain.h | 3 ++
.../qemuxml2argv-disk-virtio-drive-queues.args | 24 +++++++++++++++
.../qemuxml2argv-disk-virtio-drive-queues.xml | 34 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
.../qemuxml2xmlout-disk-virtio-drive-queues.xml | 34 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
12 files changed, 158 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-drive-queues.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-drive-queues.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-drive-queues.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4f141e0..7e5c9cb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2083,6 +2083,13 @@ qemuBuildDriveDevStr(const virDomainDef *def,
? "on" : "off");
}
+ if (disk->queues) {
+ if (qemuDomainDefValidateDisk(disk, qemuCaps) < 0)
+ goto error;
I thought we already had per-device validation functions that get called
when both defining/starting a new domain and on hotplug, but they are in
the conf module.
I'll just move the error message here and leave the cleanup to future
generations.
+ else
else is not required here, since we jumped away in the if clause.
+ virBufferAsprintf(&opt,
",num-queues=%u", disk->queues);
+ }
+
if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0)
goto error;
ACK and pushed, with the .args test case rewrapped to pass
'make-syntax-check':
--- tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-drive-queues.args 2017-10-04
17:27:17.419307555 +0200
+++ - 2017-10-04 17:43:36.970064719 +0200
@@ -20,5 +20,5 @@
-boot c \
-usb \
-drive file=/tmp/data.img,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,num-queues=4,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
-id=virtio-disk0
+-device virtio-blk-pci,num-queues=4,bus=pci.0,addr=0x3,\
+drive=drive-virtio-disk0,id=virtio-disk0
Incorrect line wrapping in
tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-drive-queues.args
Use test-wrap-argv.pl to wrap test data files
Jan