Commit eb161df2 authored by Helga Velroyen's avatar Helga Velroyen

QA: adjust tests wrt to ipolicy disk templates

This adjusts the cluster QA with respect to the new checks
between the ipolicy disk templates and the enabled disk
templates.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent c89eb67d
...@@ -578,8 +578,11 @@ def _RestoreEnabledDiskTemplates(): ...@@ -578,8 +578,11 @@ def _RestoreEnabledDiskTemplates():
other tests. other tests.
""" """
cmd = ["gnt-cluster", "modify", "--enabled-disk-templates=%s" % enabled_disk_templates = qa_config.GetEnabledDiskTemplates()
",".join(qa_config.GetEnabledDiskTemplates())] cmd = ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % ",".join(enabled_disk_templates),
"--ipolicy-disk-templates=%s" % ",".join(enabled_disk_templates),
]
if utils.IsLvmEnabled(qa_config.GetEnabledDiskTemplates()): if utils.IsLvmEnabled(qa_config.GetEnabledDiskTemplates()):
vgname = qa_config.get("vg-name", constants.DEFAULT_VG) vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
...@@ -606,7 +609,8 @@ def _TestClusterModifyDiskTemplatesArguments(default_disk_template, ...@@ -606,7 +609,8 @@ def _TestClusterModifyDiskTemplatesArguments(default_disk_template,
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s,%s" % "--enabled-disk-templates=%s,%s" %
(default_disk_template, default_disk_template)], (default_disk_template, default_disk_template),
"--ipolicy-disk-templates=%s" % default_disk_template],
fail=False) fail=False)
if constants.DT_DRBD8 in enabled_disk_templates: if constants.DT_DRBD8 in enabled_disk_templates:
...@@ -618,12 +622,15 @@ def _TestClusterModifyDiskTemplatesArguments(default_disk_template, ...@@ -618,12 +622,15 @@ def _TestClusterModifyDiskTemplatesArguments(default_disk_template,
# has to be installed on the nodes in this case # has to be installed on the nodes in this case
AssertCommand(["gnt-cluster", "modify", AssertCommand(["gnt-cluster", "modify",
"--drbd-usermode-helper=%s" % drbd_usermode_helper, "--drbd-usermode-helper=%s" % drbd_usermode_helper,
"--enabled-disk-templates=%s" % constants.DT_DISKLESS], "--enabled-disk-templates=%s" % constants.DT_DISKLESS,
"--ipolicy-disk-templates=%s" % constants.DT_DISKLESS],
fail=False) fail=False)
# specifying a helper when drbd is re-enabled # specifying a helper when drbd is re-enabled
AssertCommand(["gnt-cluster", "modify", AssertCommand(["gnt-cluster", "modify",
"--drbd-usermode-helper=%s" % drbd_usermode_helper, "--drbd-usermode-helper=%s" % drbd_usermode_helper,
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" %
",".join(enabled_disk_templates),
"--ipolicy-disk-templates=%s" %
",".join(enabled_disk_templates)], ",".join(enabled_disk_templates)],
fail=False) fail=False)
...@@ -650,13 +657,15 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): ...@@ -650,13 +657,15 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % non_lvm_template, "--enabled-disk-templates=%s" % non_lvm_template,
"--ipolicy-disk-templates=%s" % non_lvm_template,
"--vg-name="], "--vg-name="],
fail=False) fail=False)
# Try to enable lvm, when no volume group is given # Try to enable lvm, when no volume group is given
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % lvm_template], "--enabled-disk-templates=%s" % lvm_template,
"--ipolicy-disk-templates=%s" % lvm_template],
fail=True) fail=True)
# Set volume group, with lvm still disabled: just a warning # Set volume group, with lvm still disabled: just a warning
...@@ -666,13 +675,15 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): ...@@ -666,13 +675,15 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % lvm_template, "--enabled-disk-templates=%s" % lvm_template,
"--ipolicy-disk-templates=%s" % lvm_template,
"--vg-name="], "--vg-name="],
fail=True) fail=True)
# Enable lvm with vg name present # Enable lvm with vg name present
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % lvm_template], "--enabled-disk-templates=%s" % lvm_template,
"--ipolicy-disk-templates=%s" % lvm_template],
fail=False) fail=False)
# Try unsetting vg name with lvm still enabled # Try unsetting vg name with lvm still enabled
...@@ -680,7 +691,10 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): ...@@ -680,7 +691,10 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
# Disable lvm with vg name still set # Disable lvm with vg name still set
AssertCommand( AssertCommand(
["gnt-cluster", "modify", "--enabled-disk-templates=%s" % non_lvm_template], ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % non_lvm_template,
"--ipolicy-disk-templates=%s" % non_lvm_template,
],
fail=False) fail=False)
# Try unsetting vg name with lvm disabled # Try unsetting vg name with lvm disabled
...@@ -690,6 +704,7 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): ...@@ -690,6 +704,7 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % lvm_template, "--enabled-disk-templates=%s" % lvm_template,
"--ipolicy-disk-templates=%s" % lvm_template,
"--vg-name=%s" % vgname], "--vg-name=%s" % vgname],
fail=False) fail=False)
...@@ -697,6 +712,7 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates): ...@@ -697,6 +712,7 @@ def _TestClusterModifyDiskTemplatesVgName(enabled_disk_templates):
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % non_lvm_template, "--enabled-disk-templates=%s" % non_lvm_template,
"--ipolicy-disk-templates=%s" % non_lvm_template,
"--vg-name="], "--vg-name="],
fail=False) fail=False)
...@@ -719,8 +735,8 @@ def _TestClusterModifyUsedDiskTemplate(instance_template, ...@@ -719,8 +735,8 @@ def _TestClusterModifyUsedDiskTemplate(instance_template,
- set([instance_template])) - set([instance_template]))
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" % ",".join(new_disk_templates),
",".join(new_disk_templates)], "--ipolicy-disk-templates=%s" % ",".join(new_disk_templates)],
fail=True) fail=True)
...@@ -733,14 +749,14 @@ def _TestClusterModifyUnusedDiskTemplate(instance_template): ...@@ -733,14 +749,14 @@ def _TestClusterModifyUnusedDiskTemplate(instance_template):
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" % ",".join(all_disk_templates),
",".join(all_disk_templates)], "--ipolicy-disk-templates=%s" % ",".join(all_disk_templates)],
fail=False) fail=False)
new_disk_templates = [instance_template] new_disk_templates = [instance_template]
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" % ",".join(new_disk_templates),
",".join(new_disk_templates)], "--ipolicy-disk-templates=%s" % ",".join(new_disk_templates)],
fail=False) fail=False)
......
...@@ -1027,8 +1027,8 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1027,8 +1027,8 @@ def TestInstanceCreationRestrictedByDiskTemplates():
# Setup the cluster with the enabled_disk_templates # Setup the cluster with the enabled_disk_templates
AssertCommand( AssertCommand(
["gnt-cluster", "modify", ["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" % ",".join(enabled_disk_templates),
",".join(enabled_disk_templates)], "--ipolicy-disk-templates=%s" % ",".join(enabled_disk_templates)],
fail=False) fail=False)
# Test instance creation for enabled disk templates # Test instance creation for enabled disk templates
...@@ -1054,8 +1054,8 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1054,8 +1054,8 @@ def TestInstanceCreationRestrictedByDiskTemplates():
for (enabled, disabled) in [(templates1, templates2), for (enabled, disabled) in [(templates1, templates2),
(templates2, templates1)]: (templates2, templates1)]:
AssertCommand(["gnt-cluster", "modify", AssertCommand(["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" % ",".join(enabled),
",".join(enabled)], "--ipolicy-disk-templates=%s" % ",".join(enabled)],
fail=False) fail=False)
for disk_template in disabled: for disk_template in disabled:
CreateInstanceByDiskTemplate(nodes, disk_template, fail=True) CreateInstanceByDiskTemplate(nodes, disk_template, fail=True)
...@@ -1068,6 +1068,8 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1068,6 +1068,8 @@ def TestInstanceCreationRestrictedByDiskTemplates():
set(enabled_disk_templates)) set(enabled_disk_templates))
AssertCommand(["gnt-cluster", "modify", AssertCommand(["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" %
",".join(other_disk_templates),
"--ipolicy-disk-templates=%s" %
",".join(other_disk_templates)], ",".join(other_disk_templates)],
fail=False) fail=False)
CreateInstanceByDiskTemplate(nodes, enabled_disk_templates[0], fail=True) CreateInstanceByDiskTemplate(nodes, enabled_disk_templates[0], fail=True)
...@@ -1078,5 +1080,7 @@ def TestInstanceCreationRestrictedByDiskTemplates(): ...@@ -1078,5 +1080,7 @@ def TestInstanceCreationRestrictedByDiskTemplates():
# Restore initially enabled disk templates # Restore initially enabled disk templates
AssertCommand(["gnt-cluster", "modify", AssertCommand(["gnt-cluster", "modify",
"--enabled-disk-templates=%s" % "--enabled-disk-templates=%s" %
",".join(enabled_disk_templates),
"--ipolicy-disk-templates=%s" %
",".join(enabled_disk_templates)], ",".join(enabled_disk_templates)],
fail=False) fail=False)
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