From nobody Tue Dec 16 03:20:01 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=1742512071; cv=none; d=zohomail.com; s=zohoarc; b=lyh9LoFDdpcmbURUn9SIYMw1++vDhc5qe3KSoIL4u7KOW05s3GpcqY8AmZYauCrF0PV2YincAbS3lBGC+fTTwAVQC7YEGpL7zepj53vslAjxtxGZx9QUwQyD7Z9XQZcvdcGLQSFvbI1IJ588rlnzk/lLPwsTs3Kbwb+KDBZshaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512071; 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=GE2QcWxOe0hwRo+KYXsHBoTKFqZ7aowq4n/9cMbC0vs=; b=hwDH/kdozUPx0SNUbTMr58EHsR0ItPlVeFcJmnf/qFnD1AwvVbHweqLYCOiKV5QE8mLB4Gilz6DXJRcitwkqqGL4fAGL7pqS6LGdjTZ8Mq+FOd0wYdX7kJcGswoU2k0QoE6uLOAqrwtYfEXsOq/+5deNHCN5eoAokoVNYSfcEoQ= 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 1742512071691743.9906174828603; Thu, 20 Mar 2025 16:07:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 02B531775; Thu, 20 Mar 2025 19:07:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B641915D5; Thu, 20 Mar 2025 19:07:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5607B159A; Thu, 20 Mar 2025 19:07:21 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 AA21115B0 for ; Thu, 20 Mar 2025 19:07:20 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-310-9XMI9pLWOk61M8gYnCG06g-1; Thu, 20 Mar 2025 19:07:19 -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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7650B196B356 for ; Thu, 20 Mar 2025 23:07:18 +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 B01721800370 for ; Thu, 20 Mar 2025 23:07:17 +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_H2, 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=1742512040; 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=H4P6hJ9448bdScC3WQkZGAYte3dqVayM6lpdUPbn6mw=; b=iiCVUmlcY24ITa2Ifmux0r7fi5zATCwfV0sepuc1mcdbI/fgjsDRUBti/22+owDQEphIgR B0m6+MRxFzSVOjXHIEC/gG86AVxcJ1r14YZxVYj7myCFdMWHjyhMG5fgTBhba7kTFJIVG4 G7Eza8IAI9X8o5Dg/VygdVRuPPihNAY= X-MC-Unique: 9XMI9pLWOk61M8gYnCG06g-1 X-Mimecast-MFC-AGG-ID: 9XMI9pLWOk61M8gYnCG06g_1742512038 To: devel@lists.libvirt.org Subject: [libvirt PATCH 1/6] tools: remove --parallel from virsh restore command Date: Fri, 21 Mar 2025 00:07:09 +0100 Message-ID: <7a90282bfd4bd655a8f9cb3ef5bc0e991028c7f8.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: _4_kKmOENDoqB62Uy60yw21aSNcK4B3-G27F0O3qxR0_1742512038 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HDBVOA4C4SJAPMP2FMGMEBOIF4P6QHPK X-Message-ID-Hash: HDBVOA4C4SJAPMP2FMGMEBOIF4P6QHPK 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: 1742512073341019000 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina There is no need to have --parallel and --parallel-channels especially when --parallel on its own is the same as not used at all. In both cases libvirt will default to single channel. Signed-off-by: Pavel Hrdina Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- docs/manpages/virsh.rst | 8 ++++---- tools/virsh-domain.c | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 8143366826..fede984e11 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4125,7 +4125,7 @@ restore :: =20 restore state-file [--bypass-cache] [--xml file] - [{--running | --paused}] [--reset-nvram] [--parallel] [--parallel-ch= annels] + [{--running | --paused}] [--reset-nvram] [--parallel-channels] =20 Restores a domain from a ``virsh save`` state file. See *save* for more in= fo. =20 @@ -4147,9 +4147,9 @@ domain should be started in. If *--reset-nvram* is specified, any existing NVRAM file will be deleted and re-initialized from its pristine template. =20 -*--parallel* option will cause the save data to be loaded using the number -of parallel IO channels specified with *--parallel-channels*. Parallel -channels will help speed up large restore operations. +*--parallel-channels* option can specify number of parallel IO channels +to be used when loading memory from file. Parallel save may significantly +reduce the time required to save large memory domains. =20 ``Note``: To avoid corrupting file system contents within the domain, you should not reuse the saved state file for a second ``restore`` unless you diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1bee969824..bb49860604 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5666,10 +5666,6 @@ static const vshCmdOptDef opts_restore[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("avoid file system cache when restoring") }, - {.name =3D "parallel", - .type =3D VSH_OT_BOOL, - .help =3D N_("enable parallel restore") - }, {.name =3D "parallel-channels", .type =3D VSH_OT_INT, .help =3D N_("number of IO channels to use for parallel restore") @@ -5706,13 +5702,11 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) virTypedParameterPtr params =3D NULL; int nparams =3D 0; int maxparams =3D 0; - int nchannels =3D 1; + int nchannels =3D 0; int rc; =20 if (vshCommandOptBool(cmd, "bypass-cache")) flags |=3D VIR_DOMAIN_SAVE_BYPASS_CACHE; - if (vshCommandOptBool(cmd, "parallel")) - flags |=3D VIR_DOMAIN_SAVE_PARALLEL; if (vshCommandOptBool(cmd, "running")) flags |=3D VIR_DOMAIN_SAVE_RUNNING; if (vshCommandOptBool(cmd, "paused")) @@ -5738,13 +5732,14 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0) return false; =20 - if (flags & VIR_DOMAIN_SAVE_PARALLEL) { - if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchan= nels)) < 0) - return false; - + if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels= )) < 0) + return false; + if (rc =3D=3D 1) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, = nchannels) < 0) return false; + + flags |=3D VIR_DOMAIN_SAVE_PARALLEL; } =20 if (flags || xml) { --=20 2.48.1 From nobody Tue Dec 16 03:20:01 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=1742512135; cv=none; d=zohomail.com; s=zohoarc; b=MYL7YSc+XnDeVbb8YXA8tN0OSi8mJtRaQJsPjqYZuyM0Gz7IvMCRtN5AQt68jly81Pi2Vv6YBCRm/pLaqvObM+VbTC9A54zHHDBmU+C2W/vAFbhkwT0s7ZtH1xzKxz4M7wAo/YbOtFLhOXabtwtCoxwh2NavvyVTq3iYoc4/Amk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512135; 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=jrKR+gg/JSn/ClUKW4uTL11DIL+iAxrA3WE2gpVe2js=; b=YSH9R2b6ZxHBqyDud0z6pupF6pxzXWGVQEz5lyIoxxxEJn1XQ5AFqi8tuX19SwqX+k1ZCjsKIrAga07ZFYGEjTH28iwcAYQv/ipmiOvVstLStJc9HPRu5qSDykNHj0wvMECeFEQPXsM3rut8mLyy53v1n2hOyzPUEKSEtcDOG08= 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 1742512135825576.152758932884; Thu, 20 Mar 2025 16:08:55 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3065417DE; Thu, 20 Mar 2025 19:08:55 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2572F1595; Thu, 20 Mar 2025 19:07:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 155D515B1; Thu, 20 Mar 2025 19:07:24 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 393781595 for ; Thu, 20 Mar 2025 19:07:23 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-408-xz4obZg9MjSVJZW8z4xeIA-1; Thu, 20 Mar 2025 19:07:20 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A6FF21903081 for ; Thu, 20 Mar 2025 23:07:19 +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 E5BB71828A96 for ; Thu, 20 Mar 2025 23:07:18 +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_H2, 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=1742512042; 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=ZK0oguvGirMLHdtT/PoK2xA6DIRP14mAKbsXlhhUtgE=; b=FVuNbiscQMBWQEH2Yj7cXmsi2Ncl2zwgt7bCiKKN/HiSPe9ij7043+i1ff3WuLVM3YAF8h cC+J9WfJWnsl3ckb5RNlk0Am+viybnTYPms23FkVeOqRKxYlKuc+Au6IDMEErDWwWtj5vp Tto8dV5mno686Ke2Q8Ost4dTkaYVCbA= X-MC-Unique: xz4obZg9MjSVJZW8z4xeIA-1 X-Mimecast-MFC-AGG-ID: xz4obZg9MjSVJZW8z4xeIA_1742512039 To: devel@lists.libvirt.org Subject: [libvirt PATCH 2/6] tools: remote --parallel from virsh save command Date: Fri, 21 Mar 2025 00:07:10 +0100 Message-ID: <8f6508e41f5abe7f31e3055323ff67889b30084a.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: Fwf_5YmHLAaLuOgd6dkTK0EF7d6QFygEhs_o0fI7Jno_1742512039 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FCFP4LD3WFIPOXSWAYJN2LAT4YPC4RXZ X-Message-ID-Hash: FCFP4LD3WFIPOXSWAYJN2LAT4YPC4RXZ 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: 1742512137979019000 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina There is no need to have --parallel and --parallel-channels especially when --parallel on its own is the same as not used at all. In both cases libvirt will default to single channel. Signed-off-by: Pavel Hrdina Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- docs/manpages/virsh.rst | 11 +++++------ tools/virsh-domain.c | 20 +++++++------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index fede984e11..65ec03cf20 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4179,7 +4179,7 @@ save :: =20 save domain state-file [--bypass-cache] [--xml file] - [--parallel] [--parallel-channels channels] + [--parallel-channels channels] [{--running | --paused}] [--verbose] =20 Saves a running domain (RAM, but not disk state) to a state file so that @@ -4213,11 +4213,10 @@ based on the state the domain was in when the save = was done; passing either the *--running* or *--paused* flag will allow overriding which state the ``restore`` should use. =20 -*--parallel* option will cause the save data to be written to file -over multiple parallel IO channels. The number of channels can be -specified using *--parallel-channels*. Using parallel IO channels -requires the use of ``sparse`` image save format. Parallel save may -significantly reduce the time required to save large memory domains. +*--parallel-channels* option can specify number of parallel IO channels +to be used when saving memory to file. Using parallel IO channels requires +the use of ``sparse`` image save format. Parallel save may significantly +reduce the time required to save large memory domains. =20 Domain saved state files assume that disk images will be unchanged between the creation and restore point. For a more complete system diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bb49860604..7adf6c16fa 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4530,13 +4530,9 @@ static const vshCmdOptDef opts_save[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("avoid file system cache when saving") }, - {.name =3D "parallel", - .type =3D VSH_OT_BOOL, - .help =3D N_("enable parallel save") - }, {.name =3D "parallel-channels", .type =3D VSH_OT_INT, - .help =3D N_("number of extra IO channels to use for parallel save") + .help =3D N_("number of IO channels to use for parallel save") }, {.name =3D "xml", .type =3D VSH_OT_STRING, @@ -4571,8 +4567,7 @@ doSave(void *opaque) virTypedParameterPtr params =3D NULL; int nparams =3D 0; int maxparams =3D 0; - int nchannels =3D 1; - int rv =3D -1; + int nchannels =3D 0; unsigned int flags =3D 0; const char *xmlfile =3D NULL; g_autofree char *xml =3D NULL; @@ -4592,8 +4587,6 @@ doSave(void *opaque) flags |=3D VIR_DOMAIN_SAVE_RUNNING; if (vshCommandOptBool(cmd, "paused")) flags |=3D VIR_DOMAIN_SAVE_PAUSED; - if (vshCommandOptBool(cmd, "parallel")) - flags |=3D VIR_DOMAIN_SAVE_PARALLEL; =20 if (vshCommandOptString(ctl, cmd, "file", &to) < 0) goto out; @@ -4602,13 +4595,14 @@ doSave(void *opaque) VIR_DOMAIN_SAVE_PARAM_FILE, to) < 0) goto out; =20 - if (flags & VIR_DOMAIN_SAVE_PARALLEL) { - if ((rv =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchan= nels)) < 0) - goto out; - + if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels= )) < 0) + goto out; + if (rc =3D=3D 1) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, = nchannels) < 0) goto out; + + flags |=3D VIR_DOMAIN_SAVE_PARALLEL; } =20 if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) --=20 2.48.1 From nobody Tue Dec 16 03:20:01 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=1742512113; cv=none; d=zohomail.com; s=zohoarc; b=LbIRn1YbGV3hwxnW8GwrOTpcoCRvxzGmBbfJQKa0T2aqVDvIxR4YN226QWEjlnYwlxJxi+JUAs1fhsRwREiaXHLIrCT33zY6QhyfdkywTFXTRKmuIDEbAARqMf4MvpV/0rb4FqBCG0yKOzO17cblpkImBl/E80Uduw7WlST+M4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512113; 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=p9+JK2XHMD5EwzteQARxhOx2nqK9flmrNki0LlQWPBg=; b=oHlbn4ItWBfRVyy+foBI9WF6P5tSO2lfA0rX59EqC5FYwJ2E0R7s8yyHzTes2ybAUXHDTJ/7ZQIk9uYk10fV8dkL16G2Sl5Bh1wmzC5ChftDkKV0owK6shc09Tf/OAhXWPd0Il2V/AP0zdZAs20WxxQGL+yhptF994KLScgBLQo= 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 1742512113555589.0833798966318; Thu, 20 Mar 2025 16:08:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F8F01780; Thu, 20 Mar 2025 19:08:32 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 41E161629; Thu, 20 Mar 2025 19:07:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F1DF615C5; Thu, 20 Mar 2025 19:07:23 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 6B3FD15B1 for ; Thu, 20 Mar 2025 19:07:23 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-140-T4X9oVkUNo6macSS4NUDvg-1; Thu, 20 Mar 2025 19:07:21 -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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22FE919560B1 for ; Thu, 20 Mar 2025 23:07:21 +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 3E15C1800370 for ; Thu, 20 Mar 2025 23:07:19 +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_H2, 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=1742512043; 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=urh7IDOpFNbNq4mgsdyqbMRDGF2GISVOXnu627sVso8=; b=YYq5CjvD84N404qskPvEIfJ+b5KMsJZGk+aWvai8HLg9bMRpH33MJ29BJ4FowmIa5GQs3x jdvoNgWZRlJMYxbW+zRsZiyaKRZjas8wqPxvwK5iSrH8vzakGA2lSSrED+ARCz74EewVdN +Gdk2Oz7QrCffgK4izdhhFcFgZMDX+E= X-MC-Unique: T4X9oVkUNo6macSS4NUDvg-1 X-Mimecast-MFC-AGG-ID: T4X9oVkUNo6macSS4NUDvg_1742512041 To: devel@lists.libvirt.org Subject: [libvirt PATCH 3/6] qemu: remove VIR_DOMAIN_SAVE_PARALLEL flag Date: Fri, 21 Mar 2025 00:07:11 +0100 Message-ID: <575aeb916b11df57307ab29cd54af4f10cf105f7.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: LzWtO6gpaT14RXCdSzaes19fWoKIKesavGyFgs-N7Pk_1742512041 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EPFPQTGDD6PHICSC3MFREBADCVNQVBK6 X-Message-ID-Hash: EPFPQTGDD6PHICSC3MFREBADCVNQVBK6 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: 1742512115987019100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina There is no need to use extra flag in addition to the new "parallel.channels" param. Using the flag without param would result in using uninitialized variable. Fixing it would result in error that parallel channels cannot be less then 1 or setting 1 as default. Using the param without the flag is ignored. Signed-off-by: Pavel Hrdina Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- include/libvirt/libvirt-domain.h | 1 - src/qemu/qemu_driver.c | 6 ++---- src/qemu/qemu_migration_params.c | 34 +++++++++++++++----------------- tools/virsh-domain.c | 22 ++++++++------------- 4 files changed, 26 insertions(+), 37 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 233bfd927a..6e11baa3d3 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1655,7 +1655,6 @@ typedef enum { VIR_DOMAIN_SAVE_RUNNING =3D 1 << 1, /* Favor running over paused = (Since: 0.9.5) */ VIR_DOMAIN_SAVE_PAUSED =3D 1 << 2, /* Favor paused over running = (Since: 0.9.5) */ VIR_DOMAIN_SAVE_RESET_NVRAM =3D 1 << 3, /* Re-initialize NVRAM from t= emplate (Since: 8.1.0) */ - VIR_DOMAIN_SAVE_PARALLEL =3D 1 << 4, /* Save and restore using par= allel channels (Since: 10.6.0) */ } virDomainSaveRestoreFlags; =20 int virDomainSave (virDomainPtr domain, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 21df94961b..3cf21380ed 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2822,8 +2822,7 @@ qemuDomainSaveParams(virDomainPtr dom, =20 virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE | VIR_DOMAIN_SAVE_RUNNING | - VIR_DOMAIN_SAVE_PAUSED | - VIR_DOMAIN_SAVE_PARALLEL, -1); + VIR_DOMAIN_SAVE_PAUSED, -1); =20 if (virTypedParamsValidate(params, nparams, VIR_DOMAIN_SAVE_PARAM_FILE, @@ -5762,8 +5761,7 @@ qemuDomainRestoreInternal(virConnectPtr conn, virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE | VIR_DOMAIN_SAVE_RUNNING | VIR_DOMAIN_SAVE_PAUSED | - VIR_DOMAIN_SAVE_RESET_NVRAM | - VIR_DOMAIN_SAVE_PARALLEL, -1); + VIR_DOMAIN_SAVE_RESET_NVRAM, -1); =20 if (flags & VIR_DOMAIN_SAVE_RESET_NVRAM) reset_nvram =3D true; diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index b696b0d13e..17d08f4aa5 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -803,11 +803,20 @@ qemuMigrationParamsForSave(virTypedParameterPtr param= s, unsigned int flags) { g_autoptr(qemuMigrationParams) saveParams =3D NULL; + int nchannels =3D 0; + int rv; =20 - if (flags & VIR_DOMAIN_SAVE_PARALLEL && !sparse) { + if ((rv =3D virTypedParamsGetInt(params, nparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, + &nchannels)) < 0) + return NULL; + + if (rv =3D=3D 1 && !sparse) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Parallel save is only supported with the 'sparse= ' save image format")); return NULL; + } else if (rv =3D=3D 0) { + nchannels =3D 1; } =20 if (!(saveParams =3D qemuMigrationParamsNew())) @@ -819,24 +828,13 @@ qemuMigrationParamsForSave(virTypedParameterPtr param= s, if (virBitmapSetBit(saveParams->caps, QEMU_MIGRATION_CAP_MULTIFD) = < 0) return NULL; =20 - if (flags & VIR_DOMAIN_SAVE_PARALLEL) { - int nchannels; - - if (params && virTypedParamsGetInt(params, nparams, - VIR_DOMAIN_SAVE_PARAM_PARAL= LEL_CHANNELS, - &nchannels) < 0) - return NULL; - - if (nchannels < 1) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("number of parallel save channels cannot = be less than 1")); - return NULL; - } - - saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].valu= e.i =3D nchannels; - } else { - saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].valu= e.i =3D 1; + if (nchannels < 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("number of parallel save channels cannot be less = than 1")); + return NULL; } + + saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].value.i = =3D nchannels; saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set =3D = true; =20 if (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) { diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7adf6c16fa..56ddf4d701 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4597,13 +4597,10 @@ doSave(void *opaque) =20 if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels= )) < 0) goto out; - if (rc =3D=3D 1) { - if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, = nchannels) < 0) - goto out; - - flags |=3D VIR_DOMAIN_SAVE_PARALLEL; - } + if (rc =3D=3D 1 && + virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, ncha= nnels) < 0) + goto out; =20 if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) goto out; @@ -5728,13 +5725,10 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) =20 if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels= )) < 0) return false; - if (rc =3D=3D 1) { - if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, = nchannels) < 0) - return false; - - flags |=3D VIR_DOMAIN_SAVE_PARALLEL; - } + if (rc =3D=3D 1 && + virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, ncha= nnels) < 0) + return false; =20 if (flags || xml) { rc =3D virDomainRestoreParams(priv->conn, params, nparams, flags); --=20 2.48.1 From nobody Tue Dec 16 03:20:01 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=1742512173; cv=none; d=zohomail.com; s=zohoarc; b=CLbVA5iR7MwpJ3fuaR5JhrCIrEEivqjEwARl9MnFOPWmC35/86ckNYPHx4+dssJjFEr1zHy8oWI2Zl8+pr9zmYoC9+/wsPd/Y0qRfGDarVug4I1ZzSwFpJikzwAp2/86NX8jirACRNhGkqwwmQCZeVFumJ6EDuQIpke8RxOAV2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512173; 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=z5vjQMUOLK0xGK3bBBFNjCnvr48SDrajBs6GTYCRycA=; b=N6NvfEciQ8+2HaNwhPb17w6Nu4wjQTgMo4zPmNzJloniD5U1VlIeAIUeASrHkOcw9578KZ59XpxCo31LrlJKjIDhm+GyeqZv1DlESIg6kfWZVewoG3reWleAn8h/XnGthHY1VDgmNUukEtWqKkU1KcJ81syOvlv9YD2m5KLFv2c= 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 1742512173398587.8188689893765; Thu, 20 Mar 2025 16:09:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6DFDB1823; Thu, 20 Mar 2025 19:09:32 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EEA091805; Thu, 20 Mar 2025 19:07:42 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E0458159A; Thu, 20 Mar 2025 19:07:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 371251738 for ; Thu, 20 Mar 2025 19:07:26 -0400 (EDT) Received: from mx-prod-mc-08.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-26-P1d0GSgCNguBGlfrdAfOIw-1; Thu, 20 Mar 2025 19:07:23 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A0A7180AF4D for ; Thu, 20 Mar 2025 23:07:22 +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 73E8D1800370 for ; Thu, 20 Mar 2025 23:07:21 +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_H2, 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=KnXh7E2SAwinkjYjoU3AoYsyonjMg6q0yA0t9G7iFyI=; b=K+BZjjQJ79UiLkVUKi/JnE4e7LMDevzukGuLGuiQdIN6/nKDXtKF8b7mHvQGcw/tsIrRsv a/QBaF8xVh7QcpH1/yEk/11TDhmrXYPd58kVdHCSuVkw/NXZT+JQFGn12dMPSjwV5vtMG9 rfF5u0X4VNdt6tbpDMDi0ajPl48Lv9g= X-MC-Unique: P1d0GSgCNguBGlfrdAfOIw-1 X-Mimecast-MFC-AGG-ID: P1d0GSgCNguBGlfrdAfOIw_1742512042 To: devel@lists.libvirt.org Subject: [libvirt PATCH 4/6] tools: use virDomainRestoreParams only when necessary Date: Fri, 21 Mar 2025 00:07:12 +0100 Message-ID: <30be1381a252d9fad88915357af2c0975e993c2f.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: czp4WnskCd-hjDlanbv-PtECSlbPChSKFhK8OXpN2Yo_1742512042 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FHNNFUAF5BAPMNYJW3AZUAMRVRBDP2TX X-Message-ID-Hash: FHNNFUAF5BAPMNYJW3AZUAMRVRBDP2TX 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: 1742512176145019100 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 Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- 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 56ddf4d701..c21cf847c8 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5707,10 +5707,6 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) =20 if (vshCommandOptString(ctl, cmd, "file", &from) < 0) return false; - if (from && - virTypedParamsAddString(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_FILE, from) < 0) - return false; =20 if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) return false; @@ -5718,10 +5714,6 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) if (xmlfile && virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0) return false; - if (xml && - virTypedParamsAddString(¶ms, &nparams, &maxparams, - VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0) - return false; =20 if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels= )) < 0) return false; @@ -5730,8 +5722,20 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, ncha= nnels) < 0) return false; =20 - if (flags || xml) { + if (nparams > 0) { + if (from && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_FILE, from) < 0) + return false; + + if (xml && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0) + return false; + rc =3D virDomainRestoreParams(priv->conn, params, nparams, flags); + } else if (flags || xml) { + rc =3D virDomainRestoreFlags(priv->conn, from, xml, flags); } else { rc =3D virDomainRestore(priv->conn, from); } --=20 2.48.1 From nobody Tue Dec 16 03:20:01 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 Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- 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 From nobody Tue Dec 16 03:20:01 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=1742512191; cv=none; d=zohomail.com; s=zohoarc; b=WbaJrG1EBS6JyccNB0pRFTmQtVsPtfrixpvGM5ZrKir6xn5uO20VzZpWts98eT+a5iUmgGtnfBVxYekDe0VuELsEfE5jyUoE0+WKg2+n5Nfvpp9JljxS2S4jWul139uxnIeGhkNObvKXHoL1Qrr/kfVtRDIQxCPFZVORQFtzk60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742512191; 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=t1t4BesMv7Znv19ivj9hRq1M8WvQV7ueYmNJ6P9DvRQ=; b=jdmcspXAGOCWmAwbocTJGFTY7id77LifLsDm8pUWa1+EK/yPnYegSJvXiKd08OW9EJ1ZJt2TiO27gOCswYaIJaHccn6oz6fstUhfv4K/0Qmp/YseFup2u7K1Jpxm9sPCsxSQgMDW7C+QdQUtcYfo/fMIuRyGjz+3aurGpZ5Nmdc= 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 1742512191096955.893858653753; Thu, 20 Mar 2025 16:09:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6F39E15F5; Thu, 20 Mar 2025 19:09:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C19F61642; Thu, 20 Mar 2025 19:07:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 50C6A179B; Thu, 20 Mar 2025 19:07:39 -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 3540617A5 for ; Thu, 20 Mar 2025 19:07:27 -0400 (EDT) Received: from mx-prod-mc-08.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-651-kNE9svqqOYWRwEFW--y4xA-1; Thu, 20 Mar 2025 19:07:25 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9B2E9180AF4C for ; Thu, 20 Mar 2025 23:07:24 +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 DB4991800370 for ; Thu, 20 Mar 2025 23:07:23 +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=1742512046; 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=iV2zhYDX/GLsXmYerrCmoquv/grWPnxqNKeGqXGBlgw=; b=VwrMau6ZFLJ4Ubd2JAzlyguUOSXnBkHNvXJfdEBVJnlzEsEzr9oyATzwvWgjHGb1SHI5hI n1l6V7AsaOIVDQA8i2mJrAHuWlyX3M9xGN71frBX7LzjCTg/YCpGwvhaEtA+C7uyIKz7IE tDWcv3OhGGEcNoo8LiatYijtaE7ZLDE= X-MC-Unique: kNE9svqqOYWRwEFW--y4xA-1 X-Mimecast-MFC-AGG-ID: kNE9svqqOYWRwEFW--y4xA_1742512044 To: devel@lists.libvirt.org Subject: [libvirt PATCH 6/6] virsh: add --image-format option to the save command Date: Fri, 21 Mar 2025 00:07:14 +0100 Message-ID: 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: 7CrnncturHxPZtZY6fIJQzO0BBHsh-IhJQbvPe5T7ow_1742512044 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ETAMFMXMBVALXW7OX3N4OT3R46LJLKYV X-Message-ID-Hash: ETAMFMXMBVALXW7OX3N4OT3R46LJLKYV 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: 1742512191894019000 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina Option --parallel-channels would require changing configuration file to be used so introduce this option as well to make it convenient for users. Signed-off-by: Pavel Hrdina Reviewed-by: Jim Fehlig Reviewed-by: Martin Kletzander --- docs/manpages/virsh.rst | 5 +++++ tools/virsh-domain.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 65ec03cf20..35ae6af547 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4179,6 +4179,7 @@ save :: =20 save domain state-file [--bypass-cache] [--xml file] + [--image-format format] [--parallel-channels channels] [{--running | --paused}] [--verbose] =20 @@ -4213,6 +4214,10 @@ based on the state the domain was in when the save w= as done; passing either the *--running* or *--paused* flag will allow overriding which state the ``restore`` should use. =20 +*--image-format* option can change the default image format used to +save data into file. For more details consult the qemu.conf configuration +file. + *--parallel-channels* option can specify number of parallel IO channels to be used when saving memory to file. Using parallel IO channels requires the use of ``sparse`` image save format. Parallel save may significantly diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 98f0e60ed4..ceff6789d8 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4534,6 +4534,10 @@ static const vshCmdOptDef opts_save[] =3D { .type =3D VSH_OT_INT, .help =3D N_("number of IO channels to use for parallel save") }, + {.name =3D "image-format", + .type =3D VSH_OT_STRING, + .help =3D N_("format of the save image file") + }, {.name =3D "xml", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, @@ -4570,6 +4574,7 @@ doSave(void *opaque) int nchannels =3D 0; unsigned int flags =3D 0; const char *xmlfile =3D NULL; + const char *format =3D NULL; g_autofree char *xml =3D NULL; int rc; #ifndef WIN32 @@ -4598,6 +4603,13 @@ doSave(void *opaque) VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, ncha= nnels) < 0) goto out; =20 + if (vshCommandOptString(ctl, cmd, "image-format", &format) < 0) + goto out; + if (format && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT, format= ) < 0) + goto out; + if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) goto out; =20 --=20 2.48.1