gnt-group list: Query filter support
authorMichael Hanselmann <hansmi@google.com>
Fri, 8 Apr 2011 11:27:13 +0000 (13:27 +0200)
committerMichael Hanselmann <hansmi@google.com>
Tue, 19 Apr 2011 12:56:13 +0000 (14:56 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/client/gnt_group.py
man/gnt-group.rst

index 9395875..23d2d38 100644 (file)
@@ -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)."
index 9a1397a..f65ccb4 100644 (file)
@@ -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.