
On Thu, Sep 11, 2025 at 18:27:43 +0300, Nikolai Barybin via Devel wrote:
Parse params list and pass arguments to underlying call to qemuDomainBlockPullCommon.
Now bandwidth unit of messurement is passed as param and passed further with a use of VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES flag. virDomainBlockRebase2 doesn't use equavivalent external flag.
This still mentions the old API
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com> --- src/qemu/qemu_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ac72ea5cb0..0b7791aded 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14634,6 +14634,53 @@ qemuDomainBlockRebase(virDomainPtr dom, return ret; }
+static int +qemuDomainBlockRebaseParams(virDomainPtr dom, + const char *path, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virDomainObj *vm; + size_t i = 0; + unsigned long long bandwidth = 0; + const char *base = NULL; + + virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_PARAMS_RELATIVE, -1); + + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_BYTES, + VIR_TYPED_PARAM_ULLONG, + NULL) < 0) + return -1; + + if (!(vm = qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainBlockRebaseParamsEnsureACL(dom->conn, vm->def) < 0) + return -1; + + for (i = 0; i < nparams; i++) { + virTypedParameterPtr param = ¶ms[i]; + + if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB)) { + bandwidth = param->value.ul; + } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_BYTES)) { + bandwidth = param->value.ul; + flags |= VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES; + } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE)) { + base = param->value.s; + } + } + + return qemuDomainBlockPullCommon(vm, path, base, bandwidth, flags);
You're doing the implementation backwards if you want to later extend this API via new parameters. In migration code the old APIs create a list of parameters based on the old API and pass it to a refactored new API.