Revision d0a44ec0

b/qa/ganeti-qa.py
602 602
                    instance, inodes)
603 603
            RunTest(qa_instance.TestInstanceStartup, instance)
604 604
          RunCommonInstanceTests(instance)
605
          if qa_config.TestEnabled("instance-modify-primary"):
606
            othernode = qa_config.AcquireNode()
607
            RunTest(qa_instance.TestInstanceModifyPrimaryAndBack,
608
                    instance, inodes[0], othernode)
609
            othernode.Release()
605 610
          RunGroupListTests()
606 611
          RunExportImportTests(instance, inodes)
607 612
          RunHardwareFailureTests(instance, inodes)
b/qa/qa-sample.json
185 185
    "instance-list": true,
186 186
    "instance-migrate": true,
187 187
    "instance-modify": true,
188
    "instance-modify-primary": true,
188 189
    "instance-reboot": true,
189 190
    "instance-reinstall": true,
190 191
    "instance-rename": true,
b/qa/qa_instance.py
24 24
"""
25 25

  
26 26
import operator
27
import os
27 28
import re
28 29

  
29 30
from ganeti import utils
......
573 574
  AssertCommand(["gnt-instance", "modify", "--online", instance.name])
574 575

  
575 576

  
577
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
578
def TestInstanceModifyPrimaryAndBack(instance, currentnode, othernode):
579
  """gnt-instance modify --new-primary
580

  
581
  This will leave the instance on its original primary node, not other node.
582

  
583
  """
584
  if instance.disk_template != constants.DT_FILE:
585
    print qa_utils.FormatInfo("Test only supported for the file disk template")
586
    return
587

  
588
  name = instance.name
589
  current = currentnode.primary
590
  other = othernode.primary
591

  
592
  filestorage = qa_config.get("file-storage-dir")
593
  disk = os.path.join(filestorage, name)
594

  
595
  AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name],
596
                fail=True)
597
  AssertCommand(["gnt-instance", "shutdown", name])
598
  AssertCommand(["scp", "-r", disk, "%s:%s" % (other, filestorage)])
599
  AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name])
600
  AssertCommand(["gnt-instance", "startup", name])
601

  
602
  # and back
603
  AssertCommand(["gnt-instance", "shutdown", name])
604
  AssertCommand(["rm", "-rf", disk], node=other)
605
  AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % current, name])
606
  AssertCommand(["gnt-instance", "startup", name])
607

  
608

  
576 609
@InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG)
577 610
def TestInstanceStoppedModify(instance):
578 611
  """gnt-instance modify (stopped instance)"""

Also available in: Unified diff