Message ID | 20191126134222.16340-1-kwolf@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blockjob: Fix error message for negative speed | expand |
On Tue 26 Nov 2019 02:42:22 PM CET, Kevin Wolf wrote: > The error message for a negative speed uses QERR_INVALID_PARAMETER, > which implies that the 'speed' option doesn't even exist: > > {"error": {"class": "GenericError", "desc": "Invalid parameter 'speed'"}} > > Make it use QERR_INVALID_PARAMETER_VALUE instead: > > {"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}} > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Berto
On 26.11.19 14:42, Kevin Wolf wrote: > The error message for a negative speed uses QERR_INVALID_PARAMETER, > which implies that the 'speed' option doesn't even exist: > > {"error": {"class": "GenericError", "desc": "Invalid parameter 'speed'"}} > > Make it use QERR_INVALID_PARAMETER_VALUE instead: > > {"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}} > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > blockjob.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) This needs an update to iotest 030. Max
diff --git a/blockjob.c b/blockjob.c index c6e20e2fcd..5d63b1e89d 100644 --- a/blockjob.c +++ b/blockjob.c @@ -261,7 +261,8 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) return; } if (speed < 0) { - error_setg(errp, QERR_INVALID_PARAMETER, "speed"); + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "speed", + "a non-negative value"); return; }
The error message for a negative speed uses QERR_INVALID_PARAMETER, which implies that the 'speed' option doesn't even exist: {"error": {"class": "GenericError", "desc": "Invalid parameter 'speed'"}} Make it use QERR_INVALID_PARAMETER_VALUE instead: {"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}} Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- blockjob.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)