Revision 02cff8aa
b/qa/ganeti-qa.py | ||
---|---|---|
577 | 577 |
|
578 | 578 |
def RunInstanceTests(): |
579 | 579 |
"""Create and exercise instances.""" |
580 |
instance_tests = [] |
|
581 |
enabled_disk_templates = qa_config.GetEnabledDiskTemplates() |
|
582 |
# FIXME: Refactor this to make the code more elegant wrt to disk templates. |
|
583 |
if constants.DT_PLAIN in enabled_disk_templates: |
|
584 |
instance_tests.append(("instance-add-plain-disk", constants.DT_PLAIN, |
|
585 |
qa_instance.TestInstanceAddWithPlainDisk, 1)) |
|
586 |
if constants.DT_DRBD8 in enabled_disk_templates: |
|
587 |
instance_tests.append(("instance-add-drbd-disk", constants.DT_DRBD8, |
|
588 |
qa_instance.TestInstanceAddWithDrbdDisk, 2)) |
|
589 |
if constants.DT_DISKLESS in enabled_disk_templates: |
|
590 |
instance_tests.append(("instance-add-diskless", constants.DT_DISKLESS, |
|
591 |
qa_instance.TestInstanceAddDiskless, 1)) |
|
592 |
if constants.DT_FILE in enabled_disk_templates: |
|
593 |
instance_tests.append(("instance-add-file", constants.DT_FILE, |
|
594 |
qa_instance.TestInstanceAddFile, 1)) |
|
580 |
instance_tests = [ |
|
581 |
("instance-add-plain-disk", constants.DT_PLAIN, |
|
582 |
qa_instance.TestInstanceAddWithPlainDisk, 1), |
|
583 |
("instance-add-drbd-disk", constants.DT_DRBD8, |
|
584 |
qa_instance.TestInstanceAddWithDrbdDisk, 2), |
|
585 |
("instance-add-diskless", constants.DT_DISKLESS, |
|
586 |
qa_instance.TestInstanceAddDiskless, 1), |
|
587 |
("instance-add-file", constants.DT_FILE, |
|
588 |
qa_instance.TestInstanceAddFile, 1) |
|
589 |
] |
|
595 | 590 |
|
596 | 591 |
for (test_name, templ, create_fun, num_nodes) in instance_tests: |
597 | 592 |
if (qa_config.TestEnabled(test_name) and |
b/qa/qa_config.py | ||
---|---|---|
412 | 412 |
"""Is the given disk template supported by the current configuration? |
413 | 413 |
|
414 | 414 |
""" |
415 |
return (not self.GetExclusiveStorage() or |
|
416 |
templ in constants.DTS_EXCL_STORAGE) |
|
415 |
enabled = templ in self.GetEnabledDiskTemplates() |
|
416 |
return enabled and (not self.GetExclusiveStorage() or |
|
417 |
templ in constants.DTS_EXCL_STORAGE) |
|
417 | 418 |
|
418 | 419 |
def GetVclusterSettings(self): |
419 | 420 |
"""Returns settings for virtual cluster. |
... | ... | |
608 | 609 |
|
609 | 610 |
|
610 | 611 |
def IsTemplateSupported(templ): |
611 |
"""Wrapper for L{_QaConfig.GetExclusiveStorage}.
|
|
612 |
"""Wrapper for L{_QaConfig.IsTemplateSupported}.
|
|
612 | 613 |
|
613 | 614 |
""" |
614 | 615 |
return GetConfig().IsTemplateSupported(templ) |
b/test/data/qa-minimal-nodes-instances-only.json | ||
---|---|---|
4 | 4 |
"disk": ["1G", "512M"], |
5 | 5 |
"disk-growth": ["2G", "768M"], |
6 | 6 |
|
7 |
"enabled-disk-templates": [ |
|
8 |
"plain", |
|
9 |
"drbd", |
|
10 |
"diskless" |
|
11 |
], |
|
12 |
|
|
7 | 13 |
"nodes": [ |
8 | 14 |
{ |
9 | 15 |
"# Master node": null, |
b/test/py/qa.qa_config_unittest.py | ||
---|---|---|
308 | 308 |
self.config.SetExclusiveStorage(value) |
309 | 309 |
self.assertEqual(self.config.GetExclusiveStorage(), bool(value)) |
310 | 310 |
|
311 |
def testIsTemplateSupported(self): |
|
312 |
enabled_dts = self.config.GetEnabledDiskTemplates() |
|
313 |
for e_s in [False, True]: |
|
314 |
self.config.SetExclusiveStorage(e_s) |
|
311 | 315 |
for template in constants.DISK_TEMPLATES: |
312 |
if value and template not in constants.DTS_EXCL_STORAGE: |
|
316 |
if (template not in enabled_dts or |
|
317 |
e_s and template not in constants.DTS_EXCL_STORAGE): |
|
313 | 318 |
self.assertFalse(self.config.IsTemplateSupported(template)) |
314 | 319 |
else: |
315 | 320 |
self.assertTrue(self.config.IsTemplateSupported(template)) |
Also available in: Unified diff