Bug 885380

Summary: virsh: blkdeviotune should take human readable values (like 1M)
Product: [Community] Virtualization Tools Reporter: Cole Robinson <crobinso>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mprivozn, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: LibvirtFirstBug
Fixed In Version: libvirt-1.3.5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-09 05:52:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Cole Robinson 2012-12-08 23:43:33 UTC
virsh blkdeviotune expects values in raw bytes, which is kinda inconvenient considering it's likely dealing with values at least over 1M. Hopefully not too difficult given that we've already got virScaleInteger().

There are probably other commands that could us a similar treatment.

Comment 1 Cole Robinson 2016-04-20 19:40:58 UTC
Basically all that needs to be done is convert the uses of vshCommandOptULongLong in virsh-domain.c:cmdBlkdeviotune to use vshCommandOptScaledInt

This shows the current IO tuning values for a running VM with target dev=vda in the XML:

$ sudo virsh blkdeviotune f23 vda
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 0
read_bytes_sec_max: 0
write_bytes_sec_max: 0
total_iops_sec_max: 0
read_iops_sec_max: 0
write_iops_sec_max: 0
size_iops_sec  : 0

You can set a value like:

  $ sudo virsh blkdeviotune f23 vda --read-iops-sec 1024

Then see the changed result with:

  $ sudo virsh blkdeviotune f23 vda | grep read_iops_sec
  read_iops_sec  : 1024
  read_iops_sec_max: 102

After the changes, you'll want to ensure all the opts can take values like --read-iops-sec 1M

Comment 2 Michal Privoznik 2016-05-09 05:52:58 UTC
I've just pushed fix upstream:

commit 161713436e00a8532be3d936eec095120b8c6a1a
Author:     Nishith Shah <nishithshah.2211>
AuthorDate: Wed May 4 14:25:10 2016 +0000
Commit:     Michal Privoznik <mprivozn>
CommitDate: Mon May 9 07:48:08 2016 +0200

    virsh: blkdeviotune: accept human readable values for bytes
    
    https://bugzilla.redhat.com/show_bug.cgi?id=885380
    
    Use vshCommandOptScaledInt instead of vshCommandOptULongLong so that
    values with suffixes can be passed when bytes are being passed along.
    Values for the iops parameters still need to be given in the absolute
    form as they are not bytes but numbers.
    
    Signed-off-by: Nishith Shah <nishithshah.2211>

v1.3.4-169-g1617134