From nobody Sat Nov 23 22:14:33 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=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 1731939719427712.5295933134488; Mon, 18 Nov 2024 06:21:59 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 498FE1305; Mon, 18 Nov 2024 09:21:58 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 40B281C0C; Mon, 18 Nov 2024 09:10:53 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4DBC819F5; Mon, 18 Nov 2024 08:55:28 -0500 (EST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.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 59ED119F5 for ; Mon, 18 Nov 2024 08:55:27 -0500 (EST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7ea8de14848so1609339a12.2 for ; Mon, 18 Nov 2024 05:55:27 -0800 (PST) Received: from localhost.localdomain ([2409:40f4:9:7d39:e991:fcfb:15ab:ce58]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-72477135ecbsm6113482b3a.84.2024.11.18.05.55.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 05:55:25 -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.5 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=1731938125; x=1732542925; 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=KVnGTbEjmT25VebbmsY4EI0FmgWUvpfVLH7ec2UUgoQENTNoZR0bRjvymmr1CpNp65 rNUx8/5HL8T6cORe2DFbKoh7CFhL7OH2jn+doRSEEaJ3HztdsIF8cFrURXNMwQe8Znab +4H5QfiFGoLt6ofFhI1GDFgXOv6r/MFHjZDe+Fi/b1DFx1tNdBAwRdh8cC9eIsEmAvqW A2o99PpYNBj6NBR1U13GFKdk1UGPWLTLB2VXOGZ4M9gybBueRoCu9NMgBC2S09jwpYf3 bWvXjB9IgN2NdMRMKYRhnHgNj4RPfN+pya2W2/Ryqw0Wsw2SZtgEKoTXx9p3jWRr7/RW i5Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731938125; x=1732542925; 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=sDrigMeZPKOxKndx3SSseYAjHQswvnWole2i6KakOa7+YjEzJCpLAvLtj0m+IJAPY9 wPZmbvnAbyDh+YC14V0wL2M6LWgWZpNk6G9qrNDQKtT7YMNb0+/HUqLqOiK34FuoRA/7 zxjaSmPwHturYG0rt3t3Tkq69/aDM3bKbjIY68U9PxItfX+94a1sN5/LimzEwz9rX2al /mLa7fGvf7zcOo8Fz7ubkjE1+WcPQ453Y/WVql0nDz2btlxPNuXwL9Caxiqflhxk65dJ HAwbyWpRUF6QMyejiVnj4a3pDOvWP0F0qVdFpStiOzU9RcwVcSb8yPuPrO19FKmAvM6n xssQ== X-Gm-Message-State: AOJu0YwGq56VGMOm+wyfczGbWx0nbTOgUKTfbsvGzmYQ1kRNULfyzcBG XdjgXJhQPm/+hXtqwHN6OYwjk01ByWhVYrx+bEUWt0DPmzO+lcHihY7iv6lL X-Google-Smtp-Source: AGHT+IF5lW6LutCX6Z7TgejpxPd6koZga7KtmMLj8rlhWx13LfI/Nr22tqR1BxLHlZT5TORnFSAICg== X-Received: by 2002:a05:6a20:7289:b0:1db:de11:adb8 with SMTP id adf61e73a8af0-1dc90c15566mr18817979637.37.1731938125478; Mon, 18 Nov 2024 05:55:25 -0800 (PST) From: Harikumar R To: devel@lists.libvirt.org Subject: [PATCH v5 15/18] virsh: Refactor iotune options for re-use Date: Mon, 18 Nov 2024 19:24:23 +0530 Message-Id: <20241118135426.37643-16-harirajkumar230@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241118135426.37643-1-harirajkumar230@gmail.com> References: <20241118135426.37643-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: W2O4TVX4XB76TLZZMBM2Q47R6W3P4K2Q X-Message-ID-Hash: W2O4TVX4XB76TLZZMBM2Q47R6W3P4K2Q X-Mailman-Approved-At: Mon, 18 Nov 2024 14:10:19 -0500 CC: harikumar.rajkumar@ibm.com, sanjeev.ranjan@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: 1731939721276116600 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)