https://bugzilla.redhat.com/show_bug.cgi?id=1349898
Add in the block I/O throttling length/duration parameter to the command
line if supported. If not supported, fail command creation.
Add the xml2argvtest for testing.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_command.c | 21 +++++++++++++
.../qemuxml2argv-blkdeviotune-max-length.args | 34 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 +++
3 files changed, 59 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune-max-length.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 20fe6fc..4fa3d34 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1747,6 +1747,20 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
goto error;
}
+ /* block I/O throttling length 2.6 */
+ if ((disk->blkdeviotune.total_bytes_sec_max_length ||
+ disk->blkdeviotune.read_bytes_sec_max_length ||
+ disk->blkdeviotune.write_bytes_sec_max_length ||
+ disk->blkdeviotune.total_iops_sec_max_length ||
+ disk->blkdeviotune.read_iops_sec_max_length ||
+ disk->blkdeviotune.write_iops_sec_max_length) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("there are some block I/O throttling length parameters
"
+ "that are not supported with this QEMU binary"));
+ goto error;
+ }
+
if (disk->blkdeviotune.total_bytes_sec > QEMU_BLOCK_IOTUNE_MAX ||
disk->blkdeviotune.read_bytes_sec > QEMU_BLOCK_IOTUNE_MAX ||
disk->blkdeviotune.write_bytes_sec > QEMU_BLOCK_IOTUNE_MAX ||
@@ -1788,6 +1802,13 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
IOTUNE_ADD(size_iops_sec, "iops-size");
+ IOTUNE_ADD(total_bytes_sec_max_length, "bps-total-max-length");
+ IOTUNE_ADD(read_bytes_sec_max_length, "bps-read-max-length");
+ IOTUNE_ADD(write_bytes_sec_max_length, "bps-write-max-length");
+ IOTUNE_ADD(total_iops_sec_max_length, "iops-total-max-length");
+ IOTUNE_ADD(read_iops_sec_max_length, "iops-read-max-length");
+ IOTUNE_ADD(write_iops_sec_max_length, "iops-write-max-length");
+
#undef IOTUNE_ADD
if (virBufferCheckError(&opt) < 0)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune-max-length.args
b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune-max-length.args
new file mode 100644
index 0000000..b656aea
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune-max-length.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
+cache=none,throttling.bps-total=5000,throttling.iops-total=6000,\
+throttling.bps-total-max=10000,throttling.iops-total-max=11000,\
+throttling.bps-total-max-length=3,throttling.iops-total-max-length=5 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest2,format=qcow2,if=none,id=drive-ide0-0-1,\
+cache=none,throttling.bps-read=5000,throttling.bps-write=5500,\
+throttling.iops-read=3500,throttling.iops-write=4000,\
+throttling.bps-read-max=6000,throttling.bps-write-max=6500,\
+throttling.iops-read-max=7000,throttling.iops-write-max=7500,\
+throttling.iops-size=2000,throttling.bps-read-max-length=3,\
+throttling.bps-write-max-length=5,throttling.iops-read-max-length=7,\
+throttling.iops-write-max-length=9 \
+-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7080484..de74b69 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1492,6 +1492,10 @@ mymain(void)
DO_TEST("blkdeviotune-max",
QEMU_CAPS_DRIVE_IOTUNE,
QEMU_CAPS_DRIVE_IOTUNE_MAX);
+ DO_TEST("blkdeviotune-max-length",
+ QEMU_CAPS_DRIVE_IOTUNE,
+ QEMU_CAPS_DRIVE_IOTUNE_MAX,
+ QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
DO_TEST("multifunction-pci-device",
QEMU_CAPS_NODEFCONFIG,
--
2.7.4