3 # Copyright (C) 2014 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 def cmdline (subparsers):
27 p = subparsers.add_parser (
29 help='wake up a node (or nodes)'
32 '--all', action='store_const', const=True,
33 help='wake up all nodes'
37 help='node name to be woken up'
39 p.set_defaults (run=run)
41 def run (c, args, all_nodes):
42 nodes = lib.get_nodes_by_name (all_nodes, args.nodes, args.all)
47 if node.ping (force=True):
52 # Wait for them to come up.
54 while pings > 0 and up < len (nodes):
57 if node.ping (force=True):
62 sys.exit ('warning: some nodes did not wake up')