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)"""
|