qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
@ 2014-08-27 13:29 Stefan Hajnoczi
  2014-08-27 13:33 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-08-27 13:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster, Stefan Hajnoczi, Luiz Capitulino

Name the 'granularity' parameter and give its expected value range.
Previously the device name was mistakingly reported as the parameter
name.

Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 blockdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 6a204c6..eeb414e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2179,11 +2179,12 @@ void qmp_drive_mirror(const char *device, const char *target,
     }
 
     if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
-        error_set(errp, QERR_INVALID_PARAMETER, device);
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
+                  "a value in range [512B, 64MB]");
         return;
     }
     if (granularity & (granularity - 1)) {
-        error_set(errp, QERR_INVALID_PARAMETER, device);
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
         return;
     }
 
-- 
1.9.3

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-27 13:29 [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message Stefan Hajnoczi
@ 2014-08-27 13:33 ` Eric Blake
  2014-08-28 12:29   ` Stefan Hajnoczi
  2014-08-28 12:31   ` Stefan Hajnoczi
  2014-08-27 14:12 ` Benoît Canet
  2014-08-28 12:28 ` Stefan Hajnoczi
  2 siblings, 2 replies; 7+ messages in thread
From: Eric Blake @ 2014-08-27 13:33 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Markus Armbruster, Luiz Capitulino

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

On 08/27/2014 07:29 AM, Stefan Hajnoczi wrote:
> Name the 'granularity' parameter and give its expected value range.
> Previously the device name was mistakingly reported as the parameter

s/mistakingly/mistakenly/

> name.
> 
> Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  blockdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

buf-size has the same bug a few lines later; might as well fix both at once.

But what you have is a strict improvement, so depending on whether you
do a v2 to fix buf-size, vs. do a followup patch, you could add:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-27 13:29 [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message Stefan Hajnoczi
  2014-08-27 13:33 ` Eric Blake
@ 2014-08-27 14:12 ` Benoît Canet
  2014-08-28 12:28 ` Stefan Hajnoczi
  2 siblings, 0 replies; 7+ messages in thread
From: Benoît Canet @ 2014-08-27 14:12 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Luiz Capitulino, qemu-devel, Markus Armbruster

The Wednesday 27 Aug 2014 à 14:29:59 (+0100), Stefan Hajnoczi wrote :
> Name the 'granularity' parameter and give its expected value range.
> Previously the device name was mistakingly reported as the parameter
> name.
> 
> Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  blockdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 6a204c6..eeb414e 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2179,11 +2179,12 @@ void qmp_drive_mirror(const char *device, const char *target,
>      }
>  
>      if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
> -        error_set(errp, QERR_INVALID_PARAMETER, device);
> +        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
> +                  "a value in range [512B, 64MB]");
>          return;
>      }
>      if (granularity & (granularity - 1)) {
> -        error_set(errp, QERR_INVALID_PARAMETER, device);
> +        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
>          return;
>      }
>  
> -- 
> 1.9.3
> 
> 
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-27 13:29 [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message Stefan Hajnoczi
  2014-08-27 13:33 ` Eric Blake
  2014-08-27 14:12 ` Benoît Canet
@ 2014-08-28 12:28 ` Stefan Hajnoczi
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-08-28 12:28 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Luiz Capitulino, qemu-devel, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

On Wed, Aug 27, 2014 at 02:29:59PM +0100, Stefan Hajnoczi wrote:
> Name the 'granularity' parameter and give its expected value range.
> Previously the device name was mistakingly reported as the parameter
> name.
> 
> Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  blockdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Fixed "mistakingly" -> "mistakenly" spelling error while merging.

Applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-27 13:33 ` Eric Blake
@ 2014-08-28 12:29   ` Stefan Hajnoczi
  2014-08-28 12:31   ` Stefan Hajnoczi
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-08-28 12:29 UTC (permalink / raw)
  To: Eric Blake
  Cc: Luiz Capitulino, qemu-devel, Stefan Hajnoczi, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

On Wed, Aug 27, 2014 at 07:33:13AM -0600, Eric Blake wrote:
> But what you have is a strict improvement, so depending on whether you
> do a v2 to fix buf-size, vs. do a followup patch, you could add:

Thanks, I will send a follow-up.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-27 13:33 ` Eric Blake
  2014-08-28 12:29   ` Stefan Hajnoczi
@ 2014-08-28 12:31   ` Stefan Hajnoczi
  2014-08-28 12:39     ` Eric Blake
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-08-28 12:31 UTC (permalink / raw)
  To: Eric Blake
  Cc: Luiz Capitulino, qemu-devel, Stefan Hajnoczi, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On Wed, Aug 27, 2014 at 07:33:13AM -0600, Eric Blake wrote:
> buf-size has the same bug a few lines later; might as well fix both at once.

Hmm...which git tree are you looking at?

I don't see any error paths for buf_size:
http://git.qemu-project.org/?p=qemu.git;a=blob;f=blockdev.c;h=6a204c662d4b648c78a379f5b8e8120254dde479;hb=HEAD#l2140

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message
  2014-08-28 12:31   ` Stefan Hajnoczi
@ 2014-08-28 12:39     ` Eric Blake
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Blake @ 2014-08-28 12:39 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Luiz Capitulino, qemu-devel, Stefan Hajnoczi, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

On 08/28/2014 06:31 AM, Stefan Hajnoczi wrote:
> On Wed, Aug 27, 2014 at 07:33:13AM -0600, Eric Blake wrote:
>> buf-size has the same bug a few lines later; might as well fix both at once.
> 
> Hmm...which git tree are you looking at?

Serves me right for going off of a 'git grep' rather than actually
looking at the source.

> 
> I don't see any error paths for buf_size:
> http://git.qemu-project.org/?p=qemu.git;a=blob;f=blockdev.c;h=6a204c662d4b648c78a379f5b8e8120254dde479;hb=HEAD#l2140

I _knew_ I had seen two violations:

blockdev.c:2175:        error_set(errp, QERR_INVALID_PARAMETER, device);
blockdev.c:2179:        error_set(errp, QERR_INVALID_PARAMETER, device);

but based on that grep, I then _assumed_ that it was for two variables
(hence my claim of granularity vs. buf_size).  But as your patch fixes
both violations, both related to "granularity", you are correct.  Sorry
for spreading confusion.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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

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

end of thread, other threads:[~2014-08-28 12:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 13:29 [Qemu-devel] [PATCH] blockdev: fix drive-mirror 'granularity' error message Stefan Hajnoczi
2014-08-27 13:33 ` Eric Blake
2014-08-28 12:29   ` Stefan Hajnoczi
2014-08-28 12:31   ` Stefan Hajnoczi
2014-08-28 12:39     ` Eric Blake
2014-08-27 14:12 ` Benoît Canet
2014-08-28 12:28 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).