diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-11-26 14:39:55 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-12-18 11:21:07 +0100 |
commit | 1ef7d9d368eb76d64e86e4d1251eb8e53881ff26 (patch) | |
tree | 8d9d01b2e45b37e02897a010a6a5f0739161f2aa | |
parent | f6dc1c31d3801dcbdf0c56574f9ff4f05180810c (diff) | |
download | qemu-1ef7d9d368eb76d64e86e4d1251eb8e53881ff26.zip qemu-1ef7d9d368eb76d64e86e4d1251eb8e53881ff26.tar.gz qemu-1ef7d9d368eb76d64e86e4d1251eb8e53881ff26.tar.bz2 |
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 <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
-rw-r--r-- | blockjob.c | 3 | ||||
-rwxr-xr-x | tests/qemu-iotests/030 | 4 |
2 files changed, 4 insertions, 3 deletions
@@ -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; } diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index f3766f2..be35bde 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -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) |