Revision fed67843 qa/qa_node.py

b/qa/qa_node.py
253 253
  node = qa_config.AcquireNode(exclude=master)
254 254

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

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

  
289 282
    # Verify we can't transform back to online when not yet powered on
290 283
    AssertCommand(["gnt-node", "modify", "-O", "no", node_name],
......
400 393
      AssertCommand(["gnt-node", "modify", "--node-parameters",
401 394
                     "oob_program=default", node_name])
402 395
      AssertCommand(["rm", "-f", oob_path2, verify_path2])
403

  
404
    verify_path3 = qa_utils.UploadData(master["primary"], "")
405
    oob_script = ("#!/bin/bash\n"
406
                  "echo \"$@\" >> %s\n") % verify_path3
407
    oob_path3 = qa_utils.UploadData(master["primary"], oob_script, mode=0700)
408

  
409
    AssertCommand(["gnt-cluster", "modify", "--node-parameters",
410
                   "oob_program=%s" % oob_path3])
411

  
412
    non_master_nodes = []
413
    for node in qa_config.get('nodes'):
414
      if node != master:
415
        non_master_nodes.append(qa_utils.ResolveNodeName(node))
416

  
417
    try:
418
      # Without the --force-master it should not have the master in it
419
      verify_content = ["power-cycle %s" % name for name in non_master_nodes]
420
      AssertCommand(["gnt-node", "power", "-f", "--all", "cycle"])
421
      _AssertOobCall(verify_path3, "\n".join(verify_content))
422

  
423
      # Empty file
424
      _UpdateOobFile(verify_path3, "")
425
      # With the --force-master it should have the master at last position
426
      verify_content.append("power-cycle %s" % full_master_name)
427
      AssertCommand(["gnt-node", "power", "--force-master", "-f", "--all",
428
                     "cycle"])
429
      _AssertOobCall(verify_path3, "\n".join(verify_content))
430

  
431
      # Empty file
432
      _UpdateOobFile(verify_path3, "")
433
      # With master as first argument it should still be called last
434
      cmd = ["gnt-node", "power", "--force-master", "-f", "cycle", master_name]
435
      cmd.extend(non_master_nodes)
436
      AssertCommand(cmd)
437
      _AssertOobCall(verify_path3, "\n".join(verify_content))
438
    finally:
439
      AssertCommand(["rm", "-f", oob_path3, verify_path3])
440 396
  finally:
441 397
    AssertCommand(["gnt-cluster", "modify", "--node-parameters",
442 398
                   "oob_program="])

Also available in: Unified diff