From nobody Sun Dec 7 13:32:34 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 1739985221589846.8745632174554; Wed, 19 Feb 2025 09:13:41 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 70684614; Wed, 19 Feb 2025 12:13:40 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 228ED1C12; Wed, 19 Feb 2025 12:02:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D65ED1D90; Wed, 19 Feb 2025 12:02:51 -0500 (EST) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 036541C6E for ; Wed, 19 Feb 2025 12:02:18 -0500 (EST) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-220bfdfb3f4so142612205ad.2 for ; Wed, 19 Feb 2025 09:02:18 -0800 (PST) Received: from localhost.localdomain ([2001:4490:4ea9:8374:8512:e327:fdaf:a56e]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-220d558fe3asm106651545ad.234.2025.02.19.09.02.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 19 Feb 2025 09:02:16 -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_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=gmail.com; s=20230601; t=1739984537; x=1740589337; 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=7NvPhUW/jCgF79h50vThyEbzagWk+bFdCwTodtnZlwc=; b=YGGIBTPMfj2u7DEKQFypDpxK3sLTfVQFDP9n+ZL7PxmgKpnEliiZOgC7b7hSI9HggA ipS4XtF2N675SIPWuhxlqnV1+rTEr0BNzJlYsMZeN2FbrySbEHHIFKq80CpLAUwDs17Q oci0Ju6iGnurjGmb5/Xq0l5oPDv5LFn4OgeQmtip8JBuc3jGrYrIrbjb7Qc8V+ly9vlv Q4EP5FE7PGGZYAN9qinguRsZyI3hFvfvWl4fSbkcEiwLd4r4fjTtVuTsb5LbXl1/qxnb 2ue5ZKNLsXjMxI+7pu24w0dMRmpNiEs387S3HcuMxFGtmiftVviPCoahEbaBgOEGYopj p6Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739984537; x=1740589337; 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=7NvPhUW/jCgF79h50vThyEbzagWk+bFdCwTodtnZlwc=; b=kxUzfP2v4CYEisM0f5G0X4iDAlizRfnuSuaxtmXAF1u1UEGNcJITuwFiVwnrUKLFE0 +IciBgXBZrxyhBDM/n0uCB67k68WgEPBj+nTuJ+lJNoGnQ2ElHsdBOKyKVMf4EYWb1dO gY90x6F4mxET/WNKmnM5Vg2qO6Rq5POKALIiLDsBgcEqZUXAWW1L/7TwaOOWhVHTGq9N Le/wUbg8aBQD2jKXX6HTWupEpfTbo5Ha+RpXLkMVAZ8aj78kSLF1CcHR6RBYwrIZ4vBh bKyvjzBvcJsnkEusLK4LJILdbP2GDFv8Mne7ouWSsI6DY6kdNRye6uxf4IakNMF8icKt LVCg== X-Gm-Message-State: AOJu0YxkibdrjUXeFYGjsase1Zg5aJ8PC+eTYD6NyceooQVFaYLE+GHu +0tixIa/zy+Mjlwui/HqPwmL6Q/LX7z+DRXQ5pdqLaIQuXuJrb1DUp16+D6Y X-Gm-Gg: ASbGncsKcLJIKPmpSSi5MtjzA4kcQgP7101fr0ADBVp2VnkFCBRZbH2xH9H+CEL6AsG p1LhStVtW3+WFTUi1oTQX2RrEbII789rnam4VEDUttHkUwdLx/XXpa6ppOINE9wB9vs9RDJf92j vBJeky5fyfTWvowM+UVposX8R8C0E371QafzN5uAoP7VJSmsr4zzlesRLi3alB57UG+yFpr8RXj U8WmjajLYqpcxf1GmnDJAAGrhh2u3a5CYkD1M9Cc7WUM+wdJ2bStjfkunfvoYHQOHKItFdrP2vw kYrv+5gQ4fUefA20Gs7NTBAGEGFyKnrPDgXtDKpBt7Q4e+OrJFdxtTtgKw== X-Google-Smtp-Source: AGHT+IFkahCtJz2vjETOJjHWBTzkxbVUk369qbaaWO5AjPWiFiDjXiacCj/xqPhFCnfv6qe/ea60ng== X-Received: by 2002:a17:902:db10:b0:220:e7d8:a8a6 with SMTP id d9443c01a7336-221709892e6mr64783665ad.27.1739984537334; Wed, 19 Feb 2025 09:02:17 -0800 (PST) From: Harikumar Rajkumar To: devel@lists.libvirt.org Subject: [PATCH v8 16/18] virsh: Refactor iotune options for re-use Date: Wed, 19 Feb 2025 22:27:20 +0530 Message-Id: <20250219165722.26348-17-harirajkumar230@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250219165722.26348-1-harirajkumar230@gmail.com> References: <20250219165722.26348-1-harirajkumar230@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OO6NOL6YQAL6NHHRLFMSVNGUTTMH3QA4 X-Message-ID-Hash: OO6NOL6YQAL6NHHRLFMSVNGUTTMH3QA4 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: sanjeev.ranjan@ibm.com, harikumar.rajkumar@ibm.com, earulana@in.ibm.com, Chun Feng Wu 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: 1739985228236019100 Content-Type: text/plain; charset="utf-8" From: Chun Feng Wu Define macro for iotune options, this macro is used by opts_blkdeviotune and later throttle group opts Signed-off-by: Chun Feng Wu --- 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)