diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 80a21d86cf..6132674168 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16866,6 +16866,11 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml, } bandwidth = param->value.ul; } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_GRANULARITY)) { + if (param->value.ui != VIR_ROUND_UP_POWER_OF_TWO(param->value.ui)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("granularity must be power of 2")); + goto cleanup; + } granularity = param->value.ui; } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_BUF_SIZE)) { buf_size = param->value.ul; diff --git a/tools/virsh.pod b/tools/virsh.pod index 63325ffd73..5d52761ede 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1039,10 +1039,10 @@ unlimited, but more likely would overflow; it is safer to use 0 for that purpose. Specifying I allows fine-tuning of the granularity that will be copied when a dirty region is detected; larger values trigger less I/O overhead but may end up copying more data overall (the default value is -usually correct); this value must be a power of two. Specifying I -will control how much data can be simultaneously in-flight during the copy; -larger values use more memory but may allow faster completion (the default -value is usually correct). +usually correct); hypervisors may restrict this to be a power of two or fall +within a certain range. Specifying I will control how much data can +be simultaneously in-flight during the copy; larger values use more memory but +may allow faster completion (the default value is usually correct). =item B I I [I] [I] [I<--wait> [I<--verbose>] [I<--timeout> B] [I<--async>]]