mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
qemu: Adjust how supportMaxOptions is used.
We're about to add more options, let's avoid having multiple if-then-else which each try to set up the qemuMonitorJSONMakeCommand call with all the parameters it knows about. Instead, use the fact that when a NULL is found in the argument list that processing of the remaining arguments stops and just have call. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a1417d5305
commit
85f05f66f4
@ -4588,8 +4588,9 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
|
|||||||
virJSONValuePtr result = NULL;
|
virJSONValuePtr result = NULL;
|
||||||
|
|
||||||
/* The qemu capability check has already been made in
|
/* The qemu capability check has already been made in
|
||||||
* qemuDomainSetBlockIoTune */
|
* qemuDomainSetBlockIoTune. NB, once a NULL is found in
|
||||||
if (supportMaxOptions) {
|
* the sequence, qemuMonitorJSONMakeCommand will stop. So
|
||||||
|
* let's make use of that when !supportMaxOptions */
|
||||||
cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
|
cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
|
||||||
"s:device", device,
|
"s:device", device,
|
||||||
"U:bps", info->total_bytes_sec,
|
"U:bps", info->total_bytes_sec,
|
||||||
@ -4598,6 +4599,7 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
|
|||||||
"U:iops", info->total_iops_sec,
|
"U:iops", info->total_iops_sec,
|
||||||
"U:iops_rd", info->read_iops_sec,
|
"U:iops_rd", info->read_iops_sec,
|
||||||
"U:iops_wr", info->write_iops_sec,
|
"U:iops_wr", info->write_iops_sec,
|
||||||
|
!supportMaxOptions ? NULL :
|
||||||
"U:bps_max", info->total_bytes_sec_max,
|
"U:bps_max", info->total_bytes_sec_max,
|
||||||
"U:bps_rd_max", info->read_bytes_sec_max,
|
"U:bps_rd_max", info->read_bytes_sec_max,
|
||||||
"U:bps_wr_max", info->write_bytes_sec_max,
|
"U:bps_wr_max", info->write_bytes_sec_max,
|
||||||
@ -4606,17 +4608,6 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
|
|||||||
"U:iops_wr_max", info->write_iops_sec_max,
|
"U:iops_wr_max", info->write_iops_sec_max,
|
||||||
"U:iops_size", info->size_iops_sec,
|
"U:iops_size", info->size_iops_sec,
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
|
||||||
cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
|
|
||||||
"s:device", device,
|
|
||||||
"U:bps", info->total_bytes_sec,
|
|
||||||
"U:bps_rd", info->read_bytes_sec,
|
|
||||||
"U:bps_wr", info->write_bytes_sec,
|
|
||||||
"U:iops", info->total_iops_sec,
|
|
||||||
"U:iops_rd", info->read_iops_sec,
|
|
||||||
"U:iops_wr", info->write_iops_sec,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user