[libvirt] [PATCH 3/5] virsh: Actually make blkdeviotune --group_name work

John Ferlan jferlan at redhat.com
Wed Jan 25 12:04:04 UTC 2017



On 01/25/2017 04:16 AM, Martin Kletzander wrote:
> Function vshCommandOptStringReq() returns -1 on error and 0 on
> success.  The code, however, used the 'group_name' variable only if it
> returned 1 (never).
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  tools/virsh-domain.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 

Ugh...

ACK

John

.
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 93587e8bc7c7..4360306989d8 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -1398,11 +1398,12 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
>      VSH_ADD_IOTUNE(write-iops-sec-max-length, WRITE_IOPS_SEC_MAX_LENGTH);
>  #undef VSH_ADD_IOTUNE
> 
> -    rv = vshCommandOptStringReq(ctl, cmd, "group_name", &group_name);
> -    if (rv < 0) {
> +    if (vshCommandOptStringReq(ctl, cmd, "group_name", &group_name) < 0) {
>          vshError(ctl, "%s", _("Unable to parse group parameter"));

^^ Ah.. remnant of my original thoughts - this was going to a "group #"
argument and a last minute change to use a string (of course that was
sometime in Sept/Oct for the v1 patches).  Still I cannot recall (now)
how I wouldn't have noticed this while testing.

>          goto cleanup;
> -    } else if (rv > 0) {
> +    }
> +
> +    if (group_name) {
>          if (virTypedParamsAddString(&params, &nparams, &maxparams,
>                                      VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME,
>                                      group_name) < 0)
> 




More information about the libvir-list mailing list