mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-15 15:32:51 +00:00
block: refuse negative iops and bps values
Negative I/O throttling iops and bps values do not make sense so reject them with an error message. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
c546194f26
commit
7d81c1413c
10
blockdev.c
10
blockdev.c
|
@ -274,6 +274,16 @@ static bool do_check_io_limits(BlockIOLimit *io_limits, Error **errp)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] < 0 ||
|
||||
io_limits->bps[BLOCK_IO_LIMIT_WRITE] < 0 ||
|
||||
io_limits->bps[BLOCK_IO_LIMIT_READ] < 0 ||
|
||||
io_limits->iops[BLOCK_IO_LIMIT_TOTAL] < 0 ||
|
||||
io_limits->iops[BLOCK_IO_LIMIT_WRITE] < 0 ||
|
||||
io_limits->iops[BLOCK_IO_LIMIT_READ] < 0) {
|
||||
error_setg(errp, "bps and iops values must be 0 or greater");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue