Revision d363797e lib/client/gnt_node.py

b/lib/client/gnt_node.py
27 27
# C0103: Invalid name gnt-node
28 28

  
29 29
from ganeti.cli import *
30
from ganeti import cli
30 31
from ganeti import bootstrap
31 32
from ganeti import opcodes
32 33
from ganeti import utils
......
476 477

  
477 478
  oob_command = "power-%s" % command
478 479

  
479
  op = opcodes.OpOobCommand(node_name=node, command=oob_command)
480
  result = SubmitOpCode(op, opts=opts)
480
  opcodelist = []
481
  if oob_command == constants.OOB_POWER_OFF:
482
    opcodelist.append(opcodes.OpSetNodeParams(node_name=node, offline=True,
483
                                              auto_promote=opts.auto_promote))
484

  
485
  opcodelist.append(opcodes.OpOobCommand(node_name=node, command=oob_command))
486

  
487
  cli.SetGenericOpcodeOpts(opcodelist, opts)
488

  
489
  job_id = cli.SendJob(opcodelist)
490

  
491
  # We just want the OOB Opcode status
492
  # If it fails PollJob gives us the error message in it
493
  result = cli.PollJob(job_id)[-1]
494

  
481 495
  if result:
482 496
    if oob_command == constants.OOB_POWER_STATUS:
483 497
      text = "The machine is %spowered"
......
735 749
    PowerNode,
736 750
    [ArgChoice(min=1, max=1, choices=_LIST_POWER_COMMANDS),
737 751
     ArgNode(min=1, max=1)],
738
    [], "on|off|cycle|status <node>",
752
    [SUBMIT_OPT, AUTO_PROMOTE_OPT, PRIORITY_OPT],
753
    "on|off|cycle|status <node>",
739 754
    "Change power state of node by calling out-of-band helper."),
740 755
  'remove': (
741 756
    RemoveNode, ARGS_ONE_NODE, [DRY_RUN_OPT, PRIORITY_OPT],

Also available in: Unified diff