mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
qemu: Add better message for some invalid block I/O settings
For example when both total_bytes_sec and total_bytes_sec_max are set, but the former gets cleaned due to new call setting, let's say, read_bytes_sec, we end up with this weird message for the command: $ virsh blkdeviotune fedora vda --read-bytes-sec 3000 error: Unable to change block I/O throttle error: unsupported configuration: value 'total_bytes_sec_max' cannot be set if 'total_bytes_sec' is not set So let's make it more descriptive. This is how it looks after the change: $ virsh blkdeviotune fedora vda --read-bytes-sec 3000 error: Unable to change block I/O throttle error: unsupported configuration: cannot reset 'total_bytes_sec' when 'total_bytes_sec_max' is set Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1344897 Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
862bea96d9
commit
b425245520
@ -17480,23 +17480,39 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
qemuDomainSetBlockIoTuneDefaults(&info, &disk->blkdeviotune,
|
||||
set_fields);
|
||||
|
||||
#define CHECK_MAX(val) \
|
||||
#define CHECK_MAX(val, _bool) \
|
||||
do { \
|
||||
if (info.val##_max && !info.val) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be set if " \
|
||||
"'%s' is not set"), \
|
||||
#val "_max", #val); \
|
||||
goto endjob; \
|
||||
if (info.val##_max) { \
|
||||
if (!info.val) { \
|
||||
if (QEMU_BLOCK_IOTUNE_SET_##_bool) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("cannot reset '%s' when " \
|
||||
"'%s' is set"), \
|
||||
#val, #val "_max"); \
|
||||
} else { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be set if " \
|
||||
"'%s' is not set"), \
|
||||
#val "_max", #val); \
|
||||
} \
|
||||
goto endjob; \
|
||||
} \
|
||||
if (info.val##_max < info.val) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be " \
|
||||
"smaller than '%s'"), \
|
||||
#val "_max", #val); \
|
||||
goto endjob; \
|
||||
} \
|
||||
} \
|
||||
} while (false);
|
||||
} while (false)
|
||||
|
||||
CHECK_MAX(total_bytes_sec);
|
||||
CHECK_MAX(read_bytes_sec);
|
||||
CHECK_MAX(write_bytes_sec);
|
||||
CHECK_MAX(total_iops_sec);
|
||||
CHECK_MAX(read_iops_sec);
|
||||
CHECK_MAX(write_iops_sec);
|
||||
CHECK_MAX(total_bytes_sec, BYTES);
|
||||
CHECK_MAX(read_bytes_sec, BYTES);
|
||||
CHECK_MAX(write_bytes_sec, BYTES);
|
||||
CHECK_MAX(total_iops_sec, IOPS);
|
||||
CHECK_MAX(read_iops_sec, IOPS);
|
||||
CHECK_MAX(write_iops_sec, IOPS);
|
||||
|
||||
#undef CHECK_MAX
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user