From 1b1a08e882154cca2be22ace61ba2b187cb1d4c5 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 8 Apr 2011 13:27:13 +0200 Subject: [PATCH] gnt-group list: Query filter support Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/client/gnt_group.py | 5 +++-- man/gnt-group.rst | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/client/gnt_group.py b/lib/client/gnt_group.py index 939587513..23d2d3876 100644 --- a/lib/client/gnt_group.py +++ b/lib/client/gnt_group.py @@ -101,7 +101,8 @@ def ListGroups(opts, args): return GenericList(constants.QR_GROUP, desired_fields, args, None, opts.separator, not opts.no_headers, - format_override=fmtoverride, verbose=opts.verbose) + format_override=fmtoverride, verbose=opts.verbose, + force_filter=opts.force_filter) def ListGroupFields(opts, args): @@ -189,7 +190,7 @@ commands = { "<group_name> <node>...", "Assign nodes to a group"), "list": ( ListGroups, ARGS_MANY_GROUPS, - [NOHDR_OPT, SEP_OPT, FIELDS_OPT, VERBOSE_OPT], + [NOHDR_OPT, SEP_OPT, FIELDS_OPT, VERBOSE_OPT, FORCE_FILTER_OPT], "[<group_name>...]", "Lists the node groups in the cluster. The available fields can be shown" " using the \"list-fields\" command (see the man page for details)." diff --git a/man/gnt-group.rst b/man/gnt-group.rst index 9a1397a27..f65ccb441 100644 --- a/man/gnt-group.rst +++ b/man/gnt-group.rst @@ -93,7 +93,7 @@ LIST ~~~~ | **list** [--no-headers] [--separator=*SEPARATOR*] [-v] -| [-o *[+]FIELD,...*] [group...] +| [-o *[+]FIELD,...*] [--filter] [group...] Lists all existing node groups in the cluster. @@ -115,6 +115,11 @@ The available fields and their meaning are: @QUERY_FIELDS_GROUP@ +If exactly one argument is given and it appears to be a query filter +(see **ganeti(7)**), the query result is filtered accordingly. For +ambiguous cases (e.g. a single field name as a filter) the ``--filter`` +(``-F``) option forces the argument to be treated as a filter. + If no group names are given, then all groups are included. Otherwise, only the named groups will be listed. -- GitLab