mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
qemu: Add bps_max and friends to qemu command generation
Check the arability of the options with the current qemu binary, add them in the varable opt if yes, print a message if not. Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
This commit is contained in:
parent
901ffda286
commit
12952bb14a
@ -3670,12 +3670,32 @@ qemuBuildDriveStr(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* block I/O throttling 1.7 */
|
||||
if ((disk->blkdeviotune.total_bytes_sec_max ||
|
||||
disk->blkdeviotune.read_bytes_sec_max ||
|
||||
disk->blkdeviotune.write_bytes_sec_max ||
|
||||
disk->blkdeviotune.total_iops_sec_max ||
|
||||
disk->blkdeviotune.read_iops_sec_max ||
|
||||
disk->blkdeviotune.write_iops_sec_max) &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("there is some block I/O throttling paramater that are not supported with this "
|
||||
"QEMU binary(need QEMU 1.7 or superior)"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.total_bytes_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.read_bytes_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.write_bytes_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.total_iops_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.read_iops_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.write_iops_sec > LLONG_MAX) {
|
||||
disk->blkdeviotune.write_iops_sec > LLONG_MAX ||
|
||||
disk->blkdeviotune.total_bytes_sec_max > LLONG_MAX ||
|
||||
disk->blkdeviotune.read_bytes_sec_max > LLONG_MAX ||
|
||||
disk->blkdeviotune.write_bytes_sec_max > LLONG_MAX ||
|
||||
disk->blkdeviotune.total_iops_sec_max > LLONG_MAX ||
|
||||
disk->blkdeviotune.read_iops_sec_max > LLONG_MAX ||
|
||||
disk->blkdeviotune.write_iops_sec_max > LLONG_MAX) {
|
||||
virReportError(VIR_ERR_OVERFLOW,
|
||||
_("block I/O throttle limit must "
|
||||
"be less than %llu using QEMU"), LLONG_MAX);
|
||||
@ -3712,6 +3732,41 @@ qemuBuildDriveStr(virConnectPtr conn,
|
||||
disk->blkdeviotune.write_iops_sec);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.total_bytes_sec_max) {
|
||||
virBufferAsprintf(&opt, ",bps_max=%llu",
|
||||
disk->blkdeviotune.total_bytes_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.read_bytes_sec_max) {
|
||||
virBufferAsprintf(&opt, ",bps_rd_max=%llu",
|
||||
disk->blkdeviotune.read_bytes_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.write_bytes_sec_max) {
|
||||
virBufferAsprintf(&opt, ",bps_wr_max=%llu",
|
||||
disk->blkdeviotune.write_bytes_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.total_iops_sec_max) {
|
||||
virBufferAsprintf(&opt, ",iops_max=%llu",
|
||||
disk->blkdeviotune.total_iops_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.read_iops_sec_max) {
|
||||
virBufferAsprintf(&opt, ",iops_rd_max=%llu",
|
||||
disk->blkdeviotune.read_iops_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.write_iops_sec_max) {
|
||||
virBufferAsprintf(&opt, ",iops_wr_max=%llu",
|
||||
disk->blkdeviotune.write_iops_sec_max);
|
||||
}
|
||||
|
||||
if (disk->blkdeviotune.write_iops_sec_max) {
|
||||
virBufferAsprintf(&opt, ",iops_size=%llu",
|
||||
disk->blkdeviotune.size_iops_sec);
|
||||
}
|
||||
|
||||
if (virBufferCheckError(&opt) < 0)
|
||||
goto error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user