Revision a24aed2a

b/lib/client/gnt_cluster.py
52 52
                    action="store_true", dest="groups",
53 53
                    help="Arguments are node groups instead of nodes")
54 54

  
55
SHOW_MACHINE_OPT = cli_option("-M", "--show-machine-names", default=False,
56
                              action="store_true",
57
                              help="Show machine name for every line in output")
58

  
55 59
_EPO_PING_INTERVAL = 30 # 30 seconds between pings
56 60
_EPO_PING_TIMEOUT = 1 # 1 second
57 61
_EPO_REACHABLE_TIMEOUT = 15 * 60 # 15 minutes
......
529 533
  for name in nodes:
530 534
    result = srun.Run(name, "root", command)
531 535
    ToStdout("------------------------------------------------")
532
    ToStdout("node: %s", name)
533
    ToStdout("%s", result.output)
536
    if opts.show_machine_names:
537
      for line in result.output.splitlines():
538
        ToStdout("%s: %s", name, line)
539
    else:
540
      ToStdout("node: %s", name)
541
      ToStdout("%s", result.output)
534 542
    ToStdout("return code = %s", result.exit_code)
535 543

  
536 544
  return 0
......
1500 1508
    "[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
1501 1509
  "command": (
1502 1510
    RunClusterCommand, [ArgCommand(min=1)],
1503
    [NODE_LIST_OPT, NODEGROUP_OPT],
1511
    [NODE_LIST_OPT, NODEGROUP_OPT, SHOW_MACHINE_OPT],
1504 1512
    "[-n node...] <command>", "Runs a command on all (or only some) nodes"),
1505 1513
  "info": (
1506 1514
    ShowClusterConfig, ARGS_NONE, [ROMAN_OPT],
b/man/gnt-cluster.rst
44 44
COMMAND
45 45
~~~~~~~
46 46

  
47
**command** [-n *node*] [-g *group*] {*command*}
47
**command** [-n *node*] [-g *group*] [-M] {*command*}
48 48

  
49 49
Executes a command on all nodes. If the option ``-n`` is not given,
50 50
the command will be executed on all nodes, otherwise it will be
......
58 58

  
59 59
    # gnt-cluster command -g default date
60 60

  
61
The ``-M`` option can be used to prepend the node name to all output
62
lines.
63

  
61 64
The command is executed serially on the selected nodes. If the
62 65
master node is present in the list, the command will be executed
63 66
last on the master. Regarding the other nodes, the execution order

Also available in: Unified diff