Bug 1288000 - Virsh lacks support for the scale (MiB/s OR Bytes/s) for block job bandwidth
Summary: Virsh lacks support for the scale (MiB/s OR Bytes/s) for block job bandwidth
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-03 09:48 UTC by Yang Yang
Modified: 2016-11-03 18:34 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.3.3-1.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:34:48 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Yang Yang 2015-12-03 09:48:01 UTC
Description of problem:
Libvirt is already updated to use a flags value "VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES" to decide whether to use bytes/s instead of the back-compat MiB/s. However, virsh has not been updated to cover the change

Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7_2.2.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Do commit specifying bandwidth
# virsh blockcommit vm1 vda --wait --verbose --active --bandwidth 1
Block commit: [100 %]
Now in synchronized phase

2. Check the bandwith
# virsh blockjob vm1 vda
Active Block Commit: [100 %]    Bandwidth limit: 1048576 bytes/s (1.000 MiB/s)

3.

Actual results:
bandwidth always uses MiB/s, user cannot specify Bytes/s

Expected results:


Additional info:

Comment 2 Peter Krempa 2016-03-29 14:06:36 UTC
Feature added upstream:

commit d40d18fb8f09aabc08861ad573c40727e7d475dd
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Mar 17 13:41:00 2016 +0100

    virsh: blockpull: Support --bytes and scaled integers
    
    Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
    allow users to specify bandwidth in bytes or as a scaled integer.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1288000

commit 453a6d8092d555011b46abcae44ec3c37122562d
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Mar 17 13:40:30 2016 +0100

    virsh: blockcopy: Support --bytes and scaled integers
    
    Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
    allow users to specify bandwidth in bytes or as a scaled integer.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1288000

commit e557bd28a269bd31ab45a57534b348ab1e1b52fd
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Mar 17 13:40:04 2016 +0100

    virsh: blockcommit: Support --bytes and scaled integers
    
    Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
    allow users to specify bandwidth in bytes or as a scaled integer.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1288000

commit e54b5484c972308ec0f6e3d79f3016437905ebf8
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Tue Mar 29 15:52:10 2016 +0200

    virsh: blockjob: Support --bytes and scaled integers as bandwidth
    
    Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
    allow users to specify bandwidth in bytes or as a scaled integer.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1288000

Comment 4 Han Han 2016-04-28 08:58:53 UTC
Verified on libvirt-1.3.3-2.el7.x86_64, qemu-kvm-rhev-2.5.0-4.el7.x86_64
Prepare 3 running VMs: copy,commit,pull
Running following scripts:
...
#!/bin/bash 
DOM_COMMIT=commit
IP_COMMIT=192.168.122.200
DOM_COPY=copy
IP_COPY=192.168.122.215
DOM_PULL=pull
IP_PULL=192.168.122.74

for i in $DOM_COMMIT $DOM_PULL $DOM_COPY; do
    virsh snapshot-create-as $i s1 --disk-only
done

for i in $IP_PULL $IP_COPY $IP_COMMIT; do
    ssh root@$i dd if=/dev/urandom of=~/file count=9 bs=100M
done

virsh blockcopy $DOM_COPY vda /var/lib/libvirt/images/$DOM_COPY-copy.qcow2 --bytes 511 --pivot &
virsh blockcommit $DOM_COMMIT vda --active --bytes 512 &
virsh blockpull $DOM_PULL vda --bytes 513 &
sleep 5
# check speed in blockjob
for i in $DOM_COPY $DOM_COMMIT $DOM_PULL;do
    echo "the speed of vm $i on blockjob is:"
    virsh blockjob $i vda --info --bytes
done >> result
systemctl stop libvirtd
# check speed in qmp-shell
for i in $DOM_COPY $DOM_COMMIT $DOM_PULL; do
    echo "the speed of vm $i on qmp-shell is:"
    ~/qemu/scripts/qmp/qmp-shell /var/lib/libvirt/qemu/domain-*-$i/monitor.sock <<EOF | grep '(QEMU)'
    query-block-jobs
EOF
done >> result
systemctl restart libvirtd
...
The result:
# cat result 
the speed of vm copy on blockjob is:
    Bandwidth limit: 511 bytes/s (511.000 B/s)

the speed of vm commit on blockjob is:
    Bandwidth limit: 512 bytes/s (512.000 B/s)

the speed of vm pull on blockjob is:
    Bandwidth limit: 513 bytes/s (513.000 B/s)

the speed of vm copy on qmp-shell is:
(QEMU) {"return": [{"busy": false, "type": "mirror", "len": 2387214336, "paused": false, "ready": false, "io-status": "ok", "offset": 7340032, "device": "drive-virtio-disk0", "speed": 511}]}
(QEMU) 
the speed of vm commit on qmp-shell is:
(QEMU) {"return": [{"busy": false, "type": "commit", "len": 947388416, "paused": false, "ready": false, "io-status": "ok", "offset": 7602176, "device": "drive-virtio-disk0", "speed": 512}]}
(QEMU) 
the speed of vm pull on qmp-shell is:
(QEMU) {"return": [{"busy": false, "type": "stream", "len": 3221225472, "paused": false, "ready": false, "io-status": "ok", "offset": 30146560, "device": "drive-virtio-disk0", "speed": 513}]}
(QEMU)

The blockjob info results are the same with qmp-shell results. Bug fixed.

Comment 6 errata-xmlrpc 2016-11-03 18:34:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2577.html


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