Commit 68c8c3df authored by Michael Hanselmann's avatar Michael Hanselmann

QA: Use constants for disk templates

Disk template names shouldn't be hardcoded.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarBernardo Dal Seno <bdalseno@google.com>
parent c6e300e6
...@@ -510,7 +510,7 @@ def TestClusterBurnin(): ...@@ -510,7 +510,7 @@ def TestClusterBurnin():
master = qa_config.GetMasterNode() master = qa_config.GetMasterNode()
options = qa_config.get("options", {}) options = qa_config.get("options", {})
disk_template = options.get("burnin-disk-template", "drbd") disk_template = options.get("burnin-disk-template", constants.DT_DRBD8)
parallel = options.get("burnin-in-parallel", False) parallel = options.get("burnin-in-parallel", False)
check_inst = options.get("burnin-check-instances", False) check_inst = options.get("burnin-check-instances", False)
do_rename = options.get("burnin-rename", "") do_rename = options.get("burnin-rename", "")
......
...@@ -194,7 +194,7 @@ def IsDiskReplacingSupported(instance): ...@@ -194,7 +194,7 @@ def IsDiskReplacingSupported(instance):
def TestInstanceAddWithPlainDisk(nodes): def TestInstanceAddWithPlainDisk(nodes):
"""gnt-instance add -t plain""" """gnt-instance add -t plain"""
assert len(nodes) == 1 assert len(nodes) == 1
return _DiskTest(nodes[0].primary, "plain") return _DiskTest(nodes[0].primary, constants.DT_PLAIN)
@InstanceCheck(None, INST_UP, RETURN_VALUE) @InstanceCheck(None, INST_UP, RETURN_VALUE)
...@@ -202,7 +202,7 @@ def TestInstanceAddWithDrbdDisk(nodes): ...@@ -202,7 +202,7 @@ def TestInstanceAddWithDrbdDisk(nodes):
"""gnt-instance add -t drbd""" """gnt-instance add -t drbd"""
assert len(nodes) == 2 assert len(nodes) == 2
return _DiskTest(":".join(map(operator.attrgetter("primary"), nodes)), return _DiskTest(":".join(map(operator.attrgetter("primary"), nodes)),
"drbd") constants.DT_DRBD8)
@InstanceCheck(None, INST_DOWN, FIRST_ARG) @InstanceCheck(None, INST_DOWN, FIRST_ARG)
...@@ -498,14 +498,16 @@ def TestInstanceStoppedModify(instance): ...@@ -498,14 +498,16 @@ def TestInstanceStoppedModify(instance):
def TestInstanceConvertDiskToPlain(instance, inodes): def TestInstanceConvertDiskToPlain(instance, inodes):
"""gnt-instance modify -t""" """gnt-instance modify -t"""
name = instance.name name = instance.name
template = qa_config.GetInstanceTemplate(instance) template = qa_config.GetInstanceTemplate(instance)
if template != "drbd": if template != constants.DT_DRBD8:
print qa_utils.FormatInfo("Unsupported template %s, skipping conversion" print qa_utils.FormatInfo("Unsupported template %s, skipping conversion"
" test" % template) " test" % template)
return return
assert len(inodes) == 2 assert len(inodes) == 2
AssertCommand(["gnt-instance", "modify", "-t", "plain", name]) AssertCommand(["gnt-instance", "modify", "-t", constants.DT_PLAIN, name])
AssertCommand(["gnt-instance", "modify", "-t", "drbd", AssertCommand(["gnt-instance", "modify", "-t", constants.DT_DRBD8,
"-n", inodes[1].primary, name]) "-n", inodes[1].primary, name])
......
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