Bug 1206479 - libvirt should check the --granularity value if it is power of 2
Summary: libvirt should check the --granularity value if it is power of 2
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
low
low
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-27 08:59 UTC by Luyao Huang
Modified: 2015-11-19 06:25 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.15-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:25:46 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-03-27 08:59:02 UTC
description of problem:
libvirt should check the --granularity value if it is power of 2

Version-Release number of selected component (if applicable):
libvirt-1.2.13-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.# virsh blockcopy --help
...
    --granularity <number>  power-of-two granularity to use during the copy
    --buf-size <number>  maximum amount of in-flight data during the copy
...
 
2.prepare a transient vm and do blockcopy
# virsh blockcopy test3 hda --xml gluster.xml --granularity 513
error: internal error: unable to execute QEMU command 'drive-mirror': Parameter 'granularity' expects power of 2

Actual results:
qemu report error instead libvirt

Expected results:
we already know this value should be power of 2, i think libvirt should check the --granularity value if it is power of 2, and output error early.


Additional info:

Comment 1 Luyao Huang 2015-03-27 09:59:51 UTC
send a patch to upstream:

http://www.redhat.com/archives/libvir-list/2015-March/msg01429.html

Comment 2 Michal Privoznik 2015-04-02 10:39:40 UTC
I've pushed the patch upstream:

commit 20aca080f37b9f4ca23df8d210400a1f05390c86
Author:     Luyao Huang <lhuang@redhat.com>
AuthorDate: Fri Mar 27 17:56:30 2015 +0800
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Thu Apr 2 11:12:01 2015 +0200

    qemuDomainBlockCopy: Check @granularity to be a power of two
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1206479
    
    As described in virDomainBlockCopy() parameters description, the
    VIR_DOMAIN_BLOCK_COPY_GRANULARITY parameter may require the value to
    have some specific attributes (e.g. be a power of two or fall within a
    certain range). And in qemu, a power of two is required. However, our
    code does not check that and let qemu operation fail. Moreover, the
    virsh man page is not as exact as it could be in this respect.
    
    Signed-off-by: Luyao Huang <lhuang@redhat.com>
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

v1.2.14-22-g20aca08

Comment 4 Shanzhi Yu 2015-06-16 10:47:03 UTC
We should also add check if the value of granularity is between 4096 and 65536. But it doesn't matter much, so I'd change this bug to verified status after test with libvirt-1.2.16-1.el7.x86_64.

Comment 6 errata-xmlrpc 2015-11-19 06:25:46 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/RHBA-2015-2202.html


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