[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/30] blockjob: Fix error message for negative speed
From: |
Kevin Wolf |
Subject: |
[PULL 07/30] blockjob: Fix error message for negative speed |
Date: |
Thu, 19 Dec 2019 18:24:18 +0100 |
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 <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
blockjob.c | 3 ++-
tests/qemu-iotests/030 | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
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;
}
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index f3766f2a81..be35bde06f 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)
--
2.20.1
- [PULL 00/30] Block layer patches, Kevin Wolf, 2019/12/19
- [PULL 02/30] iotests: Skip test 060 if it is not possible to create large files, Kevin Wolf, 2019/12/19
- [PULL 01/30] iotests: Provide a function for checking the creation of huge files, Kevin Wolf, 2019/12/19
- [PULL 03/30] iotests: Skip test 079 if it is not possible to create large files, Kevin Wolf, 2019/12/19
- [PULL 04/30] qapi: better document NVMe blockdev @device parameter, Kevin Wolf, 2019/12/19
- [PULL 06/30] block: Error out on image creation with conflicting size options, Kevin Wolf, 2019/12/19
- [PULL 05/30] qemu-img: fix info --backing-chain --image-opts, Kevin Wolf, 2019/12/19
- [PULL 08/30] qcow2: Declare BDRV_REQ_NO_FALLBACK supported, Kevin Wolf, 2019/12/19
- [PULL 07/30] blockjob: Fix error message for negative speed,
Kevin Wolf <=
- [PULL 09/30] iotests: Add qemu_io_log(), Kevin Wolf, 2019/12/19
- [PULL 10/30] iotests: Fix timeout in run_job(), Kevin Wolf, 2019/12/19
- [PULL 11/30] iotests: Support job-complete in run_job(), Kevin Wolf, 2019/12/19
- [PULL 12/30] qcow2: Use offset_into_cluster(), Kevin Wolf, 2019/12/19
- [PULL 14/30] iotests: Add more "_require_drivers" checks to the shell-based tests, Kevin Wolf, 2019/12/19
- [PULL 13/30] MAINTAINERS: fix qcow2-bitmap.c under Dirty Bitmaps header, Kevin Wolf, 2019/12/19
- [PULL 17/30] qcow2: Move error check of local_err near its assignment, Kevin Wolf, 2019/12/19
- [PULL 15/30] iotests/273: Filter format-specific information, Kevin Wolf, 2019/12/19
- [PULL 16/30] iotests: Fix IMGOPTSSYNTAX for nbd, Kevin Wolf, 2019/12/19
- [PULL 18/30] iotests: Create VM.blockdev_create(), Kevin Wolf, 2019/12/19