From nobody Tue Dec 16 11:45:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1742512157; cv=none; d=zohomail.com; s=zohoarc; b=ZpiIBzf7vecvLyz8cwmoeVlhTt09eebseDtX2Lu62uxpgLQf99b8XYD7eeqtlqcoRIhVk7+cLyOIe02d83wevo/eUOEAyWUTq4l1niTZvmKiW3qd5X/XqrcikIzIwAZykC/PTcKnGj5gk1k5MSK5kuR6mZodMlUaXpTaoBDWndo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512157; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=1+/vltEfdVq2mPb4Qt0Jt8POqldOWLjZO4nWO9v8apc=; b=ZCpBU9panQOyaWkP9Ndb536yiNXHeIOmBReoq1cyPOE9CU6xS0WHqvQpMRkfov2fgNxno3GoD1iZEyzU9vNl8RNMYrPyUi7ApFc19uLUJuMCXExQRfeGKvnBpenXX441n/ZMqqy4ozH1acjn124MqMWA01cnHEUzFFcK7F5tBRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1742512157743330.3404202392345; Thu, 20 Mar 2025 16:09:17 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A20A91810; Thu, 20 Mar 2025 19:09:16 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3B33617B2; Thu, 20 Mar 2025 19:07:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F232B1736; Thu, 20 Mar 2025 19:07:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E23AD1734 for ; Thu, 20 Mar 2025 19:07:25 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-kHZ1ikNdNVKHAWkPYuOaeQ-1; Thu, 20 Mar 2025 19:07:24 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 69A581800A34 for ; Thu, 20 Mar 2025 23:07:23 +0000 (UTC) Received: from antique-work.lan (unknown [10.45.226.90]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AB0D7180174E for ; Thu, 20 Mar 2025 23:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742512045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PPytH6lUzHf/j2WwVzCI7cineYox6wAch7M38CGVNrI=; b=RWgp+XirTWQ/bMmbD7aPCGRs8s/7g9GE51nCVGzHZQKy8g2WqVPM0o2KRbNMy9kgV7zvbx n4IuDyGJoxl8e9ZWoSOELieEUDL9/3iYGq4YPFFMgDVqwjcxljCG9Acc37YR46TbfxLAN6 NIT1YqHtMx/U2Rp+CkXtBDuCp/5db2s= X-MC-Unique: kHZ1ikNdNVKHAWkPYuOaeQ-1 X-Mimecast-MFC-AGG-ID: kHZ1ikNdNVKHAWkPYuOaeQ_1742512043 To: devel@lists.libvirt.org Subject: [libvirt PATCH 5/6] tools: use virDomainSaveParams only when necessary Date: Fri, 21 Mar 2025 00:07:13 +0100 Message-ID: <93021f95ef785bc3d29699ef932857fe64813376.1742511952.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ALQQS87pApVpLKX-Va5pq_EGkIFCHxj7Aga_m7VorqE_1742512043 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SZYJ3JKHUCCLPWDFPQSSXJ42SYBAIHQT X-Message-ID-Hash: SZYJ3JKHUCCLPWDFPQSSXJ42SYBAIHQT X-MailFrom: phrdina@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Pavel Hrdina via Devel Reply-To: Pavel Hrdina X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1742512160132019100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina We should use the newest API only when user sets parallel-channels. Signed-off-by: Pavel Hrdina --- 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) =20 if (vshCommandOptString(ctl, cmd, "file", &to) < 0) goto out; - if (to && - virTypedParamsAddString(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_FILE, to) < 0) - goto out; =20 if ((rc =3D 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; =20 - 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 =3D virDomainSaveParams(dom, params, nparams, flags); + } else if (flags || xml) { + rc =3D virDomainSaveFlags(dom, to, xml, flags); } else { rc =3D virDomainSave(dom, to); } --=20 2.48.1