From: Pavel Hrdina Date: Thu, 20 Mar 2025 22:32:17 +0000 (+0100) Subject: tools: use virDomainSaveParams only when necessary X-Git-Tag: v11.2.0-rc1~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=73cf89e8f2bb00e65b709ce86e0631a34b730138;p=thirdparty%2Flibvirt.git tools: use virDomainSaveParams only when necessary We should use the newest API only when user sets parallel-channels. Signed-off-by: Pavel Hrdina Reviewed-by: Jim Fehlig --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c21cf847c8..98f0e60ed4 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4590,10 +4590,6 @@ doSave(void *opaque) if (vshCommandOptString(ctl, cmd, "file", &to) < 0) goto out; - if (to && - virTypedParamsAddString(¶ms, &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(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0) - goto out; - if (flags || xml) { + if (nparams > 0) { + if (to && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_FILE, to) < 0) + goto out; + + if (xml && + virTypedParamsAddString(¶ms, &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); }