Revision c99200a3 qa/qa_instance.py
b/qa/qa_instance.py | ||
---|---|---|
23 | 23 |
|
24 | 24 |
""" |
25 | 25 |
|
26 |
import operator |
|
26 | 27 |
import re |
27 | 28 |
|
28 | 29 |
from ganeti import utils |
... | ... | |
177 | 178 |
|
178 | 179 |
|
179 | 180 |
@InstanceCheck(None, INST_UP, RETURN_VALUE) |
180 |
def TestInstanceAddWithPlainDisk(node): |
|
181 |
def TestInstanceAddWithPlainDisk(nodes):
|
|
181 | 182 |
"""gnt-instance add -t plain""" |
182 |
return _DiskTest(node["primary"], "plain") |
|
183 |
assert len(nodes) == 1 |
|
184 |
return _DiskTest(nodes[0]["primary"], "plain") |
|
183 | 185 |
|
184 | 186 |
|
185 | 187 |
@InstanceCheck(None, INST_UP, RETURN_VALUE) |
186 |
def TestInstanceAddWithDrbdDisk(node, node2):
|
|
188 |
def TestInstanceAddWithDrbdDisk(nodes):
|
|
187 | 189 |
"""gnt-instance add -t drbd""" |
188 |
return _DiskTest("%s:%s" % (node["primary"], node2["primary"]), |
|
190 |
assert len(nodes) == 2 |
|
191 |
return _DiskTest(":".join(map(operator.itemgetter("primary"), nodes)), |
|
189 | 192 |
"drbd") |
190 | 193 |
|
191 | 194 |
|
... | ... | |
481 | 484 |
|
482 | 485 |
|
483 | 486 |
@InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG) |
484 |
def TestInstanceConvertDisk(instance, snode):
|
|
487 |
def TestInstanceConvertDiskToPlain(instance, inodes):
|
|
485 | 488 |
"""gnt-instance modify -t""" |
486 | 489 |
name = instance["name"] |
487 | 490 |
template = qa_config.GetInstanceTemplate(instance) |
... | ... | |
489 | 492 |
print qa_utils.FormatInfo("Unsupported template %s, skipping conversion" |
490 | 493 |
" test" % template) |
491 | 494 |
return |
495 |
assert len(inodes) == 2 |
|
492 | 496 |
AssertCommand(["gnt-instance", "modify", "-t", "plain", name]) |
493 | 497 |
AssertCommand(["gnt-instance", "modify", "-t", "drbd", |
494 |
"-n", snode["primary"], name])
|
|
498 |
"-n", inodes[1]["primary"], name])
|
|
495 | 499 |
|
496 | 500 |
|
497 | 501 |
@InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG) |
... | ... | |
537 | 541 |
|
538 | 542 |
|
539 | 543 |
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG) |
540 |
def TestReplaceDisks(instance, pnode, snode, othernode):
|
|
544 |
def TestReplaceDisks(instance, curr_nodes, other_nodes):
|
|
541 | 545 |
"""gnt-instance replace-disks""" |
542 |
# pylint: disable=W0613 |
|
543 |
# due to unused pnode arg |
|
544 |
# FIXME: should be removed from the function completely |
|
545 | 546 |
def buildcmd(args): |
546 | 547 |
cmd = ["gnt-instance", "replace-disks"] |
547 | 548 |
cmd.extend(args) |
... | ... | |
553 | 554 |
" skipping test") |
554 | 555 |
return |
555 | 556 |
|
557 |
# Currently all supported templates have one primary and one secondary node |
|
558 |
assert len(curr_nodes) == 2 |
|
559 |
snode = curr_nodes[1] |
|
560 |
assert len(other_nodes) == 1 |
|
561 |
othernode = other_nodes[0] |
|
562 |
|
|
556 | 563 |
options = qa_config.get("options", {}) |
557 | 564 |
use_ialloc = options.get("use-iallocators", True) |
558 | 565 |
for data in [ |
... | ... | |
604 | 611 |
|
605 | 612 |
|
606 | 613 |
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG) |
607 |
def TestRecreateDisks(instance, pnode, snode, othernodes):
|
|
614 |
def TestRecreateDisks(instance, inodes, othernodes):
|
|
608 | 615 |
"""gnt-instance recreate-disks |
609 | 616 |
|
610 | 617 |
@param instance: Instance to work on |
611 |
@param pnode: Primary node |
|
612 |
@param snode: Secondary node, or None for sigle-homed instances |
|
618 |
@param inodes: List of the current nodes of the instance |
|
613 | 619 |
@param othernodes: list/tuple of nodes where to temporarily recreate disks |
614 | 620 |
|
615 | 621 |
""" |
616 | 622 |
options = qa_config.get("options", {}) |
617 | 623 |
use_ialloc = options.get("use-iallocators", True) |
618 | 624 |
other_seq = ":".join([n["primary"] for n in othernodes]) |
619 |
orig_seq = pnode["primary"] |
|
620 |
if snode: |
|
621 |
orig_seq = orig_seq + ":" + snode["primary"] |
|
625 |
orig_seq = ":".join([n["primary"] for n in inodes]) |
|
622 | 626 |
# These fail because the instance is running |
623 | 627 |
_AssertRecreateDisks(["-n", other_seq], instance, fail=True, destroy=False) |
624 | 628 |
if use_ialloc: |
Also available in: Unified diff