blockjob: Fix error message for negative speed
PATCH v2 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]>
Reviewed-by Alberto Garcia <[email protected]>
---
v2:
- Update reference output for 030 [Max]
blockjob.c | 3 ++- tests/qemu-iotests/030 | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
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 ; }
tests/qemu-iotests/030 +2 -2
@@ -943,7 +943,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', speed=-1) - self.assert_qmp(result, 'error/desc', "Invalid parameter 'speed'") + self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value") self.assert_no_active_block_jobs()
@@ -952,7 +952,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) result = self.vm.qmp('block-job-set-speed', device='drive0', speed=-1) - self.assert_qmp(result, 'error/desc', "Invalid parameter 'speed'") + self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value") self.cancel_and_wait(resume=True)
Signature · 1 line
2.20.1
Quoted 11 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]>
Quoted 8 lines
---
v2:
- Update reference output for 030 [Max]blockjob.c | 3 ++- tests/qemu-iotests/030 | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Reviewed-by Max Reitz <[email protected]>