Revision efae0fdd

b/lib/client/gnt_node.py
105 105
                              help=("Do not make initial SSH setup on remote"
106 106
                                    " node (needs to be done manually)"))
107 107

  
108
IGNORE_STATUS_OPT = cli_option("--ignore-status", default=False,
109
                               action="store_true", dest="ignore_status",
110
                               help=("Ignore the Node(s) offline status"
111
                                     " (potentially DANGEROUS)"))
112

  
113
FORCE_MASTER_OPT = cli_option("--force-master", default=False,
114
                              action="store_true", dest="force_master",
115
                              help=("Operate on the master node too"
116
                                    " (potentially DANGEROUS)"))
117

  
108 118

  
109 119
def ConvertStorageType(user_storage_type):
110 120
  """Converts a user storage type to its internal name.
......
487 497
  oob_command = "power-%s" % command
488 498

  
489 499
  opcodelist = []
490
  if oob_command == constants.OOB_POWER_OFF:
500
  if not opts.ignore_status and oob_command == constants.OOB_POWER_OFF:
491 501
    opcodelist.append(opcodes.OpNodeSetParams(node_name=node, offline=True,
492 502
                                              auto_promote=opts.auto_promote))
493 503

  
494 504
  opcodelist.append(opcodes.OpOobCommand(node_names=[node],
495
                                         command=oob_command))
505
                                         command=oob_command,
506
                                         ignore_status=opts.ignore_status,
507
                                         force_master=opts.force_master))
496 508

  
497 509
  cli.SetGenericOpcodeOpts(opcodelist, opts)
498 510

  
......
815 827
    PowerNode,
816 828
    [ArgChoice(min=1, max=1, choices=_LIST_POWER_COMMANDS),
817 829
     ArgNode(min=1, max=1)],
818
    [SUBMIT_OPT, AUTO_PROMOTE_OPT, PRIORITY_OPT],
830
    [SUBMIT_OPT, AUTO_PROMOTE_OPT, PRIORITY_OPT, IGNORE_STATUS_OPT,
831
     FORCE_MASTER_OPT],
819 832
    "on|off|cycle|status <node>",
820 833
    "Change power state of node by calling out-of-band helper."),
821 834
  'remove': (
b/qa/qa_node.py
251 251

  
252 252
  node = qa_config.AcquireNode(exclude=master)
253 253

  
254
  master_name = master["primary"]
255
  full_master_name = qa_utils.ResolveNodeName(master)
254 256
  node_name = node["primary"]
255 257
  full_node_name = qa_utils.ResolveNodeName(node)
256 258

  
......
270 272
    AssertCommand(["gnt-node", "power", "off", node_name])
271 273
    _AssertOobCall(verify_path, "power-off %s" % full_node_name)
272 274

  
275
    # Power off on master without options should fail
276
    AssertCommand(["gnt-node", "power", "off", master_name], fail=True)
277
    # With force master it should still fail
278
    AssertCommand(["gnt-node", "power", "--force-master", "off", master_name],
279
                  fail=True)
280
    AssertCommand(["gnt-node", "power", "--ignore-status", "off", master_name],
281
                  fail=True)
282
    # This should work again
283
    AssertCommand(["gnt-node", "power", "--ignore-status", "--force-master",
284
                   "off", master_name])
285
    _AssertOobCall(verify_path, "power-off %s" % full_master_name)
286

  
273 287
    # Verify we can't transform back to online when not yet powered on
274 288
    AssertCommand(["gnt-node", "modify", "-O", "no", node_name],
275 289
                  fail=True)

Also available in: Unified diff