Commit e75f80b9 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno

Fix release of instances in QA

Also, fix some uses of keyword arguments for arguments with a default
value, as required by the style guide, and a typo.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 328201a5
...@@ -1086,7 +1086,7 @@ def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online): ...@@ -1086,7 +1086,7 @@ def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online):
def TestInstanceCreationRestrictedByDiskTemplates(): def TestInstanceCreationRestrictedByDiskTemplates():
"""Test adding instances for disbled disk templates.""" """Test adding instances for disabled disk templates."""
enabled_disk_templates = qa_config.GetEnabledDiskTemplates() enabled_disk_templates = qa_config.GetEnabledDiskTemplates()
nodes = qa_config.AcquireManyNodes(2) nodes = qa_config.AcquireManyNodes(2)
...@@ -1099,14 +1099,15 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1099,14 +1099,15 @@ def TestInstanceCreationRestrictedByDiskTemplates():
# Test instance creation for enabled disk templates # Test instance creation for enabled disk templates
for disk_template in enabled_disk_templates: for disk_template in enabled_disk_templates:
instance = CreateInstanceByDiskTemplate(nodes, disk_template, False) instance = CreateInstanceByDiskTemplate(nodes, disk_template, fail=False)
TestInstanceRemove(instance) TestInstanceRemove(instance)
instance.Release()
# Test that instance creation fails for disabled disk templates # Test that instance creation fails for disabled disk templates
disabled_disk_templates = list(constants.DISK_TEMPLATES disabled_disk_templates = list(constants.DISK_TEMPLATES
- set(enabled_disk_templates)) - set(enabled_disk_templates))
for disk_template in disabled_disk_templates: for disk_template in disabled_disk_templates:
instance = CreateInstanceByDiskTemplate(nodes, disk_template, True) instance = CreateInstanceByDiskTemplate(nodes, disk_template, fail=True)
# Test instance creation for after disabling enabled disk templates # Test instance creation for after disabling enabled disk templates
if (len(enabled_disk_templates) > 1): if (len(enabled_disk_templates) > 1):
...@@ -1123,7 +1124,7 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1123,7 +1124,7 @@ def TestInstanceCreationRestrictedByDiskTemplates():
",".join(enabled)], ",".join(enabled)],
fail=False) fail=False)
for disk_template in disabled: for disk_template in disabled:
CreateInstanceByDiskTemplate(nodes, disk_template, True) CreateInstanceByDiskTemplate(nodes, disk_template, fail=True)
elif (len(enabled_disk_templates) == 1): elif (len(enabled_disk_templates) == 1):
# If only one disk template is enabled in the QA config, we have to enable # If only one disk template is enabled in the QA config, we have to enable
# some of the disabled disk templates in order to test if the disabling the # some of the disabled disk templates in order to test if the disabling the
...@@ -1132,7 +1133,7 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1132,7 +1133,7 @@ def TestInstanceCreationRestrictedByDiskTemplates():
"--enabled-disk-template=%s" % "--enabled-disk-template=%s" %
",".join(disabled_disk_templates)], ",".join(disabled_disk_templates)],
fail=False) fail=False)
CreateInstanceByDiskTemplate(nodes, enabled_disk_templates[0], True) CreateInstanceByDiskTemplate(nodes, enabled_disk_templates[0], fail=True)
else: else:
raise qa_error.Error("Please enable at least one disk template" raise qa_error.Error("Please enable at least one disk template"
" in your QA setup.") " in your QA setup.")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment