description of problem:
libvirt should check the --granularity value if it is power of 2
Version-Release number of selected component (if applicable):
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
qemu report error instead libvirt
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.
send a patch to upstream:
I've pushed the patch upstream:
Author: Luyao Huang <firstname.lastname@example.org>
AuthorDate: Fri Mar 27 17:56:30 2015 +0800
Commit: Michal Privoznik <email@example.com>
CommitDate: Thu Apr 2 11:12:01 2015 +0200
qemuDomainBlockCopy: Check @granularity to be a power of two
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 <firstname.lastname@example.org>
Signed-off-by: Michal Privoznik <email@example.com>
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.
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.