From nobody Sat Nov 23 17:35:13 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=1723160929; cv=none; d=zohomail.com; s=zohoarc; b=KuSofjKMRMvyGANEsv3+yj/oFgZPf6u+L1YvkLAnzp3z8vHigygRzpbdfpIzHV9EYbqqnwqMFSM/LzMC/5UncwkSA5ubyRZMHCYd4g58H3iNfmdDDFgq2L7f0pO+NyFEdplLepKxWZuSEs56SSdl0abxQpqbavAN/xlHuiliwEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723160929; 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=evtjX67EeddoP813DCdsqr3NnI8jpYp/AgCotAcq4Ys=; b=UeoMTdeLtLtj+DSRol6xt/Uizus3CL642s9N5vG0AFQI+cNLn9CeaKronILUYMqzEAK0da6/yDxzgkW4NiDqqSuJphm7/8gSG4ClnEmSEGFcbdVziFbr+3RRCtaNRbCflGRXdIq/Kuf51ZTKJlkDeTknGVf/jE8Rbjp8sSUAcj0= 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 1723160929236901.4226112986992; Thu, 8 Aug 2024 16:48:49 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 230E1147F; Thu, 8 Aug 2024 19:48:48 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5C96E151C; Thu, 8 Aug 2024 19:39:31 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B3485137E; Thu, 8 Aug 2024 19:39:25 -0400 (EDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 584461473 for ; Thu, 8 Aug 2024 19:38:58 -0400 (EDT) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2ef27bfd15bso16071961fa.2 for ; Thu, 08 Aug 2024 16:38:58 -0700 (PDT) Received: from localhost ([69.51.98.127]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c8d69a7e2dsm3748490173.53.2024.08.08.16.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 16:38:56 -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=1723160337; x=1723765137; 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=xpZXoDAxpngSu0KRBFGd+2Ezqi/Yy7j/LnIGwXRHiB4=; b=TqVnyjYpXJBlNXR+ZewxqcQTq78vVmgjSpt8talZ1Mjtm142a62nLUGtgsbsAwu1Lg dKpI28BckR6uz/T1x1okwwIguq/9lBE/ReY8IazwjfiNveuhiPLk7/FUeOAPCTPqiiyY j9qP13NovZJRpEZ+3V3pAKfFsovbRxg3PMDgCs+RgA6+m7R6sxChGa+jcRchQ0yriREO OmTcMVSec9Jr2DjZ2zomyN34IvXHVqM4lkEZP597yD0oIw5xeRCLq5njDh8U2gmzXM7f KEfsgaaPIZWZDEP9DwvXhbxfM5Iy2M7MA+X9geA/pESGE4WeLSF2Uw2yWpedOMNH7Zi7 jOxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723160337; x=1723765137; 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=xpZXoDAxpngSu0KRBFGd+2Ezqi/Yy7j/LnIGwXRHiB4=; b=t00YBJOVJYX31rPEJMfd97pQPSNDqI/IrX+n8+8dYiFGCSMboAq1+ubZhGG0wQqgpE bFQTxfCBmgm58ldTCCTAvrgRj+dy5aMuAxqNVs+UslKbvmJHsXNPXhazqaA49DLJebtm sR6RNimiqUQcElyk6U180nXgIgsJ6YX9ArD9M1Cz/faRE6HIMB0CrNQdVw4q5YzczZnp fAXnqd/syGDNjf0QVaVIXAyg7/j9Pt0dnOux6Q40gbNMiSd/wLcU6Q/LP83nN5W4uSIV FFzGGQ2/Fu3CetWmOHDfXHi47JWmFvsHgUh0gjB1qrHbYk0JdwGU6kGykz68eTvQ6FCq W1zA== X-Gm-Message-State: AOJu0YwCqDpWKpvqtcra5TOYMLA0Eid9vWZ1WixlyndOQOtLoiYl9cN/ onwk0F+1XNYgDLroZhqazjzWxqgNux+ij2D1SDaoNJKpbznW+nrbfjug8PApSHm9b5dHBD+/7cW I X-Google-Smtp-Source: AGHT+IEOHn5kIkNTwcFylPd6o5AdAStuNqV6qXx9PKgoVOXpFoANm+XkC9KtSsU8PsuIXDF1dbTI2Q== X-Received: by 2002:a2e:b046:0:b0:2ef:1c0f:d490 with SMTP id 38308e7fff4ca-2f19de63271mr23695061fa.39.1723160336949; Thu, 08 Aug 2024 16:38:56 -0700 (PDT) To: devel@lists.libvirt.org Subject: [PATCH 19/20] tools: add parallel parameter to virsh save command Date: Thu, 8 Aug 2024 17:38:12 -0600 Message-Id: <20240808233813.22905-20-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: NGXFZ34UIDH5UAGP4I4JQY7MRIQGCN24 X-Message-ID-Hash: NGXFZ34UIDH5UAGP4I4JQY7MRIQGCN24 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, Li Zhang , 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: 1723160930673116600 Content-Type: text/plain; charset="utf-8" From: Li Zhang Signed-off-by: Claudio Fontana Signed-off-by: Jim Fehlig --- tools/virsh-domain.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 50e80689a2..ec0e43ae7b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4145,6 +4145,14 @@ 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-connections", + .type =3D VSH_OT_INT, + .help =3D N_("number of extra connections to use for parallel save") + }, {.name =3D "xml", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, @@ -4175,6 +4183,11 @@ doSave(void *opaque) g_autoptr(virshDomain) dom =3D NULL; const char *name =3D NULL; const char *to =3D NULL; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int maxparams =3D 0; + int nchannels =3D 0; + int rv =3D -1; unsigned int flags =3D 0; const char *xmlfile =3D NULL; g_autofree char *xml =3D NULL; @@ -4188,15 +4201,29 @@ doSave(void *opaque) goto out_sig; #endif /* !WIN32 */ =20 - if (vshCommandOptString(ctl, cmd, "file", &to) < 0) - goto out; - if (vshCommandOptBool(cmd, "bypass-cache")) flags |=3D VIR_DOMAIN_SAVE_BYPASS_CACHE; if (vshCommandOptBool(cmd, "running")) 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; + + 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 ((rv =3D vshCommandOptInt(ctl, cmd, "parallel-connections", &nchann= els)) < 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_DOMAIN_SAVE_PARAM_PARALLEL_CONNECTION= S, nchannels) < 0) + goto out; + } =20 if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0) goto out; @@ -4209,9 +4236,13 @@ 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) { - rc =3D virDomainSaveFlags(dom, to, xml, flags); + rc =3D virDomainSaveParams(dom, params, nparams, flags); } else { rc =3D virDomainSave(dom, to); } @@ -4224,6 +4255,8 @@ doSave(void *opaque) data->ret =3D 0; =20 out: + virTypedParamsFree(params, nparams); + #ifndef WIN32 pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); out_sig: --=20 2.35.3