From nobody Fri Dec 19 20:18:28 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=1738954029; cv=none; d=zohomail.com; s=zohoarc; b=dR6er6A4hbC1MGU58V6+RNbQpfI4EHtUHCNGKZ5zFXarQ3oSrWBJdWx0VD8imMj6dF62tORnAZIaflmFza0OusoEV+bZZt3jtcO+68mRGTPWRjGhgCxVaaQnNdTCWtrSD0Q48qOoAjtCl4ovppo+HwqBecFSHjzlY/uIePnojeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738954029; h=Content-Transfer-Encoding:Cc:Cc: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; bh=Jti9dNX/G/ldaL2dgTeNz3m3CY1jr1kpiS+blG1iHus=; b=Av3zC2Z6riRpQMrWZdFArTHm+7VPCp+km15qHJjFMuctXVnw9VqEhRTS3I9IqGW5Ab5AIpVnpv/HXCdbAcfbC+jVDzC2pFAkLezg63DoI7F1C0YItB+QR5bZHgYRhIYb2Zy+gBoLPrxr++5BrAUi7cuUPVYkkvzIboSkBK8/+3g= 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 1738954029076532.5649664947633; Fri, 7 Feb 2025 10:47:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 05F1F1273; Fri, 7 Feb 2025 13:47:08 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3EF90188E; Fri, 7 Feb 2025 13:38:45 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9ABBB1526; Fri, 7 Feb 2025 13:38:39 -0500 (EST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 5156815ED for ; Fri, 7 Feb 2025 13:38:16 -0500 (EST) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-38dd14c99c3so146799f8f.3 for ; Fri, 07 Feb 2025 10:38:16 -0800 (PST) Received: from localhost (205-201-32-8.scinternet.net. [205.201.32.8]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-73048e20bcdsm3414858b3a.178.2025.02.07.10.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 10:38:14 -0800 (PST) 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=suse.com; s=google; t=1738953495; x=1739558295; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ed2LrTcoreB0iykXumDt4Bm22zKg73qT+e9imTPqhTA=; b=Zt8DDcvA6H0J3TA4annUrhgEbjVtzHKGR2vV36R0a3i+ciS8zC4YXZoBdjBDwuFrMl GbtywtByO9JFzFmya2R4FpMGGlYxXFJzbaosESDT4Gv54yISU/H8YWrwKjEtAQlr9gLk BOL2pkvIqhyGHim6DIbn5fOwKAY2T3CSVIBafdFsEZsL6K8rxUalPPXHHbQ/vlKj89yl jzswOlVHcgxwh0DpWdmYQlj6JScAWQZBrAklQCb6mI63nbAeT3CeAsSLrhkomEsEyA8/ QLscurdXNr8Wo6AoeWz5feLoN05jE6jHatQN05NUaNVGw9tA+zPsApwN4tETHnAw7LXI VJrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738953495; x=1739558295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ed2LrTcoreB0iykXumDt4Bm22zKg73qT+e9imTPqhTA=; b=xSkipfXk+rJZLbcRD+SDXJbovLTaRkKa6ukENgIDOuqdSZC1E+WVunOhvPZS9qe27Q jNeYjMWVXfcI83TdO1lPxwXYNAIjO8dZ1URXXjtywlJ9785z9AQZ+NiHayQ8QITM4Grj JnSgnswekp6P9dYkWrmtSl3Ids5F8H7uNLLST8I5NOrMc5tzg9nzNALjK8zaxcHeRptw G+8TR4JtTffu9+OPG6D6yA6LwQmjTO/VMgq2ezWX1YnY78attpVDJjfGvEWztcWPTI7S 6Yqu9WDQI4WK2+OR77dNGBHGYeLtmYgpiVxynlldlZLu/0UxZnljUx4e60B2QD1t3hS2 y9Jg== X-Gm-Message-State: AOJu0YzxHyFO+cnAHqVHjutRCHu8cUkTLix4/W6VYM5JDw3ANm0teRHz wi1KHG2U49CsiGWNazyofJoCStSTTKRPGc2QI5VNLNtIcmu5zSFOwzGzoJU63zWNN99iLrhAs+j z X-Gm-Gg: ASbGncsHyHiaJDZkl3ipw/vXPGE6h6Z+jHUWsY6U5r6553McN6QvaMmR3SJDNkzUb6M iyTnNpcLb2N1fZt+hyvH8vpuMogrRkmKFtzH/u729fEYKaOXx3elJTHBlTUnuuv9JFApKZavJ2z eBli+5qPj8OPa85gxXBGEdTbmeQaeteN1YHTCMlaKSgXSDYnQEgikla1cnWCPbnhwPBiyFGaJOs bEdyE4wqZmSUIlWl5l2m3IUsl+Mz4IIE0fERjGV0pGpuy7cP7ejMTshjOw9+07iIrZlViTLFcBa 1stUjsIUdK/1M5DKqR2+0YLMZLOJ2yYVig== X-Google-Smtp-Source: AGHT+IGvwpa8M2HS4Ru5T54bXu3dYHM1Gh9OSXG6ntFJmWDi6KfnBgcWWgAIeOt7gMPk3Lk2M1SSPA== X-Received: by 2002:a05:6000:1acb:b0:385:f195:2a8 with SMTP id ffacd0b85a97d-38dc90ee7dbmr2720340f8f.30.1738953495199; Fri, 07 Feb 2025 10:38:15 -0800 (PST) To: devel@lists.libvirt.org Subject: [PATCH V3 19/19] tools: add parallel parameter to virsh restore command Date: Fri, 7 Feb 2025 11:27:30 -0700 Message-ID: <20250207183730.21686-20-jfehlig@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250207183730.21686-1-jfehlig@suse.com> References: <20250207183730.21686-1-jfehlig@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7EY53SVJX7C43OGQJKIGD4QD7UNEAMG5 X-Message-ID-Hash: 7EY53SVJX7C43OGQJKIGD4QD7UNEAMG5 X-MailFrom: jfehlig@suse.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 CC: farosas@suse.de, Claudio Fontana 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: Jim Fehlig via Devel Reply-To: Jim Fehlig X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1738954030802019100 Content-Type: text/plain; charset="utf-8" From: Claudio Fontana Signed-off-by: Claudio Fontana Signed-off-by: Jim Fehlig --- docs/manpages/virsh.rst | 9 +++++++-- tools/virsh-domain.c | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 959393be13..0b02975cc5 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3948,12 +3948,13 @@ restore :: =20 restore state-file [--bypass-cache] [--xml file] - [{--running | --paused}] [--reset-nvram] + [{--running | --paused}] [--reset-nvram] [--parallel] [--parallel-ch= annels] =20 Restores a domain from a ``virsh save`` state file. See *save* for more in= fo. =20 If *--bypass-cache* is specified, the restore will avoid the file system -cache, although this may slow down the operation. +cache. Depending on the specific scenario this may slow down or speed up +the operation. =20 *--xml* ``file`` is usually omitted, but can be used to supply an alternative XML file for use on the restored guest with changes only @@ -3969,6 +3970,10 @@ 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. + ``Note``: To avoid corrupting file system contents within the domain, you should not reuse the saved state file for a second ``restore`` unless you have also reverted all storage volumes back to the same contents as when diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3b765a95b5..8100765341 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5281,6 +5281,14 @@ 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") + }, {.name =3D "xml", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, @@ -5310,13 +5318,16 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) const char *xmlfile =3D NULL; g_autofree char *xml =3D NULL; virshControl *priv =3D ctl->privData; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int maxparams =3D 0; + int nchannels =3D 1; int rc; =20 - if (vshCommandOptString(ctl, cmd, "file", &from) < 0) - return false; - 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")) @@ -5324,15 +5335,35 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "reset-nvram")) flags |=3D VIR_DOMAIN_SAVE_RESET_NVRAM; =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; + if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) return false; =20 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; + + if (flags & VIR_DOMAIN_SAVE_PARALLEL) { + if ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-channels", &nchan= nels)) < 0) + return false; + + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, = nchannels) < 0) + return false; + } =20 if (flags || xml) { - rc =3D virDomainRestoreFlags(priv->conn, from, xml, flags); + rc =3D virDomainRestoreParams(priv->conn, params, nparams, flags); } else { rc =3D virDomainRestore(priv->conn, from); } --=20 2.43.0