gnt-node list: Query filter support
authorMichael Hanselmann <hansmi@google.com>
Tue, 19 Apr 2011 12:56:04 +0000 (14:56 +0200)
committerMichael Hanselmann <hansmi@google.com>
Tue, 19 Apr 2011 12:56:04 +0000 (14:56 +0200)
Update manpage, quote field names.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/client/gnt_node.py
man/gnt-node.rst

index 3e65024..66e0188 100644 (file)
@@ -232,7 +232,8 @@ def ListNodes(opts, args):
 
   return GenericList(constants.QR_NODE, selected_fields, args, opts.units,
                      opts.separator, not opts.no_headers,
 
   return GenericList(constants.QR_NODE, selected_fields, args, opts.units,
                      opts.separator, not opts.no_headers,
-                     format_override=fmtoverride, verbose=opts.verbose)
+                     format_override=fmtoverride, verbose=opts.verbose,
+                     force_filter=opts.force_filter)
 
 
 def ListNodeFields(opts, args):
 
 
 def ListNodeFields(opts, args):
@@ -835,7 +836,8 @@ commands = {
     "[<node_name>...]", "Show information about the node(s)"),
   'list': (
     ListNodes, ARGS_MANY_NODES,
     "[<node_name>...]", "Show information about the node(s)"),
   'list': (
     ListNodes, ARGS_MANY_NODES,
-    [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, VERBOSE_OPT],
+    [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, VERBOSE_OPT,
+     FORCE_FILTER_OPT],
     "[nodes...]",
     "Lists the nodes in the cluster. The available fields can be shown using"
     " the \"list-fields\" command (see the man page for details)."
     "[nodes...]",
     "Lists the nodes in the cluster. The available fields can be shown using"
     " the \"list-fields\" command (see the man page for details)."
index 0ad33cd..98e8177 100644 (file)
@@ -150,6 +150,7 @@ LIST
 | **list**
 | [--no-headers] [--separator=*SEPARATOR*]
 | [--units=*UNITS*] [-v] [-o *[+]FIELD,...*]
 | **list**
 | [--no-headers] [--separator=*SEPARATOR*]
 | [--units=*UNITS*] [-v] [-o *[+]FIELD,...*]
+| [--filter]
 | [node...]
 
 Lists the nodes in the cluster.
 | [node...]
 
 Lists the nodes in the cluster.
@@ -182,19 +183,24 @@ fields will be added to the default list. This allows to quickly
 see the default list plus a few other fields, instead of retyping
 the entire list of fields.
 
 see the default list plus a few other fields, instead of retyping
 the entire list of fields.
 
-Note that some of this fields are known from the configuration of
-the cluster (e.g. name, pinst, sinst, pip, sip and thus the master
-does not need to contact the node for this data (making the listing
-fast if only fields from this set are selected), whereas the other
-fields are "live" fields and we need to make a query to the cluster
-nodes.
-
-Depending on the virtualization type and implementation details,
-the mtotal, mnode and mfree may have slighly varying meanings. For
-example, some solutions share the node memory with the pool of
-memory used for instances (KVM), whereas others have separate
+Note that some of these fields are known from the configuration of the
+cluster (e.g. ``name``, ``pinst``, ``sinst``, ``pip``, ``sip``) and thus
+the master does not need to contact the node for this data (making the
+listing fast if only fields from this set are selected), whereas the
+other fields are "live" fields and require a query to the cluster nodes.
+
+Depending on the virtualization type and implementation details, the
+``mtotal``, ``mnode`` and ``mfree`` fields may have slighly varying
+meanings. For example, some solutions share the node memory with the
+pool of memory used for instances (KVM), whereas others have separate
 memory for the node and for the instances (Xen).
 
 memory for the node and for the instances (Xen).
 
+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 (e.g.
+``gnt-node list -F master_candidate``).
+
 If no node names are given, then all nodes are queried. Otherwise,
 only the given nodes will be listed.
 
 If no node names are given, then all nodes are queried. Otherwise,
 only the given nodes will be listed.