blockjob: Fix error message for negative speed
PATCH 1/1 blockjob: Fix error message for negative speed
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 <[email protected]>
--- blockjob.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
blockjob.c +2 -1
@@ -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 ; }
Signature · 1 line
2.20.1
Quoted 10 lines · Kevin Wolf
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_VALUEinstead:{"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}}Signed-off-by Kevin Wolf <[email protected]>
Reviewed-by Alberto Garcia <[email protected]>
Berto
Quoted 5 lines · Kevin Wolf
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'"}}
Quoted 8 lines
Make it use
QERR_INVALID_PARAMETER_VALUEinstead:{"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}}Signed-off-by Kevin Wolf <[email protected]>--- blockjob.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
This needs an update to iotest 030.
Max