mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Added capability checking for block <iotune> setting.
There was missing capability for blkiotune and thus specifying these settings caused libvirt to run qemu with invalid parameters and then reporting qemu error instead of the standard libvirt one. The support for blkiotune setting was added in upstream qemu repo under commit 0563e191516289c9d2f282a8c50f2eecef2fa773.
This commit is contained in:
parent
c53ba61b21
commit
4c82f09ef0
@ -150,6 +150,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
|
||||
"drive-copy-on-read",
|
||||
"cpu-host",
|
||||
"fsdev-writeout",
|
||||
|
||||
"drive-iotune", /* 85 */
|
||||
);
|
||||
|
||||
struct qemu_feature_flags {
|
||||
@ -1031,6 +1033,8 @@ qemuCapsComputeCmdFlags(const char *help,
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_AIO);
|
||||
if (strstr(help, "copy-on-read=on|off"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_COPY_ON_READ);
|
||||
if (strstr(help, "bps="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_IOTUNE);
|
||||
}
|
||||
if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
|
||||
const char *nl = strstr(p, "\n");
|
||||
|
@ -124,6 +124,8 @@ enum qemuCapsFlags {
|
||||
QEMU_CAPS_CPU_HOST = 83, /* support for -cpu host */
|
||||
QEMU_CAPS_FSDEV_WRITEOUT = 84, /* -fsdev writeout supported */
|
||||
|
||||
QEMU_CAPS_DRIVE_IOTUNE = 85, /* -drive bps= and friends ({b,io}ps{_rd,_wr,}) */
|
||||
|
||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
|
||||
|
@ -1987,6 +1987,19 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
/* block I/O throttling */
|
||||
if ((disk->blkdeviotune.total_bytes_sec ||
|
||||
disk->blkdeviotune.read_bytes_sec ||
|
||||
disk->blkdeviotune.write_bytes_sec ||
|
||||
disk->blkdeviotune.total_iops_sec ||
|
||||
disk->blkdeviotune.read_iops_sec ||
|
||||
disk->blkdeviotune.write_iops_sec) &&
|
||||
!qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("block I/O throttling not supported with this "
|
||||
"QEMU binary"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.total_bytes_sec) {
|
||||
virBufferAsprintf(&opt, ",bps=%llu",
|
||||
disk->blkdeviotune.total_bytes_sec);
|
||||
|
@ -705,7 +705,7 @@ mymain(void)
|
||||
DO_TEST("cputune", false, QEMU_CAPS_NAME);
|
||||
DO_TEST("numatune-memory", false, NONE);
|
||||
DO_TEST("blkdeviotune", false, QEMU_CAPS_NAME, QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_DRIVE);
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_IOTUNE);
|
||||
|
||||
DO_TEST("multifunction-pci-device", false,
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||
|
Loading…
Reference in New Issue
Block a user