[libvirt] [PATCH] Allow blkdeviotune to take human readable values

Peter Krempa pkrempa at redhat.com
Tue May 3 14:30:19 UTC 2016


On Tue, May 03, 2016 at 14:09:42 +0000, Nishith Shah wrote:
> Use vshCommandOptScaledInt instead of vshCommandOptULongLong so there is
> no need to pass values in raw bytes, which is seldom the case.

A change like this is incomplete without adding documentation to the
virsh man page (tools/virsh.pod) and in the help strings that document
the individual arguments in the source file.

> ---
>  tools/virsh-domain.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 0a6caae..3843675 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c

[...]

> @@ -1353,7 +1353,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
>              goto save_error;
>      }
>  
> -    if ((rv = vshCommandOptULongLong(ctl, cmd, "total-iops-sec", &value)) < 0) {
> +    if ((rv = vshCommandOptScaledInt(ctl, cmd, "total-iops-sec", &value, 1, ULLONG_MAX)) < 0) {

iops is a count rather than a byte size so i don't think the default
scaling function is a good fit since:

kiB -> 1024
KB -> 1000
k -> 1024

>          goto interror;
>      } else if (rv > 0) {
>          if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160503/242a345f/attachment-0001.sig>


More information about the libvir-list mailing list