From nobody Sat Jan 4 23:06:17 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 1733751121898360.6536913325991; Mon, 9 Dec 2024 05:32:01 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EFC55145E; Mon, 9 Dec 2024 08:31:59 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7E77E1377; Mon, 9 Dec 2024 08:20:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 28D25A6D; Mon, 9 Dec 2024 07:42:57 -0500 (EST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 42F1C11C7 for ; Mon, 9 Dec 2024 07:42:56 -0500 (EST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-21661be2c2dso3658195ad.1 for ; Mon, 09 Dec 2024 04:42:56 -0800 (PST) Received: from localhost.localdomain ([120.60.110.156]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-2164d103993sm18113195ad.193.2024.12.09.04.42.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Dec 2024 04:42:54 -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.6 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=1733748175; x=1734352975; 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=Qo/jmYiY2kKBRpteAvp+38LuIDxxcX2SP5fqhk/M06s=; b=P7qmTHi4k00sQ9e1pK/7p1TDSGCR3PsUk9X0y3sqt1M2x9NrXcXdzUDUA1y/zL7BKg CYJx0OcKX8qAdheQfN8ymM5HMYejbClE+eMr/aihBCgKHuZH98BGo35pFEJpPbDfCcb3 mgzttiUZwJ0cKAQzuNis9BdDK4ah9tV+PZoCS+CcTrYfC7jlkIJZzSRf6F4kbXlJ1uzk zZCe6LykfhKBaFQmwYZWxIQuLilVTKKZK3f1BOiybA31ttli9gEIrcdszIOXc1YOGOPq kOGzGHJ0+A2sZqyDLg+Bxu4VSuxRBXs3uEFCJ2lu2ltQpl76PGQqXaza7gLCxraZ22/c n7jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733748175; x=1734352975; 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=Qo/jmYiY2kKBRpteAvp+38LuIDxxcX2SP5fqhk/M06s=; b=MLVzCgoIb1lLVq+qafT+N1exDgy2/AeWFfe/D7C7vkuuFykXc9OJD+KhC4uq3iPX6u ZnYNen0vYxTqt0Wcg2ELDr6VdB4E5o5zcJ78r78TbAVQyA7pAoc/o9sgCLJ/4nuXug/e dH21kTMr+AtROHA/INYLKSPw1AXAvWNuJrUCBmrGQIO5gkMDJy3sxohmFiFByYYkCL5X GDjXDe5YkcZ4KbkKKW7sVCIV7GxToSTUxvQegSRDeOXJxZwXevP5mKdDHS5ArxQdAxB2 hsmrGtSO+CxjVwDn8oYSiiKGUPK39XPmsTaBPQ5XDpY7grwSARSCqrLlHOYObE9bWwGq KY4A== X-Gm-Message-State: AOJu0YzYjIwn/75sQMI5SqSPuz36DD4fdMbY6WP0J7h8+RBmIw+8llob Gfdp48wzULGii55B03fJsuqye2nwGCpqRMAVVdx2R1coL/7EwZhXVxy2VQ0C X-Gm-Gg: ASbGncsi+XLY3PcbE6c7cfTn7qDFyJRiwMyy9mwiiLSosAiEg5xr6yTaGFgNieM8ViG oQhzEMyJvRMGSJsm1qe0xPB7eiRb7mxMdkvwyHnJx6Z0AhRFdU3KsQc8XZ0fVarPPsjf1FNHIHR AP4AgDieCZYbpeo+bmBxMFw1npcl7SAz1omRF+avVU1hIFTilxB2xSTFt5DhZAcTBgUuni5SpD7 9H5k6a/mb5Ptiu5aVjA7ZRSKOqvcyoELlGlIS4wJPgS3j6b7gpnRl2Y+lQTEhUnSPHhblNz1Qvo mFef4A== X-Google-Smtp-Source: AGHT+IFnoT0awvINSBeFTKyDq9ruvy3DxhVDOcrHLoEOl9Ijkv1n/k+NXcijjvdMFTYAcNPH0iuGig== X-Received: by 2002:a17:903:32cb:b0:215:522d:72d6 with SMTP id d9443c01a7336-2166a07dbc2mr5730765ad.38.1733748174810; Mon, 09 Dec 2024 04:42:54 -0800 (PST) From: Harikumar R To: devel@lists.libvirt.org Subject: [PATCH v6 15/18] virsh: Refactor iotune options for re-use Date: Mon, 9 Dec 2024 18:11:15 +0530 Message-Id: <20241209124118.39471-16-harirajkumar230@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241209124118.39471-1-harirajkumar230@gmail.com> References: <20241209124118.39471-1-harirajkumar230@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MailFrom: harirajkumar230@gmail.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: E6OPILOPL5AXKSB7E6GMZUBNZKVKXS46 X-Message-ID-Hash: E6OPILOPL5AXKSB7E6GMZUBNZKVKXS46 X-Mailman-Approved-At: Mon, 09 Dec 2024 13:19:48 -0500 CC: earulana@in.ibm.com, sanjeev.ranjan@ibm.com, harikumar.rajkumar@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: 1733751125279116600 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 e4923284af..6eea5f176b 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)