blockdev: fix drive-mirror 'granularity' error message
PATCH 1/1 blockdev: fix drive-mirror 'granularity' error message
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.
--- blockdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
blockdev.c +3 -2
@@ -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 ; }
Signature · 1 line
1.9.3
Quoted 2 lines · Stefan Hajnoczi
Name the 'granularity' parameter and give its expected value range. Previously the device name was mistakingly reported as the parameter
s/mistakingly/mistakenly/
Quoted 9 lines
name.
Note that the error class is unchanged from
ERROR_CLASS_GENERIC_ERROR.Reported-by Eric Blake <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- 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:
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 2 lines · Eric Blake
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
Quoted 1 line · Eric Blake
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
Quoted 4 lines · Stefan Hajnoczi
Quoted 1 line · Eric Blake
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.
Quoted 3 lines
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.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 35 lines · Stefan Hajnoczi
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 <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- blockdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)blockdev.c +3
-2@@ -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 ; }Signature · 1 line
1.9.3
Stefan Hajnoczi
AppliedQuoted 11 lines · Stefan Hajnoczi
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 <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- 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