Revision c546194f
b/blockdev.c | ||
---|---|---|
255 | 255 |
} |
256 | 256 |
} |
257 | 257 |
|
258 |
static bool do_check_io_limits(BlockIOLimit *io_limits) |
|
258 |
static bool do_check_io_limits(BlockIOLimit *io_limits, Error **errp)
|
|
259 | 259 |
{ |
260 | 260 |
bool bps_flag; |
261 | 261 |
bool iops_flag; |
... | ... | |
269 | 269 |
&& ((io_limits->iops[BLOCK_IO_LIMIT_READ] != 0) |
270 | 270 |
|| (io_limits->iops[BLOCK_IO_LIMIT_WRITE] != 0)); |
271 | 271 |
if (bps_flag || iops_flag) { |
272 |
error_setg(errp, "bps(iops) and bps_rd/bps_wr(iops_rd/iops_wr) " |
|
273 |
"cannot be used at the same time"); |
|
272 | 274 |
return false; |
273 | 275 |
} |
274 | 276 |
|
... | ... | |
297 | 299 |
int snapshot = 0; |
298 | 300 |
bool copy_on_read; |
299 | 301 |
int ret; |
302 |
Error *error = NULL; |
|
300 | 303 |
|
301 | 304 |
translation = BIOS_ATA_TRANSLATION_AUTO; |
302 | 305 |
media = MEDIA_DISK; |
... | ... | |
427 | 430 |
io_limits.iops[BLOCK_IO_LIMIT_WRITE] = |
428 | 431 |
qemu_opt_get_number(opts, "iops_wr", 0); |
429 | 432 |
|
430 |
if (!do_check_io_limits(&io_limits)) { |
|
431 |
error_report("bps(iops) and bps_rd/bps_wr(iops_rd/iops_wr) "
|
|
432 |
"cannot be used at the same time");
|
|
433 |
if (!do_check_io_limits(&io_limits, &error)) {
|
|
434 |
error_report("%s", error_get_pretty(error));
|
|
435 |
error_free(error);
|
|
433 | 436 |
return NULL; |
434 | 437 |
} |
435 | 438 |
|
... | ... | |
975 | 978 |
io_limits.iops[BLOCK_IO_LIMIT_READ] = iops_rd; |
976 | 979 |
io_limits.iops[BLOCK_IO_LIMIT_WRITE]= iops_wr; |
977 | 980 |
|
978 |
if (!do_check_io_limits(&io_limits)) { |
|
979 |
error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); |
|
981 |
if (!do_check_io_limits(&io_limits, errp)) { |
|
980 | 982 |
return; |
981 | 983 |
} |
982 | 984 |
|
Also available in: Unified diff