tacho / conman

Automatically exported from code.google.com/p/conman
GNU General Public License v3.0
1 stars 0 forks source link

console name matching via hostlist expressions #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What new or enhanced feature are you proposing?

Support for specifying console names via the hostlist expression syntax used in 
pdsh et al.

What goal would this enhancement help you achieve?

The hostlist expression syntax is a better match than either globbing or regex 
patterns for matching nodes in a typical cluster that share a common prefix 
followed by a numerical suffix.

Please provide any additional information below.

On Tue, 2011-04-12 at 12:15pm PDT, Cameron Harr wrote:
> 
> The conmen help menu mentions globbing and regex matching, and that 
> indeed works. There is also the pdsh-type grouping that would be nice if 
> it worked, although it might interfere with the regex matching. Assuming 
> I'm not missing something, are there any plans to implement the 
> pdsh-type grouping in conmen?
> 
> For example, let's say I have 20 nodes: n01-n020. I can type 'conmen 
> n1*' to open up consoles to n10-n19,  or I can do 'conmen n1[0-6]' to 
> narrow it down to n10-19 using a regex. What I'd like to do is type 
> 'conmen n[10-16]' or 'conmen n[01-16]' and open consoles on those nodes, 
> a la pdsh. If I try that now, it says, "ERROR: Found no matching consoles."

pdsh(1) manpage info:

  HOSTLIST EXPRESSIONS

  As noted in sections above pdsh accepts lists of hosts the general
  form: prefix[n-m,l-k,...], where n < m and l < k, etc., as an
  alternative to explicit lists of hosts. This form should not be
  confused with regular expression character classes (also denoted
  by ''[]''). For example, foo[19] does not represent an expression
  matching foo1 or foo9, but rather represents the degenerate hostlist:
  foo19.

  The hostlist syntax is meant only as a convenience on clusters with
  a "prefixNNN" naming convention and specification of ranges should
  not be considered necessary -- this foo1,foo9 could be specified
  as such, or by the hostlist foo[1,9].

  Some examples of usage follow:

  Run command on foo01,foo02,...,foo05
    pdsh -w foo[01-05] command

  Run command on foo7,foo9,foo10
    pdsh -w foo[7,9-10] command

  Run command on foo0,foo4,foo5
    pdsh -w foo[0-5] -x foo[1-3] command

  A suffix on the hostname is also supported:

  Run command on foo0-eth0,foo1-eth0,foo2-eth0,foo3-eth0
    pdsh -w foo[0-3]-eth0 command

  As a reminder to the reader, some shells will interpret brackets
  ('[' and ']') for pattern matching.  Depending on your shell, it may
  be necessary to enclose ranged lists within quotes.  For example,
  in tcsh, the first example above should be executed as:

       pdsh -w "foo[01-05]" command

xcat noderange(3) manpage info:

  http://xcat.sourceforge.net/man3/noderange.3.html

Original issue reported on code.google.com by chris.m.dunlap on 12 Apr 2011 at 7:59