Revision 02a5fe0e
b/qa/qa_config.py | ||
---|---|---|
45 | 45 |
"name", |
46 | 46 |
"nicmac", |
47 | 47 |
"used", |
48 |
"disk_template", |
|
48 |
"_disk_template",
|
|
49 | 49 |
] |
50 | 50 |
|
51 | 51 |
def __init__(self, name, nicmac): |
... | ... | |
55 | 55 |
self.name = name |
56 | 56 |
self.nicmac = nicmac |
57 | 57 |
self.used = None |
58 |
self.disk_template = None |
|
58 |
self._disk_template = None
|
|
59 | 59 |
|
60 | 60 |
@classmethod |
61 | 61 |
def FromDict(cls, data): |
... | ... | |
79 | 79 |
self.name) |
80 | 80 |
|
81 | 81 |
self.used = False |
82 |
self.disk_template = None |
|
82 |
self._disk_template = None
|
|
83 | 83 |
|
84 | 84 |
def GetNicMacAddr(self, idx, default): |
85 | 85 |
"""Returns MAC address for NIC. |
... | ... | |
94 | 94 |
else: |
95 | 95 |
return default |
96 | 96 |
|
97 |
def SetDiskTemplate(self, template): |
|
98 |
"""Set the disk template. |
|
99 |
|
|
100 |
""" |
|
101 |
assert template in constants.DISK_TEMPLATES |
|
102 |
|
|
103 |
self._disk_template = template |
|
104 |
|
|
105 |
@property |
|
106 |
def disk_template(self): |
|
107 |
"""Returns the current disk template. |
|
108 |
|
|
109 |
""" |
|
110 |
return self._disk_template |
|
111 |
|
|
97 | 112 |
|
98 | 113 |
class _QaNode(object): |
99 | 114 |
__slots__ = [ |
... | ... | |
480 | 495 |
return inst |
481 | 496 |
|
482 | 497 |
|
483 |
def GetInstanceTemplate(inst): |
|
484 |
"""Return the disk template of an instance. |
|
485 |
|
|
486 |
""" |
|
487 |
templ = inst.disk_template |
|
488 |
assert templ is not None |
|
489 |
return templ |
|
490 |
|
|
491 |
|
|
492 |
def SetInstanceTemplate(inst, template): |
|
493 |
"""Set the disk template for an instance. |
|
494 |
|
|
495 |
""" |
|
496 |
inst.disk_template = template |
|
497 |
|
|
498 |
|
|
499 | 498 |
def SetExclusiveStorage(value): |
500 | 499 |
"""Wrapper for L{_QaConfig.SetExclusiveStorage}. |
501 | 500 |
|
b/qa/qa_instance.py | ||
---|---|---|
77 | 77 |
AssertCommand(cmd) |
78 | 78 |
|
79 | 79 |
_CheckSsconfInstanceList(instance.name) |
80 |
qa_config.SetInstanceTemplate(instance, disk_template)
|
|
80 |
instance.SetDiskTemplate(disk_template)
|
|
81 | 81 |
|
82 | 82 |
return instance |
83 | 83 |
except: |
... | ... | |
177 | 177 |
|
178 | 178 |
|
179 | 179 |
def IsFailoverSupported(instance): |
180 |
templ = qa_config.GetInstanceTemplate(instance) |
|
181 |
return templ in constants.DTS_MIRRORED |
|
180 |
return instance.disk_template in constants.DTS_MIRRORED |
|
182 | 181 |
|
183 | 182 |
|
184 | 183 |
def IsMigrationSupported(instance): |
185 |
templ = qa_config.GetInstanceTemplate(instance) |
|
186 |
return templ in constants.DTS_MIRRORED |
|
184 |
return instance.disk_template in constants.DTS_MIRRORED |
|
187 | 185 |
|
188 | 186 |
|
189 | 187 |
def IsDiskReplacingSupported(instance): |
190 |
templ = qa_config.GetInstanceTemplate(instance) |
|
191 |
return templ == constants.DT_DRBD8 |
|
188 |
return instance.disk_template == constants.DT_DRBD8 |
|
192 | 189 |
|
193 | 190 |
|
194 | 191 |
@InstanceCheck(None, INST_UP, RETURN_VALUE) |
... | ... | |
500 | 497 |
"""gnt-instance modify -t""" |
501 | 498 |
name = instance.name |
502 | 499 |
|
503 |
template = qa_config.GetInstanceTemplate(instance)
|
|
500 |
template = instance.disk_template
|
|
504 | 501 |
if template != constants.DT_DRBD8: |
505 | 502 |
print qa_utils.FormatInfo("Unsupported template %s, skipping conversion" |
506 | 503 |
" test" % template) |
... | ... | |
697 | 694 |
_GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE)) |
698 | 695 |
cmd.append(newinst.name) |
699 | 696 |
AssertCommand(cmd) |
700 |
qa_config.SetInstanceTemplate(newinst, templ)
|
|
697 |
newinst.SetDiskTemplate(templ)
|
|
701 | 698 |
|
702 | 699 |
|
703 | 700 |
def TestBackupList(expnode): |
b/qa/qa_rapi.py | ||
---|---|---|
554 | 554 |
def TestRapiInstanceAdd(node, use_client): |
555 | 555 |
"""Test adding a new instance via RAPI""" |
556 | 556 |
instance = qa_config.AcquireInstance() |
557 |
qa_config.SetInstanceTemplate(instance, constants.DT_PLAIN)
|
|
557 |
instance.SetDiskTemplate(constants.DT_PLAIN)
|
|
558 | 558 |
try: |
559 | 559 |
disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")] |
560 | 560 |
disks = [{"size": size} for size in disk_sizes] |
... | ... | |
764 | 764 |
rapi_pw_file.write(_rapi_password) |
765 | 765 |
rapi_pw_file.flush() |
766 | 766 |
|
767 |
qa_config.SetInstanceTemplate(dest_instance, |
|
768 |
qa_config.GetInstanceTemplate(src_instance)) |
|
767 |
dest_instance.SetDiskTemplate(src_instance.disk_template) |
|
769 | 768 |
|
770 | 769 |
# TODO: Run some instance tests before moving back |
771 | 770 |
|
Also available in: Unified diff