Revision 345d395d
b/qa/qa-sample.json | ||
---|---|---|
72 | 72 |
"disks": [ |
73 | 73 |
{ |
74 | 74 |
"size": "1G", |
75 |
"spindles": 2, |
|
75 | 76 |
"name": "disk0", |
76 |
"growth": "2G" |
|
77 |
"growth": "2G", |
|
78 |
"spindles-growth": 1 |
|
77 | 79 |
}, |
78 | 80 |
{ |
79 | 81 |
"size": "512M", |
82 |
"spindles": 1, |
|
80 | 83 |
"name": "disk1", |
81 |
"growth": "768M" |
|
84 |
"growth": "768M", |
|
85 |
"spindles-growth": 0 |
|
82 | 86 |
} |
83 | 87 |
], |
84 | 88 |
|
b/qa/qa_config.py | ||
---|---|---|
418 | 418 |
return enabled and (not self.GetExclusiveStorage() or |
419 | 419 |
templ in constants.DTS_EXCL_STORAGE) |
420 | 420 |
|
421 |
def AreSpindlesSupported(self): |
|
422 |
"""Are spindles supported by the current configuration? |
|
423 |
|
|
424 |
""" |
|
425 |
return self.GetExclusiveStorage() |
|
426 |
|
|
421 | 427 |
def GetVclusterSettings(self): |
422 | 428 |
"""Returns settings for virtual cluster. |
423 | 429 |
|
... | ... | |
643 | 649 |
return GetConfig().IsTemplateSupported(templ) |
644 | 650 |
|
645 | 651 |
|
652 |
def AreSpindlesSupported(): |
|
653 |
"""Wrapper for L{_QaConfig.AreSpindlesSupported}. |
|
654 |
|
|
655 |
""" |
|
656 |
return GetConfig().AreSpindlesSupported() |
|
657 |
|
|
658 |
|
|
646 | 659 |
def _NodeSortKey(node): |
647 | 660 |
"""Returns sort key for a node. |
648 | 661 |
|
b/qa/qa_instance.py | ||
---|---|---|
828 | 828 |
AssertCommand(["gnt-instance", "stop", instance.name]) |
829 | 829 |
# Disks exist: this should fail |
830 | 830 |
_AssertRecreateDisks([], instance, fail=True, destroy=False) |
831 |
# Unsupported spindles parameters: fail |
|
832 |
if not qa_config.AreSpindlesSupported(): |
|
833 |
_AssertRecreateDisks(["--disk=0:spindles=2"], instance, |
|
834 |
fail=True, destroy=False) |
|
831 | 835 |
# Recreate disks in place |
832 | 836 |
_AssertRecreateDisks([], instance) |
833 | 837 |
# Move disks away |
... | ... | |
840 | 844 |
_AssertRecreateDisks(["-n", other_seq], instance) |
841 | 845 |
# Move disks back |
842 | 846 |
_AssertRecreateDisks(["-n", orig_seq], instance) |
843 |
# Recreate the disks one by one |
|
844 |
for idx in range(0, len(qa_config.GetDiskOptions())): |
|
847 |
# Recreate resized disks |
|
848 |
alldisks = qa_config.GetDiskOptions() |
|
849 |
if qa_config.AreSpindlesSupported(): |
|
850 |
build_disks_opt = (lambda idx, disk: |
|
851 |
("--disk=%s:size=%s,spindles=%s" % |
|
852 |
(idx, (utils.ParseUnit(disk["size"]) + |
|
853 |
utils.ParseUnit(disk["growth"])), |
|
854 |
disk["spindles"] + disk["spindles-growth"]))) |
|
855 |
else: |
|
856 |
build_disks_opt = (lambda idx, disk: |
|
857 |
("--disk=%s:size=%s" % |
|
858 |
(idx, (utils.ParseUnit(disk["size"]) + |
|
859 |
utils.ParseUnit(disk["growth"]))))) |
|
860 |
disk_opts = map(build_disks_opt, range(0, len(alldisks)), (alldisks)) |
|
861 |
_AssertRecreateDisks(disk_opts, instance) |
|
862 |
# Recreate the disks one by one (with the original size) |
|
863 |
if qa_config.AreSpindlesSupported(): |
|
864 |
build_disks_opt = lambda idx, disk: ("--disk=%s:size=%s,spindles=%s" % |
|
865 |
(idx, disk["size"], disk["spindles"])) |
|
866 |
else: |
|
867 |
build_disks_opt = lambda idx, disk: ("--disk=%s:size=%s" % |
|
868 |
(idx, disk["size"])) |
|
869 |
for (idx, disk) in enumerate(alldisks): |
|
845 | 870 |
# Only the first call should destroy all the disk |
846 | 871 |
destroy = (idx == 0) |
847 |
_AssertRecreateDisks(["--disk=%s" % idx], instance, destroy=destroy,
|
|
848 |
check=False) |
|
872 |
_AssertRecreateDisks([build_disks_opt(idx, disk)], instance,
|
|
873 |
destroy=destroy, check=False)
|
|
849 | 874 |
# This and InstanceCheck decoration check that the disks are working |
850 | 875 |
AssertCommand(["gnt-instance", "reinstall", "-f", instance.name]) |
851 | 876 |
AssertCommand(["gnt-instance", "start", instance.name]) |
b/qa/qa_instance_utils.py | ||
---|---|---|
30 | 30 |
from ganeti import pathutils |
31 | 31 |
|
32 | 32 |
import qa_config |
33 |
import qa_error |
|
33 | 34 |
import qa_utils |
34 | 35 |
|
35 | 36 |
from qa_utils import AssertIn, AssertCommand |
... | ... | |
53 | 54 |
diskparams = "%s:size=%s" % (idx, size) |
54 | 55 |
if name: |
55 | 56 |
diskparams += ",name=%s" % name |
57 |
if qa_config.AreSpindlesSupported(): |
|
58 |
spindles = disk.get("spindles") |
|
59 |
if spindles is None: |
|
60 |
qa_error.Error("'spindles' is a required parameter for disks when you" |
|
61 |
" enable exclusive storage tests") |
|
62 |
diskparams += ",spindles=%s" % spindles |
|
56 | 63 |
params.extend(["--disk", diskparams]) |
57 | 64 |
|
58 | 65 |
# Set static MAC address if configured |
Also available in: Unified diff