From nobody Wed Dec 17 08:52:22 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 173935728291651.28408092055702; Wed, 12 Feb 2025 02:48:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6CC4DBDC; Wed, 12 Feb 2025 05:48:03 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DBD6D1D43; Wed, 12 Feb 2025 05:37:08 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B20251BC4; Wed, 12 Feb 2025 05:37:03 -0500 (EST) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 D45DB1BC4 for ; Wed, 12 Feb 2025 05:36:33 -0500 (EST) Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2f441791e40so9092574a91.3 for ; Wed, 12 Feb 2025 02:36:33 -0800 (PST) Received: from localhost.localdomain ([117.251.37.46]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2fbf98b3277sm1147688a91.7.2025.02.12.02.36.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Feb 2025 02:36:30 -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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,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=gmail.com; s=20230601; t=1739356592; x=1739961392; 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=xTce/FogophEFjJUyCOu+FN7LNiJza//YwJKU2I/Ftk=; b=hlER1HXIZqmElh2k5K+1rOyzQ09b+y1T/nEy++kBrI4H+UrzOm8+qk1JJvgwq59WpI oJy90lZw9Ix9umDFaI/DXsNH+vS03o6oFbxT4RWihBfcoeOGTNLb5qAGCu7hYgFCoTXR 1A1L6GUX+vpLgXxSEqbgyBKQOE6z5olpd7J6dcnsc0CEh3ef32fGmD1S/aEvkRF9LSjg nwrNNBpX0my34kS6B6PSw5cOdjhiqs+EeRdj2sdY4oVsSxgriInJ8FP10x8rfF9NPymH t+PM21eir36HUnTPGk1wGuG9DxK4A251FIwoJ/s3RjWf9LnESkamyktDNaOD/Omj0GPC wF2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739356592; x=1739961392; 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=xTce/FogophEFjJUyCOu+FN7LNiJza//YwJKU2I/Ftk=; b=HRYDUbJcgMA5NVcUG+E68a5VqyHmLd1Erx4ifTBusP35dZglszZWoitsRzUSJGCXY9 UHXJ9cc/nteVD1TY0xgTRb4cXBOid/E9HJEyXIwpyZ/pcgkLiOAegQnLbcoeTiDTWE7l FFInU+n5y+bJYbV7euCAtGzeyGHo9mI7kOVrA1n9OcSAhXpyCPaDdVlvw5lnh2ZxLuoY 0/Ou3BuEYJvKw7lUX4XrFTJGmQLZ5TcuodTecoJAFbtIBOo46pKpvpmSp4WhmjAvHy1Q DhDmzZlWnwtMKW5sdSs9aaNvzMyMAx0eSkjLYAgnn+vj95keLlf5xBNSsu7T8WWewxS9 ZH9Q== X-Gm-Message-State: AOJu0YxVCVQwgsURHq5dBOG3Ar22W+LGV58+HDwYvApKx/n7UGL83lW8 KCIYh5yAkgji/AGWcbMvXYVzBtF6uCbQaa+RO/D6FHchq+VMZ+wunlgJ+Q== X-Gm-Gg: ASbGnctFrotOZ/DXKf64b3AjDqCNFcQEFXVaUyLQgFBy+/3xLHzZQn5q5k1eX3b3czw nibbbmtcHEIM7sfPD8byT9JnNOLr/kVlq7RfktM/5MX/QEO4K2feWfrLsWkjkotiJ116gzksQj+ xehK6UsNXPNFF6ykoQgJsNwBpvFXBmOF42Sfo2H2xkPwMskUMwNvksC7LJ92kqJG2bvfGy/yKA9 1JXz6h8zLxBsF4P57p/JcH38CvkOWK8gUeeyGEvw93squyLAIxK9Fi36+pWlyfhTbvwigfIO6vD OCUQGzIOvSthBnsGg7wCPmjseSeOq/gSFdYBR5p0WFC6AA== X-Google-Smtp-Source: AGHT+IEMjJ+hbqa+Uvtixw6GIE20L8Yb3VfQmtd2rf+vw2Sfmqt0fIdFst+N/tIwgPnjO/7h/7yl/g== X-Received: by 2002:a17:90b:2b8b:b0:2fa:e9b:33b8 with SMTP id 98e67ed59e1d1-2fbf5c1cc63mr4833590a91.18.1739356592484; Wed, 12 Feb 2025 02:36:32 -0800 (PST) From: Harikumar Rajkumar To: devel@lists.libvirt.org Subject: [PATCH v7 16/18] virsh: Refactor iotune options for re-use Date: Wed, 12 Feb 2025 16:05:35 +0530 Message-Id: <20250212103537.26352-17-harirajkumar230@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250212103537.26352-1-harirajkumar230@gmail.com> References: <20250212103537.26352-1-harirajkumar230@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: W2ONOIXEFJFQCGPZ5RD2EIWWPIZOVTVW X-Message-ID-Hash: W2ONOIXEFJFQCGPZ5RD2EIWWPIZOVTVW X-MailFrom: harirajkumar230@gmail.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: harikumar.rajkumar@ibm.com, sanjeev.ranjan@ibm.com, earulana@in.ibm.com, Harikumar Rajkumar 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1739357285008019000 Content-Type: text/plain; charset="utf-8" Define macro for iotune options, this macro is used by opts_blkdeviotune and later throttle group opts Signed-off-by: Harikumar Rajkumar --- tools/virsh-domain.c | 308 ++++++++++++++++++++++--------------------- 1 file changed, 156 insertions(+), 152 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f3da2f903f..9f522da544 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1197,6 +1197,160 @@ static const vshCmdInfo info_blkdeviotune =3D { .desc =3D N_("Set or query disk I/O parameters such as block throttlin= g."), }; =20 +#define VSH_OPTS_IOTUNE() \ + {.name =3D "total_bytes_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-bytes-sec" \ + }, \ + {.name =3D "total-bytes-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("total throughput limit, as scaled integer (default byte= s)") \ + }, \ + {.name =3D "read_bytes_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-bytes-sec" \ + }, \ + {.name =3D "read-bytes-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("read throughput limit, as scaled integer (default bytes= )") \ + }, \ + {.name =3D "write_bytes_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-bytes-sec" \ + }, \ + {.name =3D "write-bytes-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("write throughput limit, as scaled integer (default byt= es)") \ + }, \ + {.name =3D "total_iops_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-iops-sec" \ + }, \ + {.name =3D "total-iops-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("total I/O operations limit per second") \ + }, \ + {.name =3D "read_iops_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-iops-sec" \ + }, \ + {.name =3D "read-iops-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("read I/O operations limit per second") \ + }, \ + {.name =3D "write_iops_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-iops-sec" \ + }, \ + {.name =3D "write-iops-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("write I/O operations limit per second") \ + }, \ + {.name =3D "total_bytes_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-bytes-sec-max" \ + }, \ + {.name =3D "total-bytes-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("total max, as scaled integer (default bytes)") \ + }, \ + {.name =3D "read_bytes_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-bytes-sec-max" \ + }, \ + {.name =3D "read-bytes-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("read max, as scaled integer (default bytes)") \ + }, \ + {.name =3D "write_bytes_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-bytes-sec-max" \ + }, \ + {.name =3D "write-bytes-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("write max, as scaled integer (default bytes)") \ + }, \ + {.name =3D "total_iops_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-iops-sec-max" \ + }, \ + {.name =3D "total-iops-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("total I/O operations max") \ + }, \ + {.name =3D "read_iops_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-iops-sec-max" \ + }, \ + {.name =3D "read-iops-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("read I/O operations max") \ + }, \ + {.name =3D "write_iops_sec_max", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-iops-sec-max" \ + }, \ + {.name =3D "write-iops-sec-max", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("write I/O operations max") \ + }, \ + {.name =3D "size_iops_sec", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "size-iops-sec" \ + }, \ + {.name =3D "size-iops-sec", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("I/O size in bytes") \ + }, \ + {.name =3D "total_bytes_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-bytes-sec-max-length" \ + }, \ + {.name =3D "total-bytes-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow total max bytes") \ + }, \ + {.name =3D "read_bytes_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-bytes-sec-max-length" \ + }, \ + {.name =3D "read-bytes-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow read max bytes") \ + }, \ + {.name =3D "write_bytes_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-bytes-sec-max-length" \ + }, \ + {.name =3D "write-bytes-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow write max bytes") \ + }, \ + {.name =3D "total_iops_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "total-iops-sec-max-length" \ + }, \ + {.name =3D "total-iops-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow total I/O operations max")= \ + }, \ + {.name =3D "read_iops_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "read-iops-sec-max-length" \ + }, \ + {.name =3D "read-iops-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow read I/O operations max") \ + }, \ + {.name =3D "write_iops_sec_max_length", \ + .type =3D VSH_OT_ALIAS, \ + .help =3D "write-iops-sec-max-length" \ + }, \ + {.name =3D "write-iops-sec-max-length", \ + .type =3D VSH_OT_INT, \ + .help =3D N_("duration in seconds to allow write I/O operations max")= \ + } \ + static const vshCmdOptDef opts_blkdeviotune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "device", @@ -1206,110 +1360,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") }, - {.name =3D "total_bytes_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "total-bytes-sec" - }, - {.name =3D "total-bytes-sec", - .type =3D VSH_OT_INT, - .help =3D N_("total throughput limit, as scaled integer (default byte= s)") - }, - {.name =3D "read_bytes_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "read-bytes-sec" - }, - {.name =3D "read-bytes-sec", - .type =3D VSH_OT_INT, - .help =3D N_("read throughput limit, as scaled integer (default bytes= )") - }, - {.name =3D "write_bytes_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "write-bytes-sec" - }, - {.name =3D "write-bytes-sec", - .type =3D VSH_OT_INT, - .help =3D N_("write throughput limit, as scaled integer (default byt= es)") - }, - {.name =3D "total_iops_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "total-iops-sec" - }, - {.name =3D "total-iops-sec", - .type =3D VSH_OT_INT, - .help =3D N_("total I/O operations limit per second") - }, - {.name =3D "read_iops_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "read-iops-sec" - }, - {.name =3D "read-iops-sec", - .type =3D VSH_OT_INT, - .help =3D N_("read I/O operations limit per second") - }, - {.name =3D "write_iops_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "write-iops-sec" - }, - {.name =3D "write-iops-sec", - .type =3D VSH_OT_INT, - .help =3D N_("write I/O operations limit per second") - }, - {.name =3D "total_bytes_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "total-bytes-sec-max" - }, - {.name =3D "total-bytes-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("total max, as scaled integer (default bytes)") - }, - {.name =3D "read_bytes_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "read-bytes-sec-max" - }, - {.name =3D "read-bytes-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("read max, as scaled integer (default bytes)") - }, - {.name =3D "write_bytes_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "write-bytes-sec-max" - }, - {.name =3D "write-bytes-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("write max, as scaled integer (default bytes)") - }, - {.name =3D "total_iops_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "total-iops-sec-max" - }, - {.name =3D "total-iops-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("total I/O operations max") - }, - {.name =3D "read_iops_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "read-iops-sec-max" - }, - {.name =3D "read-iops-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("read I/O operations max") - }, - {.name =3D "write_iops_sec_max", - .type =3D VSH_OT_ALIAS, - .help =3D "write-iops-sec-max" - }, - {.name =3D "write-iops-sec-max", - .type =3D VSH_OT_INT, - .help =3D N_("write I/O operations max") - }, - {.name =3D "size_iops_sec", - .type =3D VSH_OT_ALIAS, - .help =3D "size-iops-sec" - }, - {.name =3D "size-iops-sec", - .type =3D VSH_OT_INT, - .help =3D N_("I/O size in bytes") - }, {.name =3D "group_name", .type =3D VSH_OT_ALIAS, .help =3D "group-name" @@ -1319,59 +1369,13 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { .completer =3D virshCompleteEmpty, .help =3D N_("group name to share I/O quota between multiple drives") }, - {.name =3D "total_bytes_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "total-bytes-sec-max-length" - }, - {.name =3D "total-bytes-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow total max bytes") - }, - {.name =3D "read_bytes_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "read-bytes-sec-max-length" - }, - {.name =3D "read-bytes-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow read max bytes") - }, - {.name =3D "write_bytes_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "write-bytes-sec-max-length" - }, - {.name =3D "write-bytes-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow write max bytes") - }, - {.name =3D "total_iops_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "total-iops-sec-max-length" - }, - {.name =3D "total-iops-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow total I/O operations max") - }, - {.name =3D "read_iops_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "read-iops-sec-max-length" - }, - {.name =3D "read-iops-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow read I/O operations max") - }, - {.name =3D "write_iops_sec_max_length", - .type =3D VSH_OT_ALIAS, - .help =3D "write-iops-sec-max-length" - }, - {.name =3D "write-iops-sec-max-length", - .type =3D VSH_OT_INT, - .help =3D N_("duration in seconds to allow write I/O operations max") - }, + VSH_OPTS_IOTUNE(), VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name =3D NULL} }; +#undef VSH_OPTS_IOTUNE =20 static bool cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) --=20 2.39.5 (Apple Git-154)