]> git.proxmox.com Git - qemu.git/commit
block: use Error in do_check_io_limits()
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 13 Feb 2013 15:53:42 +0000 (16:53 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 22 Feb 2013 20:21:09 +0000 (21:21 +0100)
commitc546194f260fb3e391193cb8cc33505618077ecb
tree80360da6b12e54dd8e7a3186e0d3db1a894a10c8
parent4db35162ea54d84c29074adfcff470ee2687e7b9
block: use Error in do_check_io_limits()

The do_check_io_limits() function returns false when I/O limits are
invalid but it doesn't set an Error to indicate why.  The two
do_check_io_limits() callers duplicate error reporting.  Solve this by
passing an Error pointer into do_check_io_limits().

Note that the two callers report slightly different errors: drive_init()
prints a custom error message while qmp_block_set_io_throttle() does
error_set(errp, QERR_INVALID_PARAMETER_COMBINATION).

QERR_INVALID_PARAMETER_COMBINATION is a generic error, see
include/qapi/qmp/qerror.h:

  #define QERR_INVALID_PARAMETER_COMBINATION \
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination"

Since it is generic we are not obliged to keep this error.  Switch to
the custom error message which contains more information.

This patch prepares for adding additional checks with their own error
messages to do_check_io_limits().  The next patch adds a new check.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
blockdev.c