On Tue, Jun 16, 2015 at 18:43:32 +0800, Shanzhi Yu wrote: > The default value of the granularity is the image cluster size clamped > between 4096 and 65536. Libvirt should add a check for this otherwise > qemu will report error like below: > > $ virsh blockcopy r7 vda /var/lib/libvirt/images/r7.s1 --granularity 32 > error: internal error: unable to execute QEMU command 'drive-mirror': Parameter 'granularity' expects a value in range [512B, 64MB] This message seems descriptive enough to me ... > > Signed-off-by: Shanzhi Yu <shyu@xxxxxxxxxx> > --- > src/qemu/qemu_driver.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index d1f195c..0eca8ed 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -16990,6 +16990,10 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml, > virReportError(VIR_ERR_INVALID_ARG, "%s", > _("granularity must be power of 2")); > goto cleanup; > + } else if (param->value.ui > 65536 || param->value.ui < 4096) { This limits the block size to 4M - 64M, not the 512KiB to 64M. > + virReportError(VIR_ERR_INVALID_ARG, "%s", > + _("granularity expects value in range [4096 65536]")); > + goto cleanup; > } > granularity = param->value.ui; > } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_BUF_SIZE)) { At any rate, I think the error message is not exactly worth changing. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list