From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510477281386.2761632129333; Fri, 15 Mar 2024 06:47:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 16C901D4C; Fri, 15 Mar 2024 09:47:56 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2BEAF1ACB; Fri, 15 Mar 2024 09:44:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A6381901; Fri, 15 Mar 2024 09:44:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 96FE218E7 for ; Fri, 15 Mar 2024 09:44:31 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-3k0ja0j2P-axnz7hShCN_A-1; Fri, 15 Mar 2024 09:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5192184B061 for ; Fri, 15 Mar 2024 13:44:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEBBBC15771 for ; Fri, 15 Mar 2024 13:44:25 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 3k0ja0j2P-axnz7hShCN_A-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 01/28] vshCmddefHelp: Drop empty line at the end Date: Fri, 15 Mar 2024 14:43:56 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: REPN7L4MRBKHH75LFL6N7MLS7SQKV3ZS X-Message-ID-Hash: REPN7L4MRBKHH75LFL6N7MLS7SQKV3ZS X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510477871100001 All virsh commands in non-quiet mode append another separator line thus having two is unnecessary and in quiet mode it still has a trailing blank line. Remove it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index f96071060a..e6ea3a398a 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -725,7 +725,6 @@ vshCmddefHelp(const vshCmdDef *def) fprintf(stdout, " %-15s %s\n", optstr, _(opt->help)); } } - fputc('\n', stdout); return true; } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510316566321.5269698607101; Fri, 15 Mar 2024 06:45:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 13AC21A8B; Fri, 15 Mar 2024 09:45:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 57E401A56; Fri, 15 Mar 2024 09:44:33 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6E3EB18E7; Fri, 15 Mar 2024 09:44:29 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0E2C31901 for ; Fri, 15 Mar 2024 09:44:29 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-410-VqYVfNEqMamKBcHej8PrnQ-1; Fri, 15 Mar 2024 09:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4145918654CE for ; Fri, 15 Mar 2024 13:44:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE538C1576F for ; Fri, 15 Mar 2024 13:44:26 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: VqYVfNEqMamKBcHej8PrnQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 02/28] virsh: cmdDomdisplayReload: Require option name for --type Date: Fri, 15 Mar 2024 14:43:57 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 2DZIO3GKI4GWREH6RYLOMZYFGMQVUAMR X-Message-ID-Hash: 2DZIO3GKI4GWREH6RYLOMZYFGMQVUAMR X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510317375100001 As this command was introduced in this release add the flag requiring to pass optionname. This is needed to actually disallow positional parsing of the value despite documenting that the flag name is required. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 35809a866b..cd37828660 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13290,6 +13290,7 @@ static const vshCmdOptDef opts_domdisplay_reload[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("graphics display type") }, {.name =3D NULL} --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510554279354.49743221047106; Fri, 15 Mar 2024 06:49:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F33901DBC; Fri, 15 Mar 2024 09:49:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A05471B12; Fri, 15 Mar 2024 09:44:54 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F21791A6C; Fri, 15 Mar 2024 09:44:46 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 28E501A7C for ; Fri, 15 Mar 2024 09:44:34 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-gxpvnS1cNxyeYEKs9v9yUg-1; Fri, 15 Mar 2024 09:44:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2FB80185A781 for ; Fri, 15 Mar 2024 13:44:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E778C1576F for ; Fri, 15 Mar 2024 13:44:27 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: gxpvnS1cNxyeYEKs9v9yUg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 03/28] vshCmddefCheckInternals: Improve some checks Date: Fri, 15 Mar 2024 14:43:58 +0100 Message-ID: <8de337256cecda1804ffef2517dd9458d4576781.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: LJWVBCKIENJ47MUBBXEXVM3F544DOBMV X-Message-ID-Hash: LJWVBCKIENJ47MUBBXEXVM3F544DOBMV X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510556120100001 - move the check that completer_flags are 0 if no completer is set into a common place and remove duplication - add check that _BOOL arguments are not positional - add missing checks to _ALIAS Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index e6ea3a398a..a4235905dc 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -332,6 +332,13 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } + /* Mandate no completer flags if no completer is specified */ + if (opt->completer_flags !=3D 0 && !opt->completer) { + vshError(ctl, "completer_flags of argument '%s' of command '%s= ' must be 0 if no completer is used", + opt->name, cmd->name); + return -1; + } + switch (opt->type) { case VSH_OT_NONE: vshError(ctl, "invalid type 'NONE' of option '%s' of command '= %s'", @@ -339,12 +346,18 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; case VSH_OT_BOOL: - if (opt->completer || opt->completer_flags) { + if (opt->completer) { vshError(ctl, "bool parameter '%s' of command '%s' has com= pleter set", opt->name, cmd->name); return -1; } + if (opt->positional) { + vshError(ctl, "boolean parameter '%s' of command '%s' must= not be positional", + opt->name, cmd->name); + return -1; + } + if (opt->required) { vshError(ctl, "parameter '%s' of command '%s' misused 'req= uired' flag", opt->name, cmd->name); @@ -358,7 +371,11 @@ vshCmddefCheckInternals(vshControl *ctl, g_autofree char *name =3D NULL; char *p; - if (opt->flags || !opt->help) { + if (opt->required || + opt->positional || + opt->completer || + opt->flags || + !opt->help) { vshError(ctl, "parameter '%s' of command '%s' has incorrec= t alias option", opt->name, cmd->name); return -1; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510432046615.3925814971609; Fri, 15 Mar 2024 06:47:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E53971DA7; Fri, 15 Mar 2024 09:47:10 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B756B17BF; Fri, 15 Mar 2024 09:44:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5E5681A4F; Fri, 15 Mar 2024 09:44:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 7D6EE1901 for ; Fri, 15 Mar 2024 09:44:31 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-AJPmJgfzMVqtpcPIf-vxWA-1; Fri, 15 Mar 2024 09:44:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1597D101CF82 for ; Fri, 15 Mar 2024 13:44:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83F14C1576F for ; Fri, 15 Mar 2024 13:44:28 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: AJPmJgfzMVqtpcPIf-vxWA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 04/28] virsh: Inline VIRSH_COMMON_OPT_DOMAIN_OT_STRING macro Date: Fri, 15 Mar 2024 14:43:59 +0100 Message-ID: <6b96511ba09724b3533693608071a723c20f1c7e.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: X2D4AAGEBKRMCAQTVOKTFJLZJKZE5MPU X-Message-ID-Hash: X2D4AAGEBKRMCAQTVOKTFJLZJKZE5MPU X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510433752100001 Upcoming patches will need to tweak some of the properties of the command. Since the macro is used in just two places expand it inline. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-event.c | 7 +++++-- tools/virsh-domain.c | 14 +++++++++++--- tools/virsh.h | 13 ------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c index 2ff7f7b81c..73b00f3bb2 100644 --- a/tools/virsh-domain-event.c +++ b/tools/virsh-domain-event.c @@ -865,8 +865,11 @@ static const vshCmdInfo info_event =3D { }; static const vshCmdOptDef opts_event[] =3D { - VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), - 0, 0), + {.name =3D "domain", + .type =3D VSH_OT_STRING, + .help =3D N_("filter by domain name, id or uuid"), + .completer =3D virshDomainNameCompleter, + }, {.name =3D "event", .type =3D VSH_OT_STRING, .completer =3D virshDomainEventNameCompleter, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cd37828660..0bf4d524b0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9826,8 +9826,11 @@ static const vshCmdInfo info_qemu_monitor_event =3D { }; static const vshCmdOptDef opts_qemu_monitor_event[] =3D { - VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), - 0, 0), + {.name =3D "domain", + .type =3D VSH_OT_STRING, + .help =3D N_("filter by domain name, id or uuid"), + .completer =3D virshDomainNameCompleter, + }, {.name =3D "event", .type =3D VSH_OT_STRING, .help =3D N_("filter by event name") @@ -10322,7 +10325,12 @@ static const vshCmdOptDef opts_domxmltonative[] = =3D { .required =3D true, .help =3D N_("target config data type format") }, - VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(VSH_OFLAG_REQ_OPT, 0), + {.name =3D "domain", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, + .help =3D N_("domain name, id or uuid"), + .completer =3D virshDomainNameCompleter, + }, {.name =3D "xml", .type =3D VSH_OT_STRING, .completer =3D virshCompletePathLocalExisting, diff --git a/tools/virsh.h b/tools/virsh.h index 1114c1572b..ff0cf80911 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -109,19 +109,6 @@ .help =3D _helpstr \ } -#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \ - {.name =3D "domain", \ - .type =3D VSH_OT_STRING, \ - .flags =3D oflags, \ - .help =3D _helpstr, \ - .completer =3D virshDomainNameCompleter, \ - .completer_flags =3D cflags, \ - } - -#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \ - VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), \ - oflags, cflags) - typedef struct _virshControl virshControl; typedef struct _virshCtrlData virshCtrlData; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171051070162311.41792287410749; Fri, 15 Mar 2024 06:51:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 21BA91F47; Fri, 15 Mar 2024 09:51:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4D6D61C50; Fri, 15 Mar 2024 09:45:07 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AA3E51BCE; Fri, 15 Mar 2024 09:44:52 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A7BEE1A69 for ; Fri, 15 Mar 2024 09:44:35 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-263-6MSVoUwCMT-0WSKUO8G8YQ-1; Fri, 15 Mar 2024 09:44:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE22818654CD for ; Fri, 15 Mar 2024 13:44:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68629C1576F for ; Fri, 15 Mar 2024 13:44:29 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 6MSVoUwCMT-0WSKUO8G8YQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 05/28] virsh: Inline VIRSH_COMMON_OPT_FILE_FULL macro Date: Fri, 15 Mar 2024 14:44:00 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: NODPANFGFHEHBEW6AC6VIY43FLDU2C7W X-Message-ID-Hash: NODPANFGFHEHBEW6AC6VIY43FLDU2C7W X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510702586100001 The macro is used in one place only and the command definition will be altered. Inline it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-host.c | 7 +++++-- tools/virsh.h | 7 ++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index ffb993de79..712db39d35 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1635,8 +1635,11 @@ static const vshCmdInfo info_hypervisor_cpu_baseline= =3D { }; static const vshCmdOptDef opts_hypervisor_cpu_baseline[] =3D { - VIRSH_COMMON_OPT_FILE_FULL(N_("file containing XML CPU descriptions"), - false), + {.name =3D "file", + .type =3D VSH_OT_STRING, + .completer =3D virshCompletePathLocalExisting, + .help =3D N_("file containing XML CPU descriptions"), + }, {.name =3D "virttype", .type =3D VSH_OT_STRING, .completer =3D virshDomainVirtTypeCompleter, diff --git a/tools/virsh.h b/tools/virsh.h index ff0cf80911..90ffc4bf18 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -98,13 +98,10 @@ /* Use this only for files which are existing and used locally by virsh */ #define VIRSH_COMMON_OPT_FILE(_helpstr) \ - VIRSH_COMMON_OPT_FILE_FULL(_helpstr, true) - -#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \ {.name =3D "file", \ .type =3D VSH_OT_STRING, \ - .required =3D required_, \ - .positional =3D required_, \ + .required =3D true, \ + .positional =3D true, \ .completer =3D virshCompletePathLocalExisting, \ .help =3D _helpstr \ } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171051051455066.36569824790422; Fri, 15 Mar 2024 06:48:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6226D1E93; Fri, 15 Mar 2024 09:48:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5CB181BCA; Fri, 15 Mar 2024 09:44:52 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 918601901; Fri, 15 Mar 2024 09:44:33 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E3CD21901 for ; Fri, 15 Mar 2024 09:44:32 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-90-J417551CM4ygzXM0MS4UGw-1; Fri, 15 Mar 2024 09:44:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D536B800264 for ; Fri, 15 Mar 2024 13:44:30 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E626C1576F for ; Fri, 15 Mar 2024 13:44:30 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: J417551CM4ygzXM0MS4UGw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 06/28] virsh: Inline VIRSH_COMMON_OPT_NETWORK_OT_STRING macro Date: Fri, 15 Mar 2024 14:44:01 +0100 Message-ID: <0e5e97bb9a27d00b5e8801fcdc5951b688eda37d.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: DKCADJTLPEZBGEGYAGS3IKZZA5OXXRI7 X-Message-ID-Hash: DKCADJTLPEZBGEGYAGS3IKZZA5OXXRI7 X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510516055100001 The macro is used in just one place and the definition of the option is going to be modified. Inline the macro. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-network.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 597e3d4530..240d10eea7 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -43,17 +43,6 @@ #define VIRSH_COMMON_OPT_NETWORK_FULL(cflags) \ VIRSH_COMMON_OPT_NETWORK(N_("network name or uuid"), cflags) -#define VIRSH_COMMON_OPT_NETWORK_OT_STRING(_helpstr, cflags) \ - {.name =3D "network", \ - .type =3D VSH_OT_STRING, \ - .help =3D _helpstr, \ - .completer =3D virshNetworkNameCompleter, \ - .completer_flags =3D cflags, \ - } - -#define VIRSH_COMMON_OPT_NETWORK_OT_STRING_FULL(cflags) \ - VIRSH_COMMON_OPT_NETWORK_OT_STRING(N_("network name or uuid"), cflags) - #define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \ {.name =3D "port", \ .type =3D VSH_OT_STRING, \ @@ -1587,7 +1576,11 @@ static const vshCmdInfo info_network_event =3D { }; static const vshCmdOptDef opts_network_event[] =3D { - VIRSH_COMMON_OPT_NETWORK_OT_STRING(N_("filter by network name or uuid"= ), 0), + {.name =3D "network", + .type =3D VSH_OT_STRING, + .help =3D N_("filter by network name or uuid"), + .completer =3D virshNetworkNameCompleter, + }, {.name =3D "event", .type =3D VSH_OT_STRING, .completer =3D virshNetworkEventNameCompleter, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510613286291.48890006027455; Fri, 15 Mar 2024 06:50:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1AF231A88; Fri, 15 Mar 2024 09:50:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 99D4A1C04; Fri, 15 Mar 2024 09:44:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8533C1A8E; Fri, 15 Mar 2024 09:44:48 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 926B91A8E for ; Fri, 15 Mar 2024 09:44:34 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-568-YxU2Z3IKNmWVvOAKhuwGiw-1; Fri, 15 Mar 2024 09:44:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC109185A78E for ; Fri, 15 Mar 2024 13:44:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35C12C1576F for ; Fri, 15 Mar 2024 13:44:31 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: YxU2Z3IKNmWVvOAKhuwGiw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 07/28] vsh: Introduce tool to find unwanted positional arguments to 'self-test' Date: Fri, 15 Mar 2024 14:44:02 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: Q3MTVY2Y4JHJ7YYI7TWLWPKTGRX2OYXS X-Message-ID-Hash: Q3MTVY2Y4JHJ7YYI7TWLWPKTGRX2OYXS X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510614277100001 While the virsh option definitions specify (either explicitly after recent refactors, or implicitly before) whether an argument is positional or not, the actual parser is way more lax and actually and allows also arguments which were considered/documented as non-positional to be filled positionally unless VSH_OFLAG_REQ_OPT is used in the flags. This creates situations such as 'snapshot-create-as' which has the following docs: SYNOPSIS snapshot-create-as [--name ] [--description ] [--print-xml] [--no-metadata] [--halt] [--disk-only] [--reuse-external] [--quiesce] [--atomic] [--live] [--validate] [--memspec ] [[--diskspec] ]... Thus showing as if '--name' and '--description' required the option, but in fact the following happens when only positionals are passed: $ virsh snapshot-create-as --print-xml 1 2 3 4 5 2 3 In the above example e.g. '--memspec' is not populated. This disconnect makes it impossible to refactor the parser itself and allows users to write buggy interactions with virsh. In order to address this we'll be annotating every single of these unwanted positional options as such so that this doesn't happen in the future, while still preserving the quirk in the parser. This patch introduces a tool which outputs list of options which are not marked as positional but are lacking the VSH_OFLAG_REQ_OPT flag. This tool will be removed once all the offenders found by it will be addressed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index a4235905dc..96d6a5c238 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -244,11 +244,13 @@ static int disconnected; /* we may have been disconne= cted */ static int vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *cmd, - bool missingCompleters) + bool missingCompleters, + int brokenPositionals) { size_t i; bool seenOptionalOption =3D false; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) posbuf =3D VIR_BUFFER_INITIALIZER; /* in order to perform the validation resolve the alias first */ if (cmd->alias) { @@ -325,6 +327,28 @@ vshCmddefCheckInternals(vshControl *ctl, } } + if (brokenPositionals >=3D 0) { + switch (opt->type) { + case VSH_OT_INT: + case VSH_OT_STRING: + case VSH_OT_ARGV: + if (brokenPositionals =3D=3D 0 || + brokenPositionals =3D=3D opt->type) { + if (!(opt->flags & VSH_OFLAG_REQ_OPT) && !opt->positio= nal) + virBufferStrcat(&posbuf, opt->name, ", ", NULL); + } + break; + + case VSH_OT_BOOL: + /* only name is completed */ + /* no point in completing numbers */ + case VSH_OT_ALIAS: + /* alias is handled in the referenced command */ + case VSH_OT_NONE: + break; + } + } + /* require that positional non-argv options are required */ if (opt->positional && !opt->required && opt->type !=3D VSH_OT_ARG= V) { vshError(ctl, "positional argument '%s' of command '%s' must b= e required", @@ -427,10 +451,15 @@ vshCmddefCheckInternals(vshControl *ctl, } virBufferTrim(&complbuf, ", "); + virBufferTrim(&posbuf, ", "); if (missingCompleters && virBufferUse(&complbuf) > 0) vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(= &complbuf)); + if (virBufferUse(&posbuf)) { + vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(= &posbuf)); + } + return 0; } @@ -3336,6 +3365,11 @@ const vshCmdOptDef opts_selftest[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("output help for each command") }, + {.name =3D "broken-positionals", + .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, + .help =3D N_("debug positional args") + }, {.name =3D NULL} }; const vshCmdInfo info_selftest =3D { @@ -3350,6 +3384,9 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) const vshCmdDef *def; bool completers =3D vshCommandOptBool(cmd, "completers-missing"); bool dumphelp =3D vshCommandOptBool(cmd, "dump-help"); + int brokenPositionals =3D -1; + + ignore_value(vshCommandOptInt(ctl, cmd, "broken-positionals", &brokenP= ositionals)); for (grp =3D cmdGroups; grp->name; grp++) { for (def =3D grp->commands; def->name; def++) { @@ -3357,7 +3394,7 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) if (dumphelp && !def->alias) vshCmddefHelp(def); - if (vshCmddefCheckInternals(ctl, def, completers) < 0) + if (vshCmddefCheckInternals(ctl, def, completers, brokenPositi= onals) < 0) return false; } } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510660199284.84002341214796; Fri, 15 Mar 2024 06:51:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0BF4A2140; Fri, 15 Mar 2024 09:50:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 616361A99; Fri, 15 Mar 2024 09:45:05 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 63E301AE1; Fri, 15 Mar 2024 09:44:49 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A4EFA1A85 for ; Fri, 15 Mar 2024 09:44:34 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-331-2v4mbDxYOvWmNUjeFDQK0w-1; Fri, 15 Mar 2024 09:44:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1334185A786 for ; Fri, 15 Mar 2024 13:44:32 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B7CCC1576F for ; Fri, 15 Mar 2024 13:44:31 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 2v4mbDxYOvWmNUjeFDQK0w-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 08/28] vsh: Introduce annotation for vsh options which are unexpectedly parsed positionally Date: Fri, 15 Mar 2024 14:44:03 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GAIBJ4YD2J6ATKGR4OD4VD7ZFACWPMGK X-Message-ID-Hash: GAIBJ4YD2J6ATKGR4OD4VD7ZFACWPMGK X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510660457100001 Based on the rationale in previous commit, all commands which were parsed as positional but not documented as such will be annotated with this flag. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 12 ++++++++++-- tools/vsh.h | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 96d6a5c238..eeee58d39e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -334,7 +334,8 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_ARGV: if (brokenPositionals =3D=3D 0 || brokenPositionals =3D=3D opt->type) { - if (!(opt->flags & VSH_OFLAG_REQ_OPT) && !opt->positio= nal) + if (!(opt->flags & VSH_OFLAG_REQ_OPT) && + !(opt->positional || opt->unwanted_positional)) virBufferStrcat(&posbuf, opt->name, ", ", NULL); } break; @@ -363,6 +364,12 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } + if (opt->unwanted_positional && opt->positional) { + vshError(ctl, "unwanted_positional flag of argument '%s' of co= mmand '%s' must not be used together with positional", + opt->name, cmd->name); + return -1; + } + switch (opt->type) { case VSH_OT_NONE: vshError(ctl, "invalid type 'NONE' of option '%s' of command '= %s'", @@ -376,7 +383,7 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } - if (opt->positional) { + if (opt->positional || opt->unwanted_positional) { vshError(ctl, "boolean parameter '%s' of command '%s' must= not be positional", opt->name, cmd->name); return -1; @@ -397,6 +404,7 @@ vshCmddefCheckInternals(vshControl *ctl, if (opt->required || opt->positional || + opt->unwanted_positional || opt->completer || opt->flags || !opt->help) { diff --git a/tools/vsh.h b/tools/vsh.h index cd833a55fa..fdcc89b12a 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -133,6 +133,13 @@ struct _vshCmdOptDef { vshCmdOptType type; /* option type */ bool required; /* option is required */ bool positional; /* option is a positional option (not requ= iring '--optionname') */ + + /* Historically the command parser in virsh allowed many optional argu= ments + * which were documented as non-positional to be filled positionally. = To + * preserve this functionality those need to be annotated with the + * 'unwanted_positional' flag. New options must not use this flag */ + bool unwanted_positional; + unsigned int flags; /* flags */ const char *help; /* non-NULL help string; or for VSH_OT_ALI= AS * the name of a later public option */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510745122841.1429899930947; Fri, 15 Mar 2024 06:52:25 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F29341F35; Fri, 15 Mar 2024 09:52:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8D98D1C76; Fri, 15 Mar 2024 09:45:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 53AD71C3E; Fri, 15 Mar 2024 09:45:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A600E1AC6 for ; Fri, 15 Mar 2024 09:44:36 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-7fPq38B8N0Oq4bDravdBlg-1; Fri, 15 Mar 2024 09:44:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88564380260E for ; Fri, 15 Mar 2024 13:44:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0256DC1576F for ; Fri, 15 Mar 2024 13:44:32 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 7fPq38B8N0Oq4bDravdBlg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 09/28] virsh: Annotate '--diskspec' _ARGV options as unwanted positional Date: Fri, 15 Mar 2024 14:44:04 +0100 Message-ID: <05cd7c884f81779096ae5b66ece39ad99c8bcb85.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 5JD3GL6CEK7CB343ZISKIDHXP5XAA2OO X-Message-ID-Hash: 5JD3GL6CEK7CB343ZISKIDHXP5XAA2OO X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510746772100001 Our documentation in most places explicitly mentions --diskspec and it was never meant to be positional, although we can't change the parser any more. Annotate them as 'unwanted_positional'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-checkpoint.c | 1 + tools/virsh-snapshot.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 869c071700..65061cbf3d 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -206,6 +206,7 @@ static const vshCmdOptDef opts_checkpoint_create_as[] = =3D { }, {.name =3D "diskspec", .type =3D VSH_OT_ARGV, + .unwanted_positional =3D true, .help =3D N_("disk attributes: disk[,checkpoint=3Dtype][,bitmap=3Dnam= e]") }, {.name =3D NULL} diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 899bae7e9a..638333f4d6 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -361,6 +361,7 @@ static const vshCmdOptDef opts_snapshot_create_as[] =3D= { }, {.name =3D "diskspec", .type =3D VSH_OT_ARGV, + .unwanted_positional =3D true, .help =3D N_("disk attributes: disk[,snapshot=3Dtype][,driver=3Dtype]= [,stype=3Dtype][,file=3Dname]") }, {.name =3D NULL} --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510791699301.3472600735495; Fri, 15 Mar 2024 06:53:11 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 84EA11A9F; Fri, 15 Mar 2024 09:53:10 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C0D5D1CB4; Fri, 15 Mar 2024 09:45:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6FA741790; Fri, 15 Mar 2024 09:45:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 320D91AB9 for ; Fri, 15 Mar 2024 09:44:36 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-218-Rt5o0Qr3Nuel2RHFQHu3eQ-1; Fri, 15 Mar 2024 09:44:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BD3980026D for ; Fri, 15 Mar 2024 13:44:34 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBA3AC15771 for ; Fri, 15 Mar 2024 13:44:33 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Rt5o0Qr3Nuel2RHFQHu3eQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 10/28] virsh: Annotate rest of _ARGV arguments as positional Date: Fri, 15 Mar 2024 14:44:05 +0100 Message-ID: <501d52753bd7684b65ab9202e97fe386bed25a93.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7KNDCXPDL2SJMAKQN7DIGGXWBFJKQCKP X-Message-ID-Hash: 7KNDCXPDL2SJMAKQN7DIGGXWBFJKQCKP X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510792841100001 In most cases it's the usual/recommended way to use those commands: $ virsh qemu-monitor-command VMNAME cmd args args args Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 8 ++++++++ tools/virsh-network.c | 1 + 2 files changed, 9 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0bf4d524b0..801b01bb42 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5000,6 +5000,7 @@ static const vshCmdOptDef opts_schedinfo[] =3D { VIRSH_COMMON_OPT_LIVE(N_("get/set value from running domain")), {.name =3D "set", .type =3D VSH_OT_ARGV, + .positional =3D true, .flags =3D VSH_OFLAG_NONE, .help =3D N_("parameter=3Dvalue") }, @@ -8188,6 +8189,7 @@ static const vshCmdOptDef opts_desc[] =3D { }, {.name =3D "new-desc", .type =3D VSH_OT_ARGV, + .positional =3D true, .help =3D N_("message") }, {.name =3D NULL} @@ -8493,6 +8495,7 @@ static const vshCmdOptDef opts_send_key[] =3D { {.name =3D "keycode", .type =3D VSH_OT_ARGV, .required =3D true, + .positional =3D true, .completer =3D virshKeycodeNameCompleter, .help =3D N_("the key code") }, @@ -9600,6 +9603,7 @@ static const vshCmdOptDef opts_qemu_monitor_command[]= =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .positional =3D true, .required =3D true, .help =3D N_("command") }, @@ -9996,6 +10000,7 @@ static const vshCmdOptDef opts_qemu_agent_command[] = =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .positional =3D true, .required =3D true, .help =3D N_("command") }, @@ -10092,6 +10097,7 @@ static const vshCmdOptDef opts_lxc_enter_namespace[= ] =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .positional =3D true, .required =3D true, .help =3D N_("command to run") }, @@ -12795,6 +12801,7 @@ static const vshCmdOptDef opts_domfsfreeze[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "mountpoint", .type =3D VSH_OT_ARGV, + .positional =3D true, .completer =3D virshDomainFSMountpointsCompleter, .help =3D N_("mountpoint path to be frozen") }, @@ -12835,6 +12842,7 @@ static const vshCmdOptDef opts_domfsthaw[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "mountpoint", .type =3D VSH_OT_ARGV, + .positional =3D true, .completer =3D virshDomainFSMountpointsCompleter, .help =3D N_("mountpoint path to be thawed") }, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 240d10eea7..59ca842181 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -324,6 +324,7 @@ static const vshCmdOptDef opts_network_desc[] =3D { }, {.name =3D "new-desc", .type =3D VSH_OT_ARGV, + .positional =3D true, .help =3D N_("message") }, {.name =3D NULL} --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510847196335.2571046561641; Fri, 15 Mar 2024 06:54:07 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EEBAD1812; Fri, 15 Mar 2024 09:54:05 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0E5711CCC; Fri, 15 Mar 2024 09:45:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4ED9F1AB1; Fri, 15 Mar 2024 09:45:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 65F981AE4 for ; Fri, 15 Mar 2024 09:44:37 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-113-Ru7dlCBANfOmCicYesDlrQ-1; Fri, 15 Mar 2024 09:44:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50A3518654CD for ; Fri, 15 Mar 2024 13:44:35 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFA01C15771 for ; Fri, 15 Mar 2024 13:44:34 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Ru7dlCBANfOmCicYesDlrQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 11/28] vsh: Fix option formatting for 'VHS_OT_ARGV' options Date: Fri, 15 Mar 2024 14:44:06 +0100 Message-ID: <220bf44268ff8f5ace7b0034dba3dfb379b4bceb.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: SEGDPNNNKBFGTLYIWDZIM26GHVHY5GTR X-Message-ID-Hash: SEGDPNNNKBFGTLYIWDZIM26GHVHY5GTR X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510848994100001 While previous fixes kept the help output unchanged as base for the refactors it turns out that the formatting of help for argv options is wrong. Specifically in SYNOPSIS the non-positional _ARGV would have the option name in square brackets (which in other cases means that given thing is optional) despite being required. Similarly in the DESCRIPTION section positional versions would not show the optional argument name and also didn't use the three dots to signal that it can be used multiple times. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index eeee58d39e..cbddc5ed92 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -714,9 +714,9 @@ vshCmddefHelp(const vshCmdDef *def) } } else { if (opt->required) { - fprintf(stdout, _(" {[--%1$s] }..."), opt-= >name); + fprintf(stdout, _(" --%1$s ..."), opt->nam= e); } else { - fprintf(stdout, _(" [[--%1$s] ]..."), opt-= >name); + fprintf(stdout, _(" [--%1$s ]..."), opt->n= ame); } } break; @@ -765,9 +765,9 @@ vshCmddefHelp(const vshCmdDef *def) case VSH_OT_ARGV: if (opt->positional) { - optstr =3D g_strdup_printf("<%s>", opt->name); + optstr =3D g_strdup_printf(_("[--%1$s] ..."), = opt->name); } else { - optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); + optstr =3D g_strdup_printf(_("--%1$s ..."), op= t->name); } break; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511011626123.44040783281218; Fri, 15 Mar 2024 06:56:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E6D771D32; Fri, 15 Mar 2024 09:56:47 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1C66B1AF2; Fri, 15 Mar 2024 09:45:36 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F219D1A83; Fri, 15 Mar 2024 09:45:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A0EDF1A83 for ; Fri, 15 Mar 2024 09:44:38 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-Vbrccgf-OM-Og_W_zgj_Fw-1; Fri, 15 Mar 2024 09:44:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 360CD80026D for ; Fri, 15 Mar 2024 13:44:36 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id A48B2C1576F for ; Fri, 15 Mar 2024 13:44:35 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Vbrccgf-OM-Og_W_zgj_Fw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 12/28] virsh: Require option flags for 'blkdeviotune' arguments Date: Fri, 15 Mar 2024 14:44:07 +0100 Message-ID: <1d894a2b92ceed364c03fbccfe0743205693f96f.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 3PNKLJ3UJEPGOH2KCDEVVZJHRCR7VEXO X-Message-ID-Hash: 3PNKLJ3UJEPGOH2KCDEVVZJHRCR7VEXO X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511013477100001 Make all of the tunable parameter flags require the option name (don't parse them positionally). While techically this would be a breaking change if anyone were to specify the tunable values positionally this is not the case as the first two tunables are not compatible with each other: $ virsh blkdeviotune cd vda 4 5 error: Unable to change block I/O throttle error: invalid argument: total and read/write of bytes_sec cannot be set = at the same time The above is produced by all implementations of the API (qemu and test drivers). It is true that the first tunable can be specified positionally (--total-bytes-sec) but it is misleading and shoud not be allowed either. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 801b01bb42..c8b0896eb6 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1204,6 +1204,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total throughput limit, as scaled integer (default byte= s)") }, {.name =3D "read_bytes_sec", @@ -1212,6 +1213,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read throughput limit, as scaled integer (default bytes= )") }, {.name =3D "write_bytes_sec", @@ -1220,6 +1222,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write throughput limit, as scaled integer (default byt= es)") }, {.name =3D "total_iops_sec", @@ -1228,6 +1231,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total I/O operations limit per second") }, {.name =3D "read_iops_sec", @@ -1236,6 +1240,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read I/O operations limit per second") }, {.name =3D "write_iops_sec", @@ -1244,6 +1249,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write I/O operations limit per second") }, {.name =3D "total_bytes_sec_max", @@ -1252,6 +1258,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total max, as scaled integer (default bytes)") }, {.name =3D "read_bytes_sec_max", @@ -1260,6 +1267,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read max, as scaled integer (default bytes)") }, {.name =3D "write_bytes_sec_max", @@ -1268,6 +1276,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write max, as scaled integer (default bytes)") }, {.name =3D "total_iops_sec_max", @@ -1276,6 +1285,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total I/O operations max") }, {.name =3D "read_iops_sec_max", @@ -1284,6 +1294,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read I/O operations max") }, {.name =3D "write_iops_sec_max", @@ -1292,6 +1303,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec-max", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write I/O operations max") }, {.name =3D "size_iops_sec", @@ -1300,6 +1312,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "size-iops-sec", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("I/O size in bytes") }, {.name =3D "group_name", @@ -1308,6 +1321,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "group-name", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("group name to share I/O quota between multiple drives") }, @@ -1317,6 +1331,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow total max bytes") }, {.name =3D "read_bytes_sec_max_length", @@ -1325,6 +1340,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow read max bytes") }, {.name =3D "write_bytes_sec_max_length", @@ -1333,6 +1349,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow write max bytes") }, {.name =3D "total_iops_sec_max_length", @@ -1341,6 +1358,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow total I/O operations max") }, {.name =3D "read_iops_sec_max_length", @@ -1349,6 +1367,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow read I/O operations max") }, {.name =3D "write_iops_sec_max_length", @@ -1357,6 +1376,7 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec-max-length", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow write I/O operations max") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510898658626.3393693114792; Fri, 15 Mar 2024 06:54:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 70B101CC3; Fri, 15 Mar 2024 09:54:57 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 33B691D32; Fri, 15 Mar 2024 09:45:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A2817449; Fri, 15 Mar 2024 09:45:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 1C6201A8A for ; Fri, 15 Mar 2024 09:44:39 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-6n0fB9otNAern_zvHt3tbg-1; Fri, 15 Mar 2024 09:44:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1BBB28910C4 for ; Fri, 15 Mar 2024 13:44:37 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A467C1576F for ; Fri, 15 Mar 2024 13:44:36 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 6n0fB9otNAern_zvHt3tbg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 13/28] virsh: Fix "positional" argument annotations for 'migrate' command Date: Fri, 15 Mar 2024 14:44:08 +0100 Message-ID: <948869d92f8f77d75d99e5d38b5d5d58a6ce1516.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: NBTGYMFGBQTP447EVNWJ2RU76ZCZKNAS X-Message-ID-Hash: NBTGYMFGBQTP447EVNWJ2RU76ZCZKNAS X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510899177100001 Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) Annotate '--migrateuri', '--graphicsuri', '--listen-address', '-dname', '--timeout', '--xml', '--migrate-disks' and '--disks port' as 'unwanted_positional'. These were declared in chronological order per git history. All others are annotated with VSH_OFLAG_REQ_OPT which makes the parser require the '--optionname'. This is due to the fact that '--disks-uri' was introduced later and put in front of others declared earlier breaking the order they would be accepted, thus changing the behaviour between versions. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c8b0896eb6..a558afe273 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10653,26 +10653,31 @@ static const vshCmdOptDef opts_migrate[] =3D { }, {.name =3D "migrateuri", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("migration URI, usually can be omitted") }, {.name =3D "graphicsuri", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("graphics URI to be used for seamless graphics migration= ") }, {.name =3D "listen-address", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("listen address that destination should bind to for inco= ming migration") }, {.name =3D "dname", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("rename to new name during migration (if supported)") }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("run action specified by --timeout-* option (suspend by " "default) if live migration exceeds timeout (in seconds)") }, @@ -10686,54 +10691,66 @@ static const vshCmdOptDef opts_migrate[] =3D { }, {.name =3D "xml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") }, {.name =3D "migrate-disks", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainMigrateDisksCompleter, .help =3D N_("comma separated list of disks to be migrated") }, {.name =3D "disks-port", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("port to use by target server for incoming disks migrati= on") }, {.name =3D "disks-uri", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("URI to use for disks migration (overrides --disks-port)= ") }, {.name =3D "comp-methods", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshDomainMigrateCompMethodsCompleter, .help =3D N_("comma separated list of compression methods to be used") }, {.name =3D "comp-mt-level", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for multithread compression") }, {.name =3D "comp-mt-threads", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of compression threads for multithread compressi= on") }, {.name =3D "comp-mt-dthreads", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of decompression threads for multithread compres= sion") }, {.name =3D "comp-xbzrle-cache", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("page cache size for xbzrle compression") }, {.name =3D "auto-converge-initial", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("initial CPU throttling rate for auto-convergence") }, {.name =3D "auto-converge-increment", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("CPU throttling rate increment for auto-convergence") }, {.name =3D "persistent-xml", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated persistent XML for the targ= et") }, @@ -10743,31 +10760,38 @@ static const vshCmdOptDef opts_migrate[] =3D { }, {.name =3D "postcopy-bandwidth", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("post-copy migration bandwidth limit in MiB/s") }, {.name =3D "parallel", .type =3D VSH_OT_BOOL, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("enable parallel migration") }, {.name =3D "parallel-connections", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of connections for parallel migration") }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("migration bandwidth limit in MiB/s") }, {.name =3D "tls-destination", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("override the destination host name used for TLS verific= ation") }, {.name =3D "comp-zlib-level", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for zlib compression") }, {.name =3D "comp-zstd-level", .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for zstd compression") }, {.name =3D NULL} --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710510952699665.4492100625289; Fri, 15 Mar 2024 06:55:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 85D48190C; Fri, 15 Mar 2024 09:55:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D2E0A1AD0; Fri, 15 Mar 2024 09:45:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AC6DF1A8A; Fri, 15 Mar 2024 09:45:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 4F56F1B34 for ; Fri, 15 Mar 2024 09:44:40 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-OUJcNfKuPj2UK_UQO1GkNA-1; Fri, 15 Mar 2024 09:44:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 013E1800269 for ; Fri, 15 Mar 2024 13:44:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F3ADC1576F for ; Fri, 15 Mar 2024 13:44:37 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: OUJcNfKuPj2UK_UQO1GkNA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 14/28] virsh: Require option flags for all optional arguments of 'attach-disk' Date: Fri, 15 Mar 2024 14:44:09 +0100 Message-ID: <7d881d793b2894e173cf14cafed05289fff765ef.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: SNW6NURS7Q5EXB5OT4CMZMBBWGSM5KMC X-Message-ID-Hash: SNW6NURS7Q5EXB5OT4CMZMBBWGSM5KMC X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710510953315100001 Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) Currently virsh accepts the arguments such as: $ virsh attach-disk --print-xml 1 2 3 4 5 6 7 8 9 10 While making virsh require the flags is technically a breaking change, there were multiple instances where arguments were added to the argument list thus changing the order the positional arguments would be interpreted as. Examples are commits: 7e157858b4b, bc5a8090afa, ca21d75d25. As of such there are multiple breaks of compatibiluity for the positional arguments. As of such, require the option flag for all optional arguments with value for 'virsh attach-disk'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a558afe273..d7b86ded7d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -434,31 +434,38 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "targetbus", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("target bus of disk device") }, {.name =3D "driver", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("driver of disk device") }, {.name =3D "subdriver", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("subdriver of disk device") }, {.name =3D "iothread", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("IOThread to be used by supported device") }, {.name =3D "cache", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("cache mode of disk device") }, {.name =3D "io", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("io policy of disk device") }, {.name =3D "type", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("target device type") }, {.name =3D "shareable", @@ -467,24 +474,29 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "mode", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("mode of device reading and writing") }, {.name =3D "sourcetype", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("type of source (block|file|network)") }, {.name =3D "serial", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("serial of disk device") }, {.name =3D "wwn", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("wwn of disk device") }, {.name =3D "alias", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("custom alias name of disk device") }, @@ -494,6 +506,7 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "address", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("address of disk device") }, @@ -507,19 +520,23 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "source-protocol", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("protocol used by disk device source") }, {.name =3D "source-host-name", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("host name for source of disk device") }, {.name =3D "source-host-transport", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("host transport for source of disk device") }, {.name =3D "source-host-socket", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("host socket for source of disk device") }, VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511109180917.3313799760197; Fri, 15 Mar 2024 06:58:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 02CA918E7; Fri, 15 Mar 2024 09:58:27 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B711F1C02; Fri, 15 Mar 2024 09:45:46 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 325131B0A; Fri, 15 Mar 2024 09:45:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 BD42117EF for ; Fri, 15 Mar 2024 09:44:41 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-vXG5JSkNOAa1BOBjuyjebg-1; Fri, 15 Mar 2024 09:44:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB49684B062 for ; Fri, 15 Mar 2024 13:44:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55216C1576F for ; Fri, 15 Mar 2024 13:44:38 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: vXG5JSkNOAa1BOBjuyjebg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 15/28] virsh-checkpoint: Make 'checkpointname' positional and required Date: Fri, 15 Mar 2024 14:44:10 +0100 Message-ID: <57bb46588c006b3e354d0acfa1fc0aafb3cb0201.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: ARWAXRMKUAZAQSD47ZYTI5ZUQMEVJSBH X-Message-ID-Hash: ARWAXRMKUAZAQSD47ZYTI5ZUQMEVJSBH X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511109729100001 The argument was being parsed positionally due to the command parser quirk as we didn't opt out of it. Since the code in virshLookupCheckpoint requires that the checkpointname is present we can mark all the options as positional and required and remove the redundant check from virshLookupCheckpoint. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-checkpoint.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 65061cbf3d..9aeb8a5e7e 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -281,16 +281,8 @@ virshLookupCheckpoint(vshControl *ctl, if (vshCommandOptStringReq(ctl, cmd, arg, &chkname) < 0) return -1; - if (chkname) { - *chk =3D virDomainCheckpointLookupByName(dom, chkname, 0); - } else { - vshError(ctl, _("--%1$s is required"), arg); + if (!(*chk =3D virDomainCheckpointLookupByName(dom, chkname, 0))) return -1; - } - if (!*chk) { - vshReportError(ctl); - return -1; - } *name =3D virDomainCheckpointGetName(*chk); return 0; @@ -309,6 +301,8 @@ static const vshCmdOptDef opts_checkpoint_edit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT), {.name =3D "checkpointname", .type =3D VSH_OT_STRING, + .positional =3D true, + .required =3D true, .help =3D N_("checkpoint name"), .completer =3D virshCheckpointNameCompleter, }, @@ -420,6 +414,8 @@ static const vshCmdOptDef opts_checkpoint_info[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT), {.name =3D "checkpointname", .type =3D VSH_OT_STRING, + .positional =3D true, + .required =3D true, .help =3D N_("checkpoint name"), .completer =3D virshCheckpointNameCompleter, }, @@ -810,6 +806,8 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] =3D= { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT), {.name =3D "checkpointname", .type =3D VSH_OT_STRING, + .positional =3D true, + .required =3D true, .help =3D N_("checkpoint name"), .completer =3D virshCheckpointNameCompleter, }, @@ -886,6 +884,8 @@ static const vshCmdOptDef opts_checkpoint_parent[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT), {.name =3D "checkpointname", .type =3D VSH_OT_STRING, + .positional =3D true, + .required =3D true, .help =3D N_("find parent of checkpoint name"), .completer =3D virshCheckpointNameCompleter, }, @@ -935,6 +935,8 @@ static const vshCmdOptDef opts_checkpoint_delete[] =3D { VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "checkpointname", .type =3D VSH_OT_STRING, + .positional =3D true, + .required =3D true, .help =3D N_("checkpoint name"), .completer =3D virshCheckpointNameCompleter, }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171051114881944.56730211992351; Fri, 15 Mar 2024 06:59:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 88FCE1F0E; Fri, 15 Mar 2024 09:59:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EDE101B48; Fri, 15 Mar 2024 09:45:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6FD721B88; Fri, 15 Mar 2024 09:45:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 88CA01A59 for ; Fri, 15 Mar 2024 09:44:42 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-0k3bKp_5Npmh5DGevHEkhw-1; Fri, 15 Mar 2024 09:44:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C399B85A58C for ; Fri, 15 Mar 2024 13:44:39 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CE05C1576F for ; Fri, 15 Mar 2024 13:44:39 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 0k3bKp_5Npmh5DGevHEkhw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 16/28] vsh: Allow one optional positional argument Date: Fri, 15 Mar 2024 14:44:11 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: T74UAU4SR6N7JPBRZMXPBO7I4INWRWBG X-Message-ID-Hash: T74UAU4SR6N7JPBRZMXPBO7I4INWRWBG X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511149837100001 We already allow a optional positional _ARGV argument but there's no reason why any other argument type could not be allowed this way. Add checks that there's just one such argument and it's placed after required positional arguments. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index cbddc5ed92..80057654c8 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -249,6 +249,7 @@ vshCmddefCheckInternals(vshControl *ctl, { size_t i; bool seenOptionalOption =3D false; + const char *seenOptionalPositionalOption =3D NULL; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) posbuf =3D VIR_BUFFER_INITIALIZER; @@ -350,10 +351,21 @@ vshCmddefCheckInternals(vshControl *ctl, } } - /* require that positional non-argv options are required */ - if (opt->positional && !opt->required && opt->type !=3D VSH_OT_ARG= V) { - vshError(ctl, "positional argument '%s' of command '%s' must b= e required", - opt->name, cmd->name); + /* allow at most one optional positional option */ + if (opt->positional && !opt->required) { + if (seenOptionalPositionalOption) { + vshError(ctl, "multiple optional positional arguments (%s,= %s) of command '%s' are not allowed", + seenOptionalPositionalOption, opt->name, cmd->nam= e); + return -1; + } + + seenOptionalPositionalOption =3D opt->name; + } + + /* all optional positional arguments must be defined after the req= uired ones */ + if (seenOptionalPositionalOption && opt->positional && opt->requir= ed) { + vshError(ctl, "required positional argument '%s' declared afte= r an optional positional argument '%s' of command '%s'", + opt->name, seenOptionalPositionalOption, cmd->name); return -1; } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511050187152.33775362706228; Fri, 15 Mar 2024 06:57:30 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0D5AD1E86; Fri, 15 Mar 2024 09:57:29 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 285471790; Fri, 15 Mar 2024 09:45:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3136917EF; Fri, 15 Mar 2024 09:45:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 74B381905 for ; Fri, 15 Mar 2024 09:44:42 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-c76TlS-rPt-GnoILHwsb3g-1; Fri, 15 Mar 2024 09:44:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB29A800269 for ; Fri, 15 Mar 2024 13:44:40 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2587EC1576F for ; Fri, 15 Mar 2024 13:44:39 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: c76TlS-rPt-GnoILHwsb3g-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 17/28] vsh: Make the only argument of 'connect', 'cd', and 'help' commands positional Date: Fri, 15 Mar 2024 14:44:12 +0100 Message-ID: <2743d861ee18f628111e0431b70dd276490445a0.1710510136.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: WT22TQ66ZLOKK3OPA7VDLJDTKZ55C7X2 X-Message-ID-Hash: WT22TQ66ZLOKK3OPA7VDLJDTKZ55C7X2 X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511073631100001 The intended use of those commands is to use the argument directly without the flag. Since the argument is optional in all cases we couldn't declare them as positional until now. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh.c | 1 + tools/virt-admin.c | 1 + tools/vsh.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/tools/virsh.c b/tools/virsh.c index 5b38881066..890c96e552 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -245,6 +245,7 @@ virshReconnect(vshControl *ctl, const char *name, bool = readonly, bool force) static const vshCmdOptDef opts_connect[] =3D { {.name =3D "name", .type =3D VSH_OT_STRING, + .positional =3D true, .flags =3D VSH_OFLAG_EMPTY_OK, .completer =3D virshCompleteEmpty, .help =3D N_("hypervisor connection URI") diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 37bc6fe4f0..3e3361fbf1 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -254,6 +254,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UN= USED) static const vshCmdOptDef opts_connect[] =3D { {.name =3D "name", .type =3D VSH_OT_STRING, + .positional =3D true, .flags =3D VSH_OFLAG_EMPTY_OK, .help =3D N_("daemon's admin server connection URI") }, diff --git a/tools/vsh.c b/tools/vsh.c index 80057654c8..2c90ca44f7 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3163,6 +3163,7 @@ vshCompleteHelpCommand(vshControl *ctl G_GNUC_UNUSED, const vshCmdOptDef opts_help[] =3D { {.name =3D "command", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D vshCompleteHelpCommand, .help =3D N_("Prints global help, command specific help, or help for = a group of related commands") }, @@ -3220,6 +3221,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) const vshCmdOptDef opts_cd[] =3D { {.name =3D "dir", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("directory to switch to (default: home or else root)") }, {.name =3D NULL} --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511189062204.59320895811265; Fri, 15 Mar 2024 06:59:49 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CDB7E1B19; Fri, 15 Mar 2024 09:59:47 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 620C11B41; Fri, 15 Mar 2024 09:45:54 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4571F1D71; Fri, 15 Mar 2024 09:45:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 871AE1AAF for ; Fri, 15 Mar 2024 09:44:43 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107--KUBPvIXN7CfwHOAyspVbg-1; Fri, 15 Mar 2024 09:44:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9072A8910C1 for ; Fri, 15 Mar 2024 13:44:41 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B65CC1576F for ; Fri, 15 Mar 2024 13:44:40 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: -KUBPvIXN7CfwHOAyspVbg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 18/28] virsh: snapshot: Make 'snapshotname' argument positional Date: Fri, 15 Mar 2024 14:44:13 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 3RFYB2KHRBP6Y5FXHX5NS3GGMJA4RXBD X-Message-ID-Hash: 3RFYB2KHRBP6Y5FXHX5NS3GGMJA4RXBD X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511190038100001 The 'snapshotname' argument is optional as by default "current" snapshot is considered. Regardless of that we should treat it as positional as it's the common usage. This is now possible as we can have one optional positional argument. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-snapshot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 638333f4d6..6c8194d67f 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -486,6 +486,7 @@ static const vshCmdOptDef opts_snapshot_edit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, }, @@ -599,6 +600,7 @@ static const vshCmdOptDef opts_snapshot_current[] =3D { }, {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("name of existing snapshot to make current"), .completer =3D virshSnapshotNameCompleter, }, @@ -798,6 +800,7 @@ static const vshCmdOptDef opts_snapshot_info[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, }, @@ -1635,6 +1638,7 @@ static const vshCmdOptDef opts_snapshot_parent[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("find parent of snapshot name"), .completer =3D virshSnapshotNameCompleter, }, @@ -1682,6 +1686,7 @@ static const vshCmdOptDef opts_snapshot_revert[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, }, @@ -1763,6 +1768,7 @@ static const vshCmdOptDef opts_snapshot_delete[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511225909704.9111880865795; Fri, 15 Mar 2024 07:00:25 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C4FED1C02; Fri, 15 Mar 2024 10:00:24 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id ACB0C1A96; Fri, 15 Mar 2024 09:45:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 961261AC2; Fri, 15 Mar 2024 09:45:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 665B91AC8 for ; Fri, 15 Mar 2024 09:44:44 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-46-h3aadb_sMsi-TVFu1ZLQww-1; Fri, 15 Mar 2024 09:44:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 779E1380260F for ; Fri, 15 Mar 2024 13:44:42 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id E59D1C1576F for ; Fri, 15 Mar 2024 13:44:41 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: h3aadb_sMsi-TVFu1ZLQww-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 19/28] virsh: Make '(snapshot|checkpoint)-create' 'xmlfile' argument positional Date: Fri, 15 Mar 2024 14:44:14 +0100 Message-ID: <0885a90950a2619167498c617a59f8357cd015d9.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: PGAZV2NGLPTPK377RKNYXY2PQZ6RLEKG X-Message-ID-Hash: PGAZV2NGLPTPK377RKNYXY2PQZ6RLEKG X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511226134100001 The argument is optional thus couldn't be marked as positional until now, despite being parsed positionally. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-checkpoint.c | 1 + tools/virsh-snapshot.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 9aeb8a5e7e..7151e2b182 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -81,6 +81,7 @@ static const vshCmdOptDef opts_checkpoint_create[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "xmlfile", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("domain checkpoint XML") }, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6c8194d67f..b47733d05b 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -109,6 +109,7 @@ static const vshCmdOptDef opts_snapshot_create[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "xmlfile", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("domain snapshot XML") }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171051126142047.45191657243447; Fri, 15 Mar 2024 07:01:01 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2564620E3; Fri, 15 Mar 2024 10:01:00 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0BBB11BAB; Fri, 15 Mar 2024 09:46:02 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A6241A96; Fri, 15 Mar 2024 09:45:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B35EC1B86 for ; Fri, 15 Mar 2024 09:44:45 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-nY4cnl4cPcCrxoTDA72Vig-1; Fri, 15 Mar 2024 09:44:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 681C7285F992 for ; Fri, 15 Mar 2024 13:44:43 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6071C1576F for ; Fri, 15 Mar 2024 13:44:42 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: nY4cnl4cPcCrxoTDA72Vig-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 20/28] virsh-backup: Fix argument annotations of 'backup-begin' command Date: Fri, 15 Mar 2024 14:44:15 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: CGYK55OHTWMVR7XLG2I66FUUXGHKMXNS X-Message-ID-Hash: CGYK55OHTWMVR7XLG2I66FUUXGHKMXNS X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511262363100001 Mark the 'backupxml' as positional optional and the 'checkpointxml' as 'unwanted_positional' to preserve the positioanl parsing quirk. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-backup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index 7a7834d7ff..52325b5ca0 100644 --- a/tools/virsh-backup.c +++ b/tools/virsh-backup.c @@ -34,11 +34,13 @@ static const vshCmdOptDef opts_backup_begin[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "backupxml", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("domain backup XML"), }, {.name =3D "checkpointxml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("domain checkpoint XML"), }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511322197338.93731938846577; Fri, 15 Mar 2024 07:02:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D92511F16; Fri, 15 Mar 2024 10:02:00 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 795AC1DDA; Fri, 15 Mar 2024 09:46:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F09C31A52; Fri, 15 Mar 2024 09:45:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 69D231B94 for ; Fri, 15 Mar 2024 09:44:46 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-8-i88ADMc6MRqz2c2I5sWhRQ-1; Fri, 15 Mar 2024 09:44:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5892B1C2CEC1 for ; Fri, 15 Mar 2024 13:44:44 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6BCCC1576F for ; Fri, 15 Mar 2024 13:44:43 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: i88ADMc6MRqz2c2I5sWhRQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 21/28] virsh: Annotate some optional arguments as positional Date: Fri, 15 Mar 2024 14:44:16 +0100 Message-ID: <6385201e8795d7aa7b0576bc584137219fde46b3.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YEBREN6EB2NXMFJKN7ZDU5W5X3M3VKWS X-Message-ID-Hash: YEBREN6EB2NXMFJKN7ZDU5W5X3M3VKWS X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511322570100001 Make certain optional arguments truly positional in cases when it makes semantic sense. Previously it wasn't possible to have optional positional arguments, but the parser filled them regardless, thus this preserves functionality. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 3 +++ tools/virsh-domain.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 6c2499fb9f..71a5086c00 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -385,6 +385,7 @@ static const vshCmdOptDef opts_domblkinfo[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "device", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") }, @@ -865,6 +866,7 @@ static const vshCmdOptDef opts_domblkstat[] =3D { {.name =3D "device", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_EMPTY_OK, + .positional =3D true, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") }, @@ -2219,6 +2221,7 @@ static const vshCmdOptDef opts_domifaddr[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "interface", .type =3D VSH_OT_STRING, + .positional =3D true, .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("network interface name")}, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d7b86ded7d..9a41e32e3d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2939,6 +2939,7 @@ static const vshCmdOptDef opts_blockresize[] =3D { }, {.name =3D "size", .type =3D VSH_OT_INT, + .positional =3D true, .help =3D N_("New size of the block device, as scaled integer (defaul= t KiB)") }, {.name =3D "capacity", @@ -5805,6 +5806,7 @@ static const vshCmdOptDef opts_shutdown[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "mode", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshDomainShutdownModeCompleter, .help =3D N_("shutdown mode: acpi|agent|initctl|signal|paravirt") }, @@ -5880,6 +5882,7 @@ static const vshCmdOptDef opts_reboot[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "mode", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshDomainShutdownModeCompleter, .help =3D N_("shutdown mode: acpi|agent|initctl|signal|paravirt") }, @@ -11531,6 +11534,7 @@ static const vshCmdOptDef opts_domdisplay[] =3D { }, {.name =3D "type", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("select particular graphical display " "(e.g. \"vnc\", \"spice\", \"rdp\", \"dbus\")") }, @@ -12675,6 +12679,7 @@ static const vshCmdOptDef opts_change_media[] =3D { }, {.name =3D "source", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("source of the media") }, {.name =3D "eject", @@ -13199,6 +13204,7 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = =3D { }, {.name =3D "file", .type =3D VSH_OT_STRING, + .positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("optional file to read keys from"), }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511364261299.2093478849979; Fri, 15 Mar 2024 07:02:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 022F52158; Fri, 15 Mar 2024 10:02:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D82121C92; Fri, 15 Mar 2024 09:46:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C89DA1B94; Fri, 15 Mar 2024 09:45:31 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 659A21BAB for ; Fri, 15 Mar 2024 09:44:47 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-ycGlOFciPMi4qt2NA9bJrQ-1; Fri, 15 Mar 2024 09:44:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F1A8101A526 for ; Fri, 15 Mar 2024 13:44:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC935C1576F for ; Fri, 15 Mar 2024 13:44:44 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: ycGlOFciPMi4qt2NA9bJrQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 22/28] virsh: volume: Mark optional 'pool' argument as 'positional' Date: Fri, 15 Mar 2024 14:44:17 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7APMD3FGV6DPX4ZFSDUDZBRTXSEYZDEW X-Message-ID-Hash: 7APMD3FGV6DPX4ZFSDUDZBRTXSEYZDEW X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511364788100001 Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) The pool name is optional but in all cases it can be promoted to an optional positional argument so that it can be properly aligned with the expectations of the parser. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-volume.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 8794126f21..7e6c6d5ef5 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -49,6 +49,7 @@ #define VIRSH_COMMON_OPT_POOL_OPTIONAL \ {.name =3D "pool", \ .type =3D VSH_OT_STRING, \ + .positional =3D true, \ .help =3D N_("pool name or uuid"), \ .completer =3D virshStoragePoolNameCompleter, \ .completer_flags =3D VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE, \ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511449525966.5125862424693; Fri, 15 Mar 2024 07:04:09 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4EF7F1CB8; Fri, 15 Mar 2024 10:04:08 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 799C11CEC; Fri, 15 Mar 2024 09:46:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B2CB51AD0; Fri, 15 Mar 2024 09:45:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0B0061AD0 for ; Fri, 15 Mar 2024 09:44:47 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-gAlhuUMnOjWvB57ifXGOBw-1; Fri, 15 Mar 2024 09:44:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EAB9800269 for ; Fri, 15 Mar 2024 13:44:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D88FC1576F for ; Fri, 15 Mar 2024 13:44:45 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: gAlhuUMnOjWvB57ifXGOBw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 23/28] virsh: Annotate "unwanted_positional" arguments for 'pool-(define|create)-as' commands Date: Fri, 15 Mar 2024 14:44:18 +0100 Message-ID: <464b2bbece04bc0482ff3714f14665eed0ce178a.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: PKAAZT6WUKDKVVA5QV2XCJSG33MZN3BD X-Message-ID-Hash: PKAAZT6WUKDKVVA5QV2XCJSG33MZN3BD X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511451132100001 Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) All of these options were added in order thus we must declare all of them as 'unwanted_positional'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-pool.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 67cc1b94cf..66f8516017 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -76,80 +76,99 @@ }, \ {.name =3D "source-host", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .completer =3D virshCompleteEmpty, \ .help =3D N_("source-host for underlying storage") \ }, \ {.name =3D "source-path", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("source path for underlying storage") \ }, \ {.name =3D "source-dev", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("source device for underlying storage") \ }, \ {.name =3D "source-name", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("source name for underlying storage") \ }, \ {.name =3D "target", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("target for underlying storage") \ }, \ {.name =3D "source-format", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("format for underlying storage") \ }, \ {.name =3D "auth-type", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("auth type to be used for underlying storage") \ }, \ {.name =3D "auth-username", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .completer =3D virshCompleteEmpty, \ .help =3D N_("auth username to be used for underlying storage") \ }, \ {.name =3D "secret-usage", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("auth secret usage to be used for underlying storage") \ }, \ {.name =3D "secret-uuid", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("auth secret UUID to be used for underlying storage") \ }, \ {.name =3D "adapter-name", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter name to be used for underlying storage") \ }, \ {.name =3D "adapter-wwnn", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter wwnn to be used for underlying storage") \ }, \ {.name =3D "adapter-wwpn", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter wwpn to be used for underlying storage") \ }, \ {.name =3D "adapter-parent", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter parent scsi_hostN to be used for underlying vHB= A storage") \ }, \ {.name =3D "adapter-parent-wwnn", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter parent scsi_hostN wwnn to be used for underlyin= g vHBA storage") \ }, \ {.name =3D "adapter-parent-wwpn", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter parent scsi_hostN wwpn to be used for underlyin= g vHBA storage") \ }, \ {.name =3D "adapter-parent-fabric-wwn", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("adapter parent scsi_hostN fabric_wwn to be used for und= erlying vHBA storage") \ }, \ {.name =3D "source-protocol-ver", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .help =3D N_("nfsvers value for NFS pool mount option") \ }, \ {.name =3D "source-initiator", \ .type =3D VSH_OT_STRING, \ + .unwanted_positional =3D true, \ .completer =3D virshCompleteEmpty, \ .help =3D N_("initiator iqn for underlying storage") \ } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511868082190.21518546377263; Fri, 15 Mar 2024 07:11:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 87F911C98; Fri, 15 Mar 2024 10:11:06 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8363F1E9B; Fri, 15 Mar 2024 09:46:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 28E901AB9; Fri, 15 Mar 2024 09:45:40 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A34DC1A85 for ; Fri, 15 Mar 2024 09:44:49 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-8pxmjQM8O0-gMT4L4wvXcA-1; Fri, 15 Mar 2024 09:44:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46516185A784 for ; Fri, 15 Mar 2024 13:44:47 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8352EC1576F for ; Fri, 15 Mar 2024 13:44:46 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 8pxmjQM8O0-gMT4L4wvXcA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 24/28] virsh: Annodate 'unwanted_positional' arguments Date: Fri, 15 Mar 2024 14:44:19 +0100 Message-ID: <003c0c5e3b50da77a0b1db78c3a31ca73475dae7.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: QFTPGH5PD4EKPHKEOI4IWU54HFII6K7F X-Message-ID-Hash: QFTPGH5PD4EKPHKEOI4IWU54HFII6K7F X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511869190100001 Historically the command parser in virsh parses/fills even optional arguments with values as if they were positional unless opted out using VSH_OFLAG_REQ_OPT. This creates unexpected situations when commands can break in this unwanted semantics: $ virsh snapshot-create-as --print-xml 1 2 3 2 3 To prevent any further addition annotate the rest of the arguments with the 'unwanted_positional' flag, so that the parser can keep parsing them as such but any further optional argument will not have this behaviour. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-checkpoint.c | 3 ++ tools/virsh-domain-event.c | 3 ++ tools/virsh-domain-monitor.c | 2 + tools/virsh-domain.c | 75 ++++++++++++++++++++++++++++++++++++ tools/virsh-host.c | 24 ++++++++++++ tools/virsh-interface.c | 1 + tools/virsh-network.c | 7 ++++ tools/virsh-nodedev.c | 5 +++ tools/virsh-pool.c | 8 ++++ tools/virsh-secret.c | 4 ++ tools/virsh-snapshot.c | 3 ++ tools/virsh-volume.c | 10 +++++ 12 files changed, 145 insertions(+) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 7151e2b182..48e3a586e4 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -189,11 +189,13 @@ static const vshCmdOptDef opts_checkpoint_create_as[]= =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "name", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("name of checkpoint") }, {.name =3D "description", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("description of checkpoint") }, @@ -630,6 +632,7 @@ static const vshCmdOptDef opts_checkpoint_list[] =3D { }, {.name =3D "from", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("limit list to children of given checkpoint"), .completer =3D virshCheckpointNameCompleter, }, diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c index 73b00f3bb2..8bf57ade7a 100644 --- a/tools/virsh-domain-event.c +++ b/tools/virsh-domain-event.c @@ -867,11 +867,13 @@ static const vshCmdInfo info_event =3D { static const vshCmdOptDef opts_event[] =3D { {.name =3D "domain", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by domain name, id or uuid"), .completer =3D virshDomainNameCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainEventNameCompleter, .help =3D N_("which event type to wait for") }, @@ -885,6 +887,7 @@ static const vshCmdOptDef opts_event[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "list", diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 71a5086c00..d88cf64235 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1349,6 +1349,7 @@ static const vshCmdOptDef opts_domtime[] =3D { }, {.name =3D "time", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("time to set") }, {.name =3D NULL} @@ -2231,6 +2232,7 @@ static const vshCmdOptDef opts_domifaddr[] =3D { .help =3D N_("always display names and MACs of interfaces")}, {.name =3D "source", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainInterfaceAddrSourceCompleter, .help =3D N_("address source: 'lease', 'agent', or 'arp'")}, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 9a41e32e3d..600388dceb 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -844,34 +844,41 @@ static const vshCmdOptDef opts_attach_interface[] =3D= { }, {.name =3D "target", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("target network name") }, {.name =3D "mac", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("MAC address") }, {.name =3D "script", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("script used to bridge network interface") }, {.name =3D "model", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("model type") }, {.name =3D "alias", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("custom alias name of interface device") }, {.name =3D "inbound", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("control domain's incoming traffics") }, {.name =3D "outbound", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("control domain's outgoing traffics") }, @@ -889,6 +896,7 @@ static const vshCmdOptDef opts_attach_interface[] =3D { }, {.name =3D "source-mode", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainInterfaceSourceModeCompleter, .help =3D N_("mode attribute of element") }, @@ -1550,30 +1558,36 @@ static const vshCmdOptDef opts_blkiotune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "weight", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("IO Weight") }, {.name =3D "device-weights", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("per-device IO Weights, in the form of /path/to/device,w= eight,...") }, {.name =3D "device-read-iops-sec", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("per-device read I/O limit per second, in the form of /p= ath/to/device,read_iops_sec,...") }, {.name =3D "device-write-iops-sec", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("per-device write I/O limit per second, in the form of /= path/to/device,write_iops_sec,...") }, {.name =3D "device-read-bytes-sec", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("per-device bytes read per second, in the form of /path/= to/device,read_bytes_sec,...") }, {.name =3D "device-write-bytes-sec", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("per-device bytes wrote per second, in the form of /path= /to/device,write_bytes_sec,...") }, @@ -2031,10 +2045,12 @@ static const vshCmdOptDef opts_blockcommit[] =3D { }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("bandwidth limit in MiB/s") }, {.name =3D "base", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainBlockjobBaseTopCompleter, .help =3D N_("path of base file to commit into (default bottom of cha= in)") }, @@ -2044,6 +2060,7 @@ static const vshCmdOptDef opts_blockcommit[] =3D { }, {.name =3D "top", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainBlockjobBaseTopCompleter, .help =3D N_("path of top file to commit from (default top of chain)") }, @@ -2066,6 +2083,7 @@ static const vshCmdOptDef opts_blockcommit[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("implies --wait, abort if copy exceeds timeout (in secon= ds)") }, {.name =3D "pivot", @@ -2251,10 +2269,12 @@ static const vshCmdOptDef opts_blockcopy[] =3D { }, {.name =3D "dest", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("path of the copy to create") }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("bandwidth limit in MiB/s") }, {.name =3D "shallow", @@ -2283,6 +2303,7 @@ static const vshCmdOptDef opts_blockcopy[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("implies --wait, abort if copy exceeds timeout (in secon= ds)") }, {.name =3D "pivot", @@ -2299,21 +2320,25 @@ static const vshCmdOptDef opts_blockcopy[] =3D { }, {.name =3D "xml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing XML description of the copy destina= tion") }, {.name =3D "format", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("format of the destination file") }, {.name =3D "granularity", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("power-of-two granularity to use during the copy") }, {.name =3D "buf-size", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("maximum amount of in-flight data during the copy") }, {.name =3D "bytes", @@ -2608,6 +2633,7 @@ static const vshCmdOptDef opts_blockjob[] =3D { }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("set the bandwidth limit in MiB/s") }, {.name =3D NULL} @@ -2796,10 +2822,12 @@ static const vshCmdOptDef opts_blockpull[] =3D { }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("bandwidth limit in MiB/s") }, {.name =3D "base", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainBlockjobBaseTopCompleter, .help =3D N_("path of backing file in chain for a partial pull") }, @@ -2813,6 +2841,7 @@ static const vshCmdOptDef opts_blockpull[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("with --wait, abort if pull exceeds timeout (in seconds)= ") }, {.name =3D "async", @@ -3000,6 +3029,7 @@ static const vshCmdOptDef opts_console[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "devname", /* sc_prohibit_devname */ .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainConsoleCompleter, .help =3D N_("character device name") }, @@ -3246,11 +3276,13 @@ static const vshCmdOptDef opts_domiftune[] =3D { }, {.name =3D "inbound", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("control domain's incoming traffics") }, {.name =3D "outbound", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("control domain's outgoing traffics") }, @@ -3568,6 +3600,7 @@ static const vshCmdOptDef opts_undefine[] =3D { }, {.name =3D "storage", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainUndefineStorageDisksCompleter, .help =3D N_("remove associated storage volumes (comma separated list= of " "targets or source paths) (see domblklist)") @@ -4013,6 +4046,7 @@ static const vshCmdOptDef opts_start[] =3D { }, {.name =3D "pass-fds", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("pass file descriptors N,M,... to the guest") }, @@ -4159,6 +4193,7 @@ static const vshCmdOptDef opts_save[] =3D { }, {.name =3D "xml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") }, @@ -5250,6 +5285,7 @@ static const vshCmdOptDef opts_restore[] =3D { }, {.name =3D "xml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") }, @@ -5352,6 +5388,7 @@ static const vshCmdOptDef opts_dump[] =3D { {.name =3D "format", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_NONE, + .unwanted_positional =3D true, .completer =3D virshDomainCoreDumpFormatCompleter, .help =3D N_("specify the format of memory-only dump") }, @@ -5495,11 +5532,13 @@ static const vshCmdOptDef opts_screenshot[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("where to store the screenshot") }, {.name =3D "screen", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("ID of a screen to take screenshot of") }, {.name =3D NULL} @@ -6834,11 +6873,13 @@ static const vshCmdOptDef opts_vcpupin[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "vcpu", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshDomainVcpuCompleter, .help =3D N_("vcpu number") }, {.name =3D "cpulist", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_EMPTY_OK, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set, or omit option to query") @@ -7047,6 +7088,7 @@ static const vshCmdOptDef opts_emulatorpin[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "cpulist", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_EMPTY_OK, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set, or omit option to query") @@ -7231,6 +7273,7 @@ static const vshCmdOptDef opts_guestvcpus[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "cpulist", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainVcpulistViaAgentCompleter, .help =3D N_("list of cpus to enable or disable") }, @@ -7653,22 +7696,27 @@ static const vshCmdOptDef opts_iothreadset[] =3D { }, {.name =3D "poll-max-ns", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("set the maximum IOThread polling time in ns") }, {.name =3D "poll-grow", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("set the value to increase the IOThread polling time") }, {.name =3D "poll-shrink", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("set the value for reduction of the IOThread polling tim= e") }, {.name =3D "thread-pool-min", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("lower boundary for worker thread pool") }, {.name =3D "thread-pool-max", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("upper boundary for worker thread pool") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -7824,10 +7872,12 @@ static const vshCmdOptDef opts_cpu_stats[] =3D { }, {.name =3D "start", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Show statistics from this CPU") }, {.name =3D "count", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Number of shown CPUs at most") }, {.name =3D NULL} @@ -8010,6 +8060,7 @@ static const vshCmdOptDef opts_create[] =3D { }, {.name =3D "pass-fds", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("pass file descriptors N,M,... to the guest") }, @@ -8368,10 +8419,12 @@ static const vshCmdOptDef opts_metadata[] =3D { }, {.name =3D "key", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("key to be used as a namespace identifier"), }, {.name =3D "set", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("new metadata to set"), }, @@ -8856,15 +8909,18 @@ static const vshCmdOptDef opts_update_memory_device= [] =3D { }, {.name =3D "alias", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainDeviceAliasCompleter, .help =3D N_("memory device alias") }, {.name =3D "node", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("memory device target node") }, {.name =3D "requested-size", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("new value of size, as scaled integer (defa= ult KiB)") }, {.name =3D NULL} @@ -8998,18 +9054,22 @@ static const vshCmdOptDef opts_memtune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "hard-limit", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Max memory, as scaled integer (default KiB)") }, {.name =3D "soft-limit", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Memory during contention, as scaled integer (default Ki= B)") }, {.name =3D "swap-hard-limit", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Max memory plus swap, as scaled integer (default KiB)") }, {.name =3D "min-guarantee", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Min guaranteed memory, as scaled integer (default KiB)") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -9165,11 +9225,13 @@ static const vshCmdOptDef opts_perf[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "enable", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainPerfEnableCompleter, .help =3D N_("perf events which will be enabled") }, {.name =3D "disable", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainPerfDisableCompleter, .help =3D N_("perf events which will be disabled") }, @@ -9289,12 +9351,14 @@ static const vshCmdOptDef opts_numatune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "mode", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainNumatuneModeCompleter, .help =3D N_("NUMA mode, one of strict, preferred and interleave " "or a number from the virDomainNumatuneMemMode enum") }, {.name =3D "nodeset", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("NUMA node selections to set") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -9470,6 +9534,7 @@ static const vshCmdOptDef opts_domsetlaunchsecstate[]= =3D { }, {.name =3D "set-address", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("physical address within the guest domain's memory to se= t the secret"), }, {.name =3D NULL} @@ -9872,11 +9937,13 @@ static const vshCmdInfo info_qemu_monitor_event =3D= { static const vshCmdOptDef opts_qemu_monitor_event[] =3D { {.name =3D "domain", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by domain name, id or uuid"), .completer =3D virshDomainNameCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by event name") }, {.name =3D "pretty", @@ -9889,6 +9956,7 @@ static const vshCmdOptDef opts_qemu_monitor_event[] = =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "regex", @@ -10379,6 +10447,7 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { }, {.name =3D "xml", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("xml data file to export from") }, @@ -11871,6 +11940,7 @@ static const vshCmdOptDef opts_domhostname[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "source", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainHostnameSourceCompleter, .help =3D N_("address source: 'lease' or 'agent'")}, @@ -12144,6 +12214,7 @@ static const vshCmdOptDef opts_detach_interface[] = =3D { }, {.name =3D "mac", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainInterfaceCompleter, .completer_flags =3D VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, .help =3D N_("MAC address") @@ -12823,11 +12894,13 @@ static const vshCmdOptDef opts_domfstrim[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "minimum", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Just a hint to ignore contiguous " "free ranges smaller than this (Bytes)") }, {.name =3D "mountpoint", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainFSMountpointsCompleter, .help =3D N_("which mount point to trim") }, @@ -13295,11 +13368,13 @@ static const vshCmdOptDef opts_domdirtyrate_calc[= ] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "seconds", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("calculate memory dirty rate within specified seconds, " "the supported value range from 1 to 60, default to 1.") }, {.name =3D "mode", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainDirtyRateCalcModeCompleter, .help =3D N_("dirty page rate calculation mode, either of these 3 opt= ions " "'page-sampling, dirty-bitmap, dirty-ring' can be specifie= d.") diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 712db39d35..52e0dc55de 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -86,20 +86,24 @@ static const vshCmdInfo info_domcapabilities =3D { static const vshCmdOptDef opts_domcapabilities[] =3D { {.name =3D "virttype", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainVirtTypeCompleter, .help =3D N_("virtualization type (/domain/@type)"), }, {.name =3D "emulatorbin", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("path to emulator binary (/domain/devices/emulator)"), }, {.name =3D "arch", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshArchCompleter, .help =3D N_("domain architecture (/domain/os/type/@arch)"), }, {.name =3D "machine", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("machine type (/domain/os/type/@machine)"), }, {.name =3D "xpath", @@ -156,6 +160,7 @@ static const vshCmdInfo info_freecell =3D { static const vshCmdOptDef opts_freecell[] =3D { {.name =3D "cellno", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshCellnoCompleter, .help =3D N_("NUMA cell number") }, @@ -264,11 +269,13 @@ static const vshCmdInfo info_freepages =3D { static const vshCmdOptDef opts_freepages[] =3D { {.name =3D "cellno", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshCellnoCompleter, .help =3D N_("NUMA cell number") }, {.name =3D "pagesize", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshAllocpagesPagesizeCompleter, .help =3D N_("page size (in kibibytes)") }, @@ -481,6 +488,7 @@ static const vshCmdOptDef opts_allocpages[] =3D { }, {.name =3D "cellno", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshCellnoCompleter, .help =3D N_("NUMA cell number") }, @@ -582,6 +590,7 @@ static const vshCmdInfo info_maxvcpus =3D { static const vshCmdOptDef opts_maxvcpus[] =3D { {.name =3D "type", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainVirtTypeCompleter, .help =3D N_("domain type") }, @@ -712,6 +721,7 @@ static const vshCmdInfo info_nodecpustats =3D { static const vshCmdOptDef opts_node_cpustats[] =3D { {.name =3D "cpu", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .completer =3D virshNodeCpuCompleter, .help =3D N_("prints specified cpu statistics only.") }, @@ -850,6 +860,7 @@ static const vshCmdInfo info_nodememstats =3D { static const vshCmdOptDef opts_node_memstats[] =3D { {.name =3D "cell", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("prints specified cell statistics only.") }, {.name =3D NULL} @@ -1421,16 +1432,19 @@ static const vshCmdInfo info_node_memory_tune =3D { static const vshCmdOptDef opts_node_memory_tune[] =3D { {.name =3D "shm-pages-to-scan", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("number of pages to scan before the shared memory servi= ce " "goes to sleep") }, {.name =3D "shm-sleep-millisecs", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("number of millisecs the shared memory service should " "sleep before next scan") }, {.name =3D "shm-merge-across-nodes", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Specifies if pages from different numa nodes can be me= rged") }, {.name =3D NULL} @@ -1535,20 +1549,24 @@ static const vshCmdOptDef opts_hypervisor_cpu_compa= re[] =3D { VIRSH_COMMON_OPT_FILE(N_("file containing an XML CPU description")), {.name =3D "virttype", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainVirtTypeCompleter, .help =3D N_("virtualization type (/domain/@type)"), }, {.name =3D "emulator", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("path to emulator binary (/domain/devices/emulator)"), }, {.name =3D "arch", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshArchCompleter, .help =3D N_("CPU architecture (/domain/os/type/@arch)"), }, {.name =3D "machine", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("machine type (/domain/os/type/@machine)"), }, {.name =3D "error", @@ -1637,25 +1655,30 @@ static const vshCmdInfo info_hypervisor_cpu_baselin= e =3D { static const vshCmdOptDef opts_hypervisor_cpu_baseline[] =3D { {.name =3D "file", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("file containing XML CPU descriptions"), }, {.name =3D "virttype", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshDomainVirtTypeCompleter, .help =3D N_("virtualization type (/domain/@type)"), }, {.name =3D "emulator", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("path to emulator binary (/domain/devices/emulator)"), }, {.name =3D "arch", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshArchCompleter, .help =3D N_("CPU architecture (/domain/os/type/@arch)"), }, {.name =3D "machine", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("machine type (/domain/os/type/@machine)"), }, {.name =3D "features", @@ -1668,6 +1691,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baselin= e[] =3D { }, {.name =3D "model", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCPUModelCompleter, .help =3D N_("Shortcut for calling the command with a single CPU mode= l " "and no additional features") diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 1b1344c17c..a08bb822ed 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -736,6 +736,7 @@ static const vshCmdOptDef opts_interface_bridge[] =3D { }, {.name =3D "delay", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("number of seconds to squelch traffic on newly connected= ports") }, {.name =3D "no-start", diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 59ca842181..5bc91a361f 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -506,11 +506,13 @@ static const vshCmdOptDef opts_network_metadata[] =3D= { .help =3D N_("use an editor to change the metadata") }, {.name =3D "key", + .unwanted_positional =3D true, .type =3D VSH_OT_STRING, .help =3D N_("key to be used as a namespace identifier"), }, {.name =3D "set", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("new metadata to set"), }, @@ -1240,6 +1242,7 @@ static const vshCmdOptDef opts_network_update[] =3D { }, {.name =3D "parent-index", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("which parent object to search through") }, VIRSH_COMMON_OPT_CONFIG(N_("affect next network startup")), @@ -1579,11 +1582,13 @@ static const vshCmdInfo info_network_event =3D { static const vshCmdOptDef opts_network_event[] =3D { {.name =3D "network", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by network name or uuid"), .completer =3D virshNetworkNameCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshNetworkEventNameCompleter, .help =3D N_("which event type to wait for") }, @@ -1593,6 +1598,7 @@ static const vshCmdOptDef opts_network_event[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "list", @@ -1694,6 +1700,7 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = =3D { VIRSH_COMMON_OPT_NETWORK_FULL(VIR_CONNECT_LIST_NETWORKS_ACTIVE), {.name =3D "mac", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .flags =3D VSH_OFLAG_NONE, .help =3D N_("MAC address"), .completer =3D virshNetworkDhcpMacCompleter, diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 90cfc187e5..fafebf9972 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -365,6 +365,7 @@ static const vshCmdOptDef opts_node_list_devices[] =3D { }, {.name =3D "cap", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshNodeDeviceCapabilityNameCompleter, .help =3D N_("capability names, separated by comma") }, @@ -643,6 +644,7 @@ static const vshCmdOptDef opts_node_device_detach[] =3D= { }, {.name =3D "driver", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshNodeDevicePCIBackendCompleter, .help =3D N_("pci device assignment backend driver (e.g. 'vfio' or 'x= en')") }, @@ -884,11 +886,13 @@ static const vshCmdInfo info_node_device_event =3D { static const vshCmdOptDef opts_node_device_event[] =3D { {.name =3D "device", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by node device name"), .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshNodeDeviceEventNameCompleter, .help =3D N_("which event type to wait for") }, @@ -898,6 +902,7 @@ static const vshCmdOptDef opts_node_device_event[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "list", diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 66f8516017..c93204dd30 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1055,6 +1055,7 @@ static const vshCmdOptDef opts_pool_list[] =3D { {.name =3D "type", .type =3D VSH_OT_STRING, .completer =3D virshPoolTypeCompleter, + .unwanted_positional =3D true, .completer_flags =3D VIRSH_POOL_TYPE_COMPLETER_COMMA, .help =3D N_("only list pool of specified type(s) (if supported)") }, @@ -1382,16 +1383,19 @@ static const vshCmdOptDef opts_find_storage_pool_so= urces_as[] =3D { }, {.name =3D "host", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("optional host to query") }, {.name =3D "port", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("optional port to query") }, {.name =3D "initiator", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("optional initiator IQN to use for query") }, @@ -1466,6 +1470,7 @@ static const vshCmdOptDef opts_find_storage_pool_sour= ces[] =3D { }, {.name =3D "srcSpec", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompletePathLocalExisting, .help =3D N_("optional file of source xml to query for pools") }, @@ -1901,11 +1906,13 @@ static const vshCmdInfo info_pool_event =3D { static const vshCmdOptDef opts_pool_event[] =3D { {.name =3D "pool", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshStoragePoolNameCompleter, .help =3D N_("filter by storage pool name or uuid") }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshPoolEventNameCompleter, .help =3D N_("which event type to wait for") }, @@ -1915,6 +1922,7 @@ static const vshCmdOptDef opts_pool_event[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "list", diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 7e10afa765..edf3c47362 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -201,6 +201,7 @@ static const vshCmdOptDef opts_secret_set_value[] =3D { }, {.name =3D "base64", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("base64-encoded secret value") }, @@ -714,11 +715,13 @@ static const vshCmdInfo info_secret_event =3D { static const vshCmdOptDef opts_secret_event[] =3D { {.name =3D "secret", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("filter by secret name or uuid"), .completer =3D virshSecretUUIDCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshSecretEventNameCompleter, .help =3D N_("which event type to wait for") }, @@ -728,6 +731,7 @@ static const vshCmdOptDef opts_secret_event[] =3D { }, {.name =3D "timeout", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("timeout seconds") }, {.name =3D "list", diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index b47733d05b..2fcf6e3d5e 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -314,11 +314,13 @@ static const vshCmdOptDef opts_snapshot_create_as[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "name", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("name of snapshot") }, {.name =3D "description", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("description of snapshot") }, @@ -1379,6 +1381,7 @@ static const vshCmdOptDef opts_snapshot_list[] =3D { }, {.name =3D "from", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshSnapshotNameCompleter, .help =3D N_("limit list to children of given snapshot") }, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 7e6c6d5ef5..4e5673e0ee 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -190,19 +190,23 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { }, {.name =3D "allocation", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("initial allocation size, as scaled integer (default byt= es)") }, {.name =3D "format", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("file format type raw,bochs,qcow,qcow2,qed,vmdk") }, {.name =3D "backing-vol", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("the backing volume if taking a snapshot") }, {.name =3D "backing-vol-format", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .help =3D N_("format of backing volume if taking a snapshot") }, {.name =3D "prealloc-metadata", @@ -432,6 +436,7 @@ static const vshCmdOptDef opts_vol_create_from[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "inputpool", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshStoragePoolNameCompleter, .help =3D N_("pool name or uuid of the input volume's pool") }, @@ -613,10 +618,12 @@ static const vshCmdOptDef opts_vol_upload[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "offset", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("volume offset to upload to") }, {.name =3D "length", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("amount of data to upload") }, {.name =3D "sparse", @@ -721,10 +728,12 @@ static const vshCmdOptDef opts_vol_download[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "offset", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("volume offset to download from") }, {.name =3D "length", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("amount of data to download") }, {.name =3D "sparse", @@ -875,6 +884,7 @@ static const vshCmdOptDef opts_vol_wipe[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "algorithm", .type =3D VSH_OT_STRING, + .unwanted_positional =3D true, .completer =3D virshStorageVolWipeAlgorithmCompleter, .help =3D N_("perform selected wiping algorithm") }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511404441245.82071642602443; Fri, 15 Mar 2024 07:03:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 458A517DD; Fri, 15 Mar 2024 10:03:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0D7671D7C; Fri, 15 Mar 2024 09:46:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 49EBB190C; Fri, 15 Mar 2024 09:45:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 683231B56 for ; Fri, 15 Mar 2024 09:44:51 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-P0SrvqrMMfidKAn6Tu2osA-1; Fri, 15 Mar 2024 09:44:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2BB3E101A552 for ; Fri, 15 Mar 2024 13:44:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AE56C15772 for ; Fri, 15 Mar 2024 13:44:47 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: P0SrvqrMMfidKAn6Tu2osA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 25/28] virt-admin: Annodate 'unwanted_positional' arguments Date: Fri, 15 Mar 2024 14:44:20 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 35EZDJVFH7RYNETP3ZLUKGF6SYSIM6ET X-Message-ID-Hash: 35EZDJVFH7RYNETP3ZLUKGF6SYSIM6ET X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511404949100001 Historically the command parser in virsh parses/fills even optional arguments with values as if they were positional unless opted out using VSH_OFLAG_REQ_OPT. This creates unexpected situations when commands can break in this unwanted semantics: $ virsh snapshot-create-as --print-xml 1 2 3 2 3 To prevent any further addition annotate the rest of the arguments with the 'unwanted_positional' flag, so that the parser can keep parsing them as such but any further optional argument will not have this behaviour. Certain arguments where it makes sense are annotated as 'positional' too in this patch. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virt-admin.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 3e3361fbf1..514f434c94 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -425,14 +425,17 @@ static const vshCmdOptDef opts_srv_threadpool_set[] = =3D { }, {.name =3D "min-workers", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Change bottom limit to number of workers."), }, {.name =3D "max-workers", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Change upper limit to number of workers."), }, {.name =3D "priority-workers", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Change the current number of priority workers"), }, {.name =3D NULL} @@ -812,11 +815,13 @@ static const vshCmdOptDef opts_srv_clients_set[] =3D { }, {.name =3D "max-clients", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Change the upper limit to overall number of clients " "connected to the server."), }, {.name =3D "max-unauth-clients", .type =3D VSH_OT_INT, + .unwanted_positional =3D true, .help =3D N_("Change the upper limit to number of clients waiting for= " "authentication to be connected to the server"), }, @@ -954,6 +959,7 @@ static const vshCmdInfo info_daemon_log_filters =3D { static const vshCmdOptDef opts_daemon_log_filters[] =3D { {.name =3D "filters", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("redefine the existing set of logging filters"), .flags =3D VSH_OFLAG_EMPTY_OK }, @@ -1037,6 +1043,7 @@ static const vshCmdInfo info_daemon_timeout =3D { static const vshCmdOptDef opts_daemon_log_outputs[] =3D { {.name =3D "outputs", .type =3D VSH_OT_STRING, + .positional =3D true, .help =3D N_("redefine the existing set of logging outputs"), .flags =3D VSH_OFLAG_EMPTY_OK }, --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511693301278.9567826409898; Fri, 15 Mar 2024 07:08:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E78901F0F; Fri, 15 Mar 2024 10:08:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9395E1E62; Fri, 15 Mar 2024 09:46:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C5E511A83; Fri, 15 Mar 2024 09:45:38 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 8C0A11BB1 for ; Fri, 15 Mar 2024 09:44:51 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-503-aV2xr2rfMdKpGoJmlgSRWA-1; Fri, 15 Mar 2024 09:44:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 13C43101A56C for ; Fri, 15 Mar 2024 13:44:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 813B2C1576F for ; Fri, 15 Mar 2024 13:44:48 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: aV2xr2rfMdKpGoJmlgSRWA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 26/28] vsh: Make positional parsing of arguments opt-in Date: Fri, 15 Mar 2024 14:44:21 +0100 Message-ID: <442e12c2a6754737a2a99cf2352ac1fc235576ee.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 5FVWZEUZU5FKVH4EL7J5MCZGBV2C2NDG X-Message-ID-Hash: 5FVWZEUZU5FKVH4EL7J5MCZGBV2C2NDG X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511706366100001 Switch the command parser from using the VSH_OFLAG_REQ_OPT flag opting out from positional parsing of arguments to a combination of the 'positional' flags for truly positional arguments and 'unwanted_positional' preserving semantics for the existing arguments where the parser did it due to bad design. This patch retires VSH_OFLAG_REQ_OPT along with the infrastructure that was needed to refactor all uses properly. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-backup.c | 1 - tools/virsh-checkpoint.c | 1 - tools/virsh-domain-monitor.c | 1 - tools/virsh-domain.c | 69 ------------------------------------ tools/virsh-host.c | 2 -- tools/virsh-interface.c | 1 - tools/virsh-network.c | 2 -- tools/virsh-nodedev.c | 1 - tools/virsh-nwfilter.c | 2 -- tools/virsh-pool.c | 1 - tools/virsh-secret.c | 2 -- tools/virsh-snapshot.c | 2 -- tools/virsh-volume.c | 1 - tools/virt-admin.c | 1 - tools/vsh.c | 44 ++--------------------- tools/vsh.h | 1 - 16 files changed, 3 insertions(+), 129 deletions(-) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index 52325b5ca0..9a1e89760f 100644 --- a/tools/virsh-backup.c +++ b/tools/virsh-backup.c @@ -109,7 +109,6 @@ static const vshCmdOptDef opts_backup_dumpxml[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 48e3a586e4..e425041ca7 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -829,7 +829,6 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index d88cf64235..5531d3b737 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -277,7 +277,6 @@ static const vshCmdOptDef opts_dommemstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "period", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("period in seconds to set collection") }, VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")), diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 600388dceb..91a9dfd96a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -434,38 +434,31 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "targetbus", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("target bus of disk device") }, {.name =3D "driver", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("driver of disk device") }, {.name =3D "subdriver", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("subdriver of disk device") }, {.name =3D "iothread", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("IOThread to be used by supported device") }, {.name =3D "cache", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("cache mode of disk device") }, {.name =3D "io", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("io policy of disk device") }, {.name =3D "type", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("target device type") }, {.name =3D "shareable", @@ -474,29 +467,24 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "mode", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("mode of device reading and writing") }, {.name =3D "sourcetype", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("type of source (block|file|network)") }, {.name =3D "serial", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("serial of disk device") }, {.name =3D "wwn", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("wwn of disk device") }, {.name =3D "alias", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("custom alias name of disk device") }, @@ -506,7 +494,6 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "address", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("address of disk device") }, @@ -520,23 +507,19 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "source-protocol", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("protocol used by disk device source") }, {.name =3D "source-host-name", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("host name for source of disk device") }, {.name =3D "source-host-transport", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("host transport for source of disk device") }, {.name =3D "source-host-socket", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("host socket for source of disk device") }, VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, @@ -1229,7 +1212,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total throughput limit, as scaled integer (default byte= s)") }, {.name =3D "read_bytes_sec", @@ -1238,7 +1220,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read throughput limit, as scaled integer (default bytes= )") }, {.name =3D "write_bytes_sec", @@ -1247,7 +1228,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write throughput limit, as scaled integer (default byt= es)") }, {.name =3D "total_iops_sec", @@ -1256,7 +1236,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total I/O operations limit per second") }, {.name =3D "read_iops_sec", @@ -1265,7 +1244,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read I/O operations limit per second") }, {.name =3D "write_iops_sec", @@ -1274,7 +1252,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write I/O operations limit per second") }, {.name =3D "total_bytes_sec_max", @@ -1283,7 +1260,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total max, as scaled integer (default bytes)") }, {.name =3D "read_bytes_sec_max", @@ -1292,7 +1268,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read max, as scaled integer (default bytes)") }, {.name =3D "write_bytes_sec_max", @@ -1301,7 +1276,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write max, as scaled integer (default bytes)") }, {.name =3D "total_iops_sec_max", @@ -1310,7 +1284,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("total I/O operations max") }, {.name =3D "read_iops_sec_max", @@ -1319,7 +1292,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("read I/O operations max") }, {.name =3D "write_iops_sec_max", @@ -1328,7 +1300,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec-max", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("write I/O operations max") }, {.name =3D "size_iops_sec", @@ -1337,7 +1308,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "size-iops-sec", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("I/O size in bytes") }, {.name =3D "group_name", @@ -1346,7 +1316,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "group-name", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("group name to share I/O quota between multiple drives") }, @@ -1356,7 +1325,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-bytes-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow total max bytes") }, {.name =3D "read_bytes_sec_max_length", @@ -1365,7 +1333,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-bytes-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow read max bytes") }, {.name =3D "write_bytes_sec_max_length", @@ -1374,7 +1341,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-bytes-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow write max bytes") }, {.name =3D "total_iops_sec_max_length", @@ -1383,7 +1349,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "total-iops-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow total I/O operations max") }, {.name =3D "read_iops_sec_max_length", @@ -1392,7 +1357,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "read-iops-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow read I/O operations max") }, {.name =3D "write_iops_sec_max_length", @@ -1401,7 +1365,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { }, {.name =3D "write-iops-sec-max-length", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds to allow write I/O operations max") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -3506,7 +3469,6 @@ static const vshCmdOptDef opts_dom_pm_suspend[] =3D { }, {.name =3D "duration", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds") }, {.name =3D NULL} @@ -4544,7 +4506,6 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -4950,7 +4911,6 @@ static const vshCmdOptDef opts_managed_save_dumpxml[]= =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -5060,12 +5020,10 @@ static const vshCmdOptDef opts_schedinfo[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "weight", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("weight for XEN_CREDIT") }, {.name =3D "cap", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("cap for XEN_CREDIT") }, VIRSH_COMMON_OPT_CURRENT(N_("get/set current scheduler info")), @@ -8576,13 +8534,11 @@ static const vshCmdOptDef opts_send_key[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "codeset", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCodesetNameCompleter, .help =3D N_("the codeset of keycodes, default:linux") }, {.name =3D "holdtime", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("the time (in milliseconds) how long the keys will be he= ld") }, {.name =3D "keycode", @@ -9524,12 +9480,10 @@ static const vshCmdOptDef opts_domsetlaunchsecstate= [] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "secrethdr", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("path to file containing the secret header"), }, {.name =3D "secret", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("path to file containing the secret"), }, {.name =3D "set-address", @@ -9702,7 +9656,6 @@ static const vshCmdOptDef opts_qemu_monitor_command[]= =3D { }, {.name =3D "pass-fds", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("pass file descriptors N,M,... along with the command") }, @@ -10091,7 +10044,6 @@ static const vshCmdOptDef opts_qemu_agent_command[]= =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "timeout", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("timeout seconds. must be positive.") }, {.name =3D "async", @@ -10329,7 +10281,6 @@ static const vshCmdOptDef opts_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -10441,7 +10392,6 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { }, {.name =3D "domain", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("domain name, id or uuid"), .completer =3D virshDomainNameCompleter, }, @@ -10797,49 +10747,40 @@ static const vshCmdOptDef opts_migrate[] =3D { }, {.name =3D "disks-uri", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("URI to use for disks migration (overrides --disks-port)= ") }, {.name =3D "comp-methods", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshDomainMigrateCompMethodsCompleter, .help =3D N_("comma separated list of compression methods to be used") }, {.name =3D "comp-mt-level", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for multithread compression") }, {.name =3D "comp-mt-threads", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of compression threads for multithread compressi= on") }, {.name =3D "comp-mt-dthreads", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of decompression threads for multithread compres= sion") }, {.name =3D "comp-xbzrle-cache", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("page cache size for xbzrle compression") }, {.name =3D "auto-converge-initial", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("initial CPU throttling rate for auto-convergence") }, {.name =3D "auto-converge-increment", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("CPU throttling rate increment for auto-convergence") }, {.name =3D "persistent-xml", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated persistent XML for the targ= et") }, @@ -10849,38 +10790,31 @@ static const vshCmdOptDef opts_migrate[] =3D { }, {.name =3D "postcopy-bandwidth", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("post-copy migration bandwidth limit in MiB/s") }, {.name =3D "parallel", .type =3D VSH_OT_BOOL, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("enable parallel migration") }, {.name =3D "parallel-connections", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("number of connections for parallel migration") }, {.name =3D "bandwidth", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("migration bandwidth limit in MiB/s") }, {.name =3D "tls-destination", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("override the destination host name used for TLS verific= ation") }, {.name =3D "comp-zlib-level", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for zlib compression") }, {.name =3D "comp-zstd-level", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("compress level for zstd compression") }, {.name =3D NULL} @@ -11439,7 +11373,6 @@ static const vshCmdOptDef opts_migrate_compcache[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "size", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("requested size of the cache (in bytes) used for compres= sion") }, {.name =3D NULL} @@ -13100,7 +13033,6 @@ static const vshCmdOptDef opts_guest_agent_timeout[= ] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "timeout", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("timeout seconds.") }, {.name =3D NULL} @@ -13448,7 +13380,6 @@ static const vshCmdOptDef opts_domdisplay_reload[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("graphics display type") }, {.name =3D NULL} diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 52e0dc55de..c338b5cd85 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -45,7 +45,6 @@ static const vshCmdInfo info_capabilities =3D { static const vshCmdOptDef opts_capabilities[] =3D { {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -108,7 +107,6 @@ static const vshCmdOptDef opts_domcapabilities[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index a08bb822ed..755c0d6455 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -453,7 +453,6 @@ static const vshCmdOptDef opts_interface_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 5bc91a361f..065e59c3a1 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -639,7 +639,6 @@ static const vshCmdOptDef opts_network_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -1874,7 +1873,6 @@ static const vshCmdOptDef opts_network_port_dumpxml[]= =3D { VIRSH_COMMON_OPT_NETWORK_PORT(0), {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index fafebf9972..b0563395f0 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -584,7 +584,6 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index f54d2a0ae5..69473b4935 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -175,7 +175,6 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -577,7 +576,6 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml= [] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index c93204dd30..aff1201ef7 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -748,7 +748,6 @@ static const vshCmdOptDef opts_pool_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index edf3c47362..5653451862 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -131,7 +131,6 @@ static const vshCmdOptDef opts_secret_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -187,7 +186,6 @@ static const vshCmdOptDef opts_secret_set_value[] =3D { }, {.name =3D "file", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompletePathLocalExisting, .help =3D N_("read secret from file"), }, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 2fcf6e3d5e..d64649a8da 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -359,7 +359,6 @@ static const vshCmdOptDef opts_snapshot_create_as[] =3D= { }, {.name =3D "memspec", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("memory attributes: [file=3D]name[,snapshot=3Dtype]") }, {.name =3D "diskspec", @@ -1587,7 +1586,6 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 4e5673e0ee..67a6f2eda0 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1130,7 +1130,6 @@ static const vshCmdOptDef opts_vol_dumpxml[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 514f434c94..9a29a67999 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1010,7 +1010,6 @@ static const vshCmdOptDef opts_daemon_timeout[] =3D { .type =3D VSH_OT_INT, .required =3D true, .help =3D N_("number of seconds the daemon will run without any activ= e connection"), - .flags =3D VSH_OFLAG_REQ_OPT }, {.name =3D NULL} }; diff --git a/tools/vsh.c b/tools/vsh.c index 2c90ca44f7..1dac869413 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -244,14 +244,12 @@ static int disconnected; /* we may have been disconne= cted */ static int vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *cmd, - bool missingCompleters, - int brokenPositionals) + bool missingCompleters) { size_t i; bool seenOptionalOption =3D false; const char *seenOptionalPositionalOption =3D NULL; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; - g_auto(virBuffer) posbuf =3D VIR_BUFFER_INITIALIZER; /* in order to perform the validation resolve the alias first */ if (cmd->alias) { @@ -328,29 +326,6 @@ vshCmddefCheckInternals(vshControl *ctl, } } - if (brokenPositionals >=3D 0) { - switch (opt->type) { - case VSH_OT_INT: - case VSH_OT_STRING: - case VSH_OT_ARGV: - if (brokenPositionals =3D=3D 0 || - brokenPositionals =3D=3D opt->type) { - if (!(opt->flags & VSH_OFLAG_REQ_OPT) && - !(opt->positional || opt->unwanted_positional)) - virBufferStrcat(&posbuf, opt->name, ", ", NULL); - } - break; - - case VSH_OT_BOOL: - /* only name is completed */ - /* no point in completing numbers */ - case VSH_OT_ALIAS: - /* alias is handled in the referenced command */ - case VSH_OT_NONE: - break; - } - } - /* allow at most one optional positional option */ if (opt->positional && !opt->required) { if (seenOptionalPositionalOption) { @@ -471,15 +446,10 @@ vshCmddefCheckInternals(vshControl *ctl, } virBufferTrim(&complbuf, ", "); - virBufferTrim(&posbuf, ", "); if (missingCompleters && virBufferUse(&complbuf) > 0) vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(= &complbuf)); - if (virBufferUse(&posbuf)) { - vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(= &posbuf)); - } - return 0; } @@ -508,7 +478,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, if (opt->type =3D=3D VSH_OT_ALIAS) continue; /* skip the alias option */ - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) + if (opt->positional || opt->unwanted_positional) *opts_need_arg |=3D 1ULL << i; if (opt->required) @@ -3387,11 +3357,6 @@ const vshCmdOptDef opts_selftest[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("output help for each command") }, - {.name =3D "broken-positionals", - .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, - .help =3D N_("debug positional args") - }, {.name =3D NULL} }; const vshCmdInfo info_selftest =3D { @@ -3406,9 +3371,6 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) const vshCmdDef *def; bool completers =3D vshCommandOptBool(cmd, "completers-missing"); bool dumphelp =3D vshCommandOptBool(cmd, "dump-help"); - int brokenPositionals =3D -1; - - ignore_value(vshCommandOptInt(ctl, cmd, "broken-positionals", &brokenP= ositionals)); for (grp =3D cmdGroups; grp->name; grp++) { for (def =3D grp->commands; def->name; def++) { @@ -3416,7 +3378,7 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) if (dumphelp && !def->alias) vshCmddefHelp(def); - if (vshCmddefCheckInternals(ctl, def, completers, brokenPositi= onals) < 0) + if (vshCmddefCheckInternals(ctl, def, completers) < 0) return false; } } diff --git a/tools/vsh.h b/tools/vsh.h index fdcc89b12a..02c35488b9 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -99,7 +99,6 @@ typedef enum { enum { VSH_OFLAG_NONE =3D 0, /* without flags */ VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ - VSH_OFLAG_REQ_OPT =3D (1 << 2), /* --optionname required */ }; /* forward declarations */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511510814334.92127096265335; Fri, 15 Mar 2024 07:05:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9C7E91EFB; Fri, 15 Mar 2024 10:05:09 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C6A811B11; Fri, 15 Mar 2024 09:46:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 837A8179C; Fri, 15 Mar 2024 09:45:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 CEF451BC9 for ; Fri, 15 Mar 2024 09:44:51 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-255-bmydWqXNMkeIGGm2AdG81A-1; Fri, 15 Mar 2024 09:44:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEC281C2CEC1 for ; Fri, 15 Mar 2024 13:44:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67475C15771 for ; Fri, 15 Mar 2024 13:44:49 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: bmydWqXNMkeIGGm2AdG81A-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 27/28] vsh: Replace 'VSH_OFLAG_EMPTY_OK' bitwise flag with a separate struct member Date: Fri, 15 Mar 2024 14:44:22 +0100 Message-ID: <79262171d399665d6df93ee085a2b2195e0b984d.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 32JGPXE44UZQROUWFIUEQF2QY67OP7AD X-Message-ID-Hash: 32JGPXE44UZQROUWFIUEQF2QY67OP7AD X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511511554100001 Replace the last bitwise flag with a separate member. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 2 +- tools/virsh-domain.c | 6 +++--- tools/virsh.c | 2 +- tools/virt-admin.c | 6 +++--- tools/vsh.c | 6 +++--- tools/vsh.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 5531d3b737..eec97b7d59 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -864,8 +864,8 @@ static const vshCmdOptDef opts_domblkstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "device", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_EMPTY_OK, .positional =3D true, + .allowEmpty =3D true, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") }, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 91a9dfd96a..1ba38629ac 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -422,7 +422,7 @@ static const vshCmdOptDef opts_attach_disk[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .help =3D N_("source of disk device or name of network disk") }, {.name =3D "target", @@ -6838,7 +6838,7 @@ static const vshCmdOptDef opts_vcpupin[] =3D { {.name =3D "cpulist", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set, or omit option to query") }, @@ -7047,7 +7047,7 @@ static const vshCmdOptDef opts_emulatorpin[] =3D { {.name =3D "cpulist", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set, or omit option to query") }, diff --git a/tools/virsh.c b/tools/virsh.c index 890c96e552..0a586fd639 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -246,7 +246,7 @@ static const vshCmdOptDef opts_connect[] =3D { {.name =3D "name", .type =3D VSH_OT_STRING, .positional =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .completer =3D virshCompleteEmpty, .help =3D N_("hypervisor connection URI") }, diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 9a29a67999..ce60077672 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -255,7 +255,7 @@ static const vshCmdOptDef opts_connect[] =3D { {.name =3D "name", .type =3D VSH_OT_STRING, .positional =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .help =3D N_("daemon's admin server connection URI") }, {.name =3D NULL} @@ -961,7 +961,7 @@ static const vshCmdOptDef opts_daemon_log_filters[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .help =3D N_("redefine the existing set of logging filters"), - .flags =3D VSH_OFLAG_EMPTY_OK + .allowEmpty =3D true }, {.name =3D NULL} }; @@ -1044,7 +1044,7 @@ static const vshCmdOptDef opts_daemon_log_outputs[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .help =3D N_("redefine the existing set of logging outputs"), - .flags =3D VSH_OFLAG_EMPTY_OK + .allowEmpty =3D true }, {.name =3D NULL} }; diff --git a/tools/vsh.c b/tools/vsh.c index 1dac869413..a12f0a635d 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1030,7 +1030,7 @@ vshCommandOptStringQuiet(vshControl *ctl G_GNUC_UNUSE= D, const vshCmd *cmd, if ((ret =3D vshCommandOpt(cmd, name, &arg, true)) <=3D 0) return ret; - if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) + if (!arg->def->allowEmpty && *arg->data =3D=3D '\0') return -1; *value =3D arg->data; return 1; @@ -1069,7 +1069,7 @@ vshCommandOptStringReq(vshControl *ctl, /* this should not be propagated here, just to be sure */ if (ret =3D=3D -1) error =3D N_("Mandatory option not present"); - else if (arg && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) + else if (arg && *arg->data =3D=3D '\0' && !arg->def->allowEmpty) error =3D N_("Option argument is empty"); if (error) { @@ -3394,7 +3394,7 @@ const vshCmdOptDef opts_complete[] =3D { {.name =3D "string", .type =3D VSH_OT_ARGV, .positional =3D true, - .flags =3D VSH_OFLAG_EMPTY_OK, + .allowEmpty =3D true, .help =3D N_("partial string to autocomplete") }, {.name =3D NULL} diff --git a/tools/vsh.h b/tools/vsh.h index 02c35488b9..1921645fca 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -98,7 +98,6 @@ typedef enum { */ enum { VSH_OFLAG_NONE =3D 0, /* without flags */ - VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ }; /* forward declarations */ @@ -140,6 +139,7 @@ struct _vshCmdOptDef { bool unwanted_positional; unsigned int flags; /* flags */ + bool allowEmpty; /* allow empty string */ const char *help; /* non-NULL help string; or for VSH_OT_ALI= AS * the name of a later public option */ vshCompleter completer; /* option completer */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat May 11 08:31:56 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710511557206801.2965985835616; Fri, 15 Mar 2024 07:05:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C21B21A75; Fri, 15 Mar 2024 10:05:55 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C5CE11E67; Fri, 15 Mar 2024 09:46:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CF4DB179C; Fri, 15 Mar 2024 09:45:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 687901BD3 for ; Fri, 15 Mar 2024 09:44:53 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-571-xF3kxy1INvyx7oevhwLUJw-1; Fri, 15 Mar 2024 09:44:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D398A101A552 for ; Fri, 15 Mar 2024 13:44:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E47FC15771 for ; Fri, 15 Mar 2024 13:44:50 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: xF3kxy1INvyx7oevhwLUJw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 28/28] vshCmdOptDef: Remove unused 'flags' member Date: Fri, 15 Mar 2024 14:44:23 +0100 Message-ID: <209bd1c8b1ca0e96b6a98f3d835cff04bb8dd71b.1710510137.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: BQUI5YI72AI3ML64ZYGBQQOHVM6XVQOV X-Message-ID-Hash: BQUI5YI72AI3ML64ZYGBQQOHVM6XVQOV X-MailFrom: pkrempa@redhat.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 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710511557793100001 Drop the last enum member VSH_OFLAG_NONE and remove the 'flags' variable from vshCmdOptDef. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 3 --- tools/virsh-domain.c | 4 ---- tools/virsh-network.c | 1 - tools/virsh-pool.c | 3 --- tools/vsh.c | 1 - tools/vsh.h | 8 -------- 6 files changed, 20 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index eec97b7d59..599ae71e7a 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2222,17 +2222,14 @@ static const vshCmdOptDef opts_domifaddr[] =3D { {.name =3D "interface", .type =3D VSH_OT_STRING, .positional =3D true, - .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("network interface name")}, {.name =3D "full", .type =3D VSH_OT_BOOL, - .flags =3D VSH_OFLAG_NONE, .help =3D N_("always display names and MACs of interfaces")}, {.name =3D "source", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainInterfaceAddrSourceCompleter, .help =3D N_("address source: 'lease', 'agent', or 'arp'")}, {.name =3D NULL} diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1ba38629ac..694958f990 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2290,7 +2290,6 @@ static const vshCmdOptDef opts_blockcopy[] =3D { {.name =3D "format", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("format of the destination file") }, @@ -5032,7 +5031,6 @@ static const vshCmdOptDef opts_schedinfo[] =3D { {.name =3D "set", .type =3D VSH_OT_ARGV, .positional =3D true, - .flags =3D VSH_OFLAG_NONE, .help =3D N_("parameter=3Dvalue") }, {.name =3D NULL} @@ -5345,7 +5343,6 @@ static const vshCmdOptDef opts_dump[] =3D { }, {.name =3D "format", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_NONE, .unwanted_positional =3D true, .completer =3D virshDomainCoreDumpFormatCompleter, .help =3D N_("specify the format of memory-only dump") @@ -11874,7 +11871,6 @@ static const vshCmdOptDef opts_domhostname[] =3D { {.name =3D "source", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_NONE, .completer =3D virshDomainHostnameSourceCompleter, .help =3D N_("address source: 'lease' or 'agent'")}, {.name =3D NULL} diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 065e59c3a1..e6552cbe57 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1700,7 +1700,6 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = =3D { {.name =3D "mac", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .flags =3D VSH_OFLAG_NONE, .help =3D N_("MAC address"), .completer =3D virshNetworkDhcpMacCompleter, }, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index aff1201ef7..24e7bb9bf5 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -37,21 +37,18 @@ #define VIRSH_COMMON_OPT_POOL_BUILD \ {.name =3D "build", \ .type =3D VSH_OT_BOOL, \ - .flags =3D 0, \ .help =3D N_("build the pool as normal") \ } #define VIRSH_COMMON_OPT_POOL_NO_OVERWRITE \ {.name =3D "no-overwrite", \ .type =3D VSH_OT_BOOL, \ - .flags =3D 0, \ .help =3D N_("do not overwrite any existing data") \ } #define VIRSH_COMMON_OPT_POOL_OVERWRITE \ {.name =3D "overwrite", \ .type =3D VSH_OT_BOOL, \ - .flags =3D 0, \ .help =3D N_("overwrite any existing data") \ } diff --git a/tools/vsh.c b/tools/vsh.c index a12f0a635d..7305160ed9 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -393,7 +393,6 @@ vshCmddefCheckInternals(vshControl *ctl, opt->positional || opt->unwanted_positional || opt->completer || - opt->flags || !opt->help) { vshError(ctl, "parameter '%s' of command '%s' has incorrec= t alias option", opt->name, cmd->name); diff --git a/tools/vsh.h b/tools/vsh.h index 1921645fca..f06d65407d 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -93,13 +93,6 @@ typedef enum { VSH_OT_ALIAS, /* alternate spelling for a later argument */ } vshCmdOptType; -/* - * Command Option Flags - */ -enum { - VSH_OFLAG_NONE =3D 0, /* without flags */ -}; - /* forward declarations */ typedef struct _vshClientHooks vshClientHooks; typedef struct _vshCmd vshCmd; @@ -138,7 +131,6 @@ struct _vshCmdOptDef { * 'unwanted_positional' flag. New options must not use this flag */ bool unwanted_positional; - unsigned int flags; /* flags */ bool allowEmpty; /* allow empty string */ const char *help; /* non-NULL help string; or for VSH_OT_ALI= AS * the name of a later public option */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org