From: Michael Hanselmann Date: Tue, 19 Apr 2011 12:56:04 +0000 (+0200) Subject: gnt-node list: Query filter support X-Git-Tag: v2.5.0beta1~425 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/2afd577f31466a474255287abaafcad977143170?ds=sidebyside gnt-node list: Query filter support Update manpage, quote field names. Signed-off-by: Michael Hanselmann Reviewed-by: Iustin Pop --- diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py index 3e65024..66e0188 100644 --- a/lib/client/gnt_node.py +++ b/lib/client/gnt_node.py @@ -232,7 +232,8 @@ def ListNodes(opts, args): 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): @@ -835,7 +836,8 @@ commands = { "[...]", "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)." diff --git a/man/gnt-node.rst b/man/gnt-node.rst index 0ad33cd..98e8177 100644 --- a/man/gnt-node.rst +++ b/man/gnt-node.rst @@ -150,6 +150,7 @@ LIST | **list** | [--no-headers] [--separator=*SEPARATOR*] | [--units=*UNITS*] [-v] [-o *[+]FIELD,...*] +| [--filter] | [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. -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). +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.