Bug 885380 - virsh: blkdeviotune should take human readable values (like 1M)
Summary: virsh: blkdeviotune should take human readable values (like 1M)
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard: LibvirtFirstBug
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-08 23:43 UTC by Cole Robinson
Modified: 2016-05-09 05:52 UTC (History)
2 users (show)

Fixed In Version: libvirt-1.3.5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-09 05:52:58 UTC
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.