From: Pavel Hrdina <phrdina(a)redhat.com>
We should use the newest API only when user sets parallel-channels.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tools/virsh-domain.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
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);
}
--
2.48.1