All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blockjob: Fix error message for negative speed
@ 2019-11-26 13:42 Kevin Wolf
  2019-11-26 13:44 ` Alberto Garcia
  2019-12-17 13:34 ` Max Reitz
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2019-11-26 13:42 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

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(-)

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;
     }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blockjob: Fix error message for negative speed
  2019-11-26 13:42 [PATCH] blockjob: Fix error message for negative speed Kevin Wolf
@ 2019-11-26 13:44 ` Alberto Garcia
  2019-12-17 13:34 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Alberto Garcia @ 2019-11-26 13:44 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: kwolf, qemu-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blockjob: Fix error message for negative speed
  2019-11-26 13:42 [PATCH] blockjob: Fix error message for negative speed Kevin Wolf
  2019-11-26 13:44 ` Alberto Garcia
@ 2019-12-17 13:34 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2019-12-17 13:34 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 599 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-17 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-26 13:42 [PATCH] blockjob: Fix error message for negative speed Kevin Wolf
2019-11-26 13:44 ` Alberto Garcia
2019-12-17 13:34 ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.