1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-30 18:50:18 +03:00

tools: use virDomainSaveParams only when necessary

We should use the newest API only when user sets parallel-channels.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Pavel Hrdina 2025-03-20 23:32:17 +01:00
parent b982583d92
commit 73cf89e8f2

View File

@ -4590,10 +4590,6 @@ doSave(void *opaque)
if (vshCommandOptString(ctl, cmd, "file", &to) < 0)
goto out;
if (to &&
virTypedParamsAddString(&params, &nparams, &maxparams,
VIR_DOMAIN_SAVE_PARAM_FILE, to) < 0)
goto out;
if ((rc = vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels)) < 0)
goto out;
@ -4613,13 +4609,21 @@ doSave(void *opaque)
vshReportError(ctl);
goto out;
}
if (xml &&
virTypedParamsAddString(&params, &nparams, &maxparams,
VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0)
goto out;
if (flags || xml) {
if (nparams > 0) {
if (to &&
virTypedParamsAddString(&params, &nparams, &maxparams,
VIR_DOMAIN_SAVE_PARAM_FILE, to) < 0)
goto out;
if (xml &&
virTypedParamsAddString(&params, &nparams, &maxparams,
VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0)
goto out;
rc = virDomainSaveParams(dom, params, nparams, flags);
} else if (flags || xml) {
rc = virDomainSaveFlags(dom, to, xml, flags);
} else {
rc = virDomainSave(dom, to);
}