From nobody Sat Nov 23 18:00:40 2024 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=1723160960; cv=none; d=zohomail.com; s=zohoarc; b=mh4TmpjL6cyBrD3N2QcT3znHoBK30eKlHTochWgycot5LlVe3dD+z9mO1imtCUrTDmJTYfT3vCdsGnxMmXDEphbn3NrBFgJNDiXZJowV4ELti+fqW/GwltGq8mBGRkL8JT4lnRTSeP9gTfJ/tgE9ntRgz+4EUsvxYkaow361Btc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723160960; 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=p8Jv6LzaXPnaQAOPY2EmJMyuOSpeoXZl1Fv/wNF26PQ=; b=FLtYVUl20LQy1jLbLzXT8jMdwzAJpZriUyPrmWyEALbV3uYgfJuea37aHm5oJXRuud8StDkbtO/lmnseOHEM8vtZqezSRc4NGDA+byPPH3lqFN6HuKmUWgOsLBXpUqeg/BUxVm5+pRjfNuJTKicu4Ulw/KXwUdWGCQVv2LtfOVk= 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 1723160959792842.9670376376102; Thu, 8 Aug 2024 16:49:19 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B01E4146A; Thu, 8 Aug 2024 19:49:16 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9B1DC1483; Thu, 8 Aug 2024 19:39:33 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7AE4114F9; Thu, 8 Aug 2024 19:39:26 -0400 (EDT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 285B814FE for ; Thu, 8 Aug 2024 19:39:00 -0400 (EDT) Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3684e8220f9so846519f8f.1 for ; Thu, 08 Aug 2024 16:39:00 -0700 (PDT) Received: from localhost ([69.51.98.127]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-81fd4d72184sm418908139f.38.2024.08.08.16.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 16:38:58 -0700 (PDT) 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,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=1723160339; x=1723765139; 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=gFlz5e9LowFMo7p8de01mnxKhFQ07EMfQt9MvmidvHs=; b=AIVt/jyaj4UKKKeD/l3n4XFtOWEnjjFty+V8YLRKrU3/ptS9Pv7xnZbisI2Vrga1/j K4omT1Kb5bghcOXCRoF7Ej6vfC6xj6VQwsQtA+grPhgnQ6nmZMOSRhCS27QNnQLIOCMy HQvPZ36Ts0D+2oLKrld5WLs8VD0NFMqN58NmZBtFl8fL+4eZBKv5gXQNwTSu3fLUcEQ0 DNANpSi/0LYEkPm0zwTf/c6CW4HuYecxqQKb9WF8eSh4QVYv6WRGgzDI3JWoAD38AHbY 1iDTEA563TkDfZHLO4d5a/DFnYcMGhyVduVSOY0PtAej+h9bWFtLtH1k/Mm+1vYhkF8s VsqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723160339; x=1723765139; 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=gFlz5e9LowFMo7p8de01mnxKhFQ07EMfQt9MvmidvHs=; b=W5phVuxDOqLr5hzLd6kXtt5drFvbqHydap6xtAdM832yWhPCoKwl1ZUNeGAhVU47pY eK2pAWVLtScELxNji71sMMVMlYKFvSphHTZbw7p6otwkZt+rMQVYlkn3azDXH0kHRwyX sgQdSQYTFU8Y0I9g9ZIKsWIXfBceExjHPv+IRdZnRhpvhdvXxmsfQciqiTKRTRcq6/+b t/GvoLQ0hZUrqojP04JL/OUA39MWvcFDjTf1ASVPzHfl4za2SABKGTIjAnAVmnALgm/e Iaat9BBNsHt/upOO0Fg6G5DfzY3tNIK8Lf7bcQsk1PZYBhBpmZYLT+WKY2gu9tvcRyCh agxA== X-Gm-Message-State: AOJu0Yw0EAAN28bhYEo9jH2I51XsKGyqDuMkpU64gxojLwy4dUUH9wNn VHBPCT3FKf7kRjQjZYYmbY1LZwjHvmUmANyeyc46jsjI1lAhuKdGD+nVV/BRsIdtdKyF6mKGum9 M X-Google-Smtp-Source: AGHT+IG2J+U7kikapiOcyTpY0GFujV0e/aoLZD/6aFVlr7BxGrtYdYR/ntT9QV7nM1+2uGtmHAhyNg== X-Received: by 2002:adf:e246:0:b0:368:6bb:f79e with SMTP id ffacd0b85a97d-36d280cd2bfmr2739734f8f.4.1723160339010; Thu, 08 Aug 2024 16:38:59 -0700 (PDT) To: devel@lists.libvirt.org Subject: [PATCH 20/20] tools: add parallel parameter to virsh restore command Date: Thu, 8 Aug 2024 17:38:13 -0600 Message-Id: <20240808233813.22905-21-jfehlig@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240808233813.22905-1-jfehlig@suse.com> References: <20240808233813.22905-1-jfehlig@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3XS7GHT2F7VZEDVQDXJWHHMS5F4NODUA X-Message-ID-Hash: 3XS7GHT2F7VZEDVQDXJWHHMS5F4NODUA 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: 1723160960808116600 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 | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index fa038e4547..2217728efd 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3915,12 +3915,13 @@ restore :: =20 restore state-file [--bypass-cache] [--xml file] - [{--running | --paused}] [--reset-nvram] + [{--running | --paused}] [--reset-nvram] [--parallel] [--parallel-co= nnections] =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 @@ -3936,6 +3937,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 connections specified with *--parallel-connections*. Parallel +connections 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 ec0e43ae7b..73c04390cc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5265,6 +5265,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-connections", + .type =3D VSH_OT_INT, + .help =3D N_("number of connections to use for parallel restore") + }, {.name =3D "xml", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, @@ -5294,13 +5302,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 0; 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")) @@ -5308,15 +5319,34 @@ 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 ((rc =3D vshCommandOptInt(ctl, cmd, "parallel-connections", &nchann= els)) < 0) { + return false; + } else if (rc > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CONNECTION= S, 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.35.3