Commit 2dae8d64 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

QA: Test cluster init/modify wrt enabled disk templates



Fixes the QA of 'gnt-cluster init' and 'gnt-cluster modify' with respect
to enabling disk templates.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarMichele Tartara <mtarara@google.com>
parent 3bde79ee
......@@ -177,7 +177,7 @@ def RunClusterTests():
("cluster-modify", qa_cluster.TestClusterModifyISpecs),
("cluster-modify", qa_cluster.TestClusterModifyBe),
("cluster-modify", qa_cluster.TestClusterModifyDisk),
("cluster-modify", qa_cluster.TestClusterModifyStorageTypes),
("cluster-modify", qa_cluster.TestClusterModifyDiskTemplates),
("cluster-rename", qa_cluster.TestClusterRename),
("cluster-info", qa_cluster.TestClusterVersion),
("cluster-info", qa_cluster.TestClusterInfo),
......
......@@ -27,7 +27,11 @@
"vg-name": "xenvg",
"# Cluster-level value of the exclusive-storage flag": null,
"exclusive-storage": null,
"enabled-storage-types": "lvm-vg",
"enabled-disk-templates": [
"plain",
"drbd",
"diskless"
],
"# Additional arguments for initializing cluster": null,
"cluster-init-args": [],
......
......@@ -176,8 +176,8 @@ def TestClusterInit(rapi_user, rapi_secret):
"gnt-cluster", "init",
"--primary-ip-version=%d" % qa_config.get("primary_ip_version", 4),
"--enabled-hypervisors=%s" % ",".join(qa_config.GetEnabledHypervisors()),
"--enabled-storage-types=%s" %
",".join(qa_config.GetEnabledStorageTypes())
"--enabled-disk-templates=%s" %
",".join(qa_config.GetEnabledDiskTemplates())
]
for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count",
......@@ -390,29 +390,29 @@ def TestClusterModifyDisk():
AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True)
def TestClusterModifyStorageTypes():
"""gnt-cluster modify --enabled-storage-types=..."""
default_storage_type = qa_config.GetDefaultStorageType()
def TestClusterModifyDiskTemplates():
"""gnt-cluster modify --enabled-disk-templates=..."""
default_disk_template = qa_config.GetDefaultDiskTemplate()
AssertCommand(
["gnt-cluster", "modify",
"--enabled-storage-types=%s" % default_storage_type],
"--enabled-disk-templates=%s" % default_disk_template],
fail=False)
AssertCommand(["gnt-cluster", "info"])
AssertCommand(
["gnt-cluster", "modify",
"--enabled-storage-types=%s" %
",".join(qa_config.GetEnabledStorageTypes())],
"--enabled-disk-template=%s" %
",".join(qa_config.GetEnabledDiskTemplates())],
fail=False)
AssertCommand(["gnt-cluster", "info"])
# bogus types
# bogus templates
AssertCommand(["gnt-cluster", "modify",
"--enabled-storage-types=pinkbunny"],
"--enabled-disk-templates=pinkbunny"],
fail=True)
# duplicate entries do no harm
AssertCommand(
["gnt-cluster", "modify",
"--enabled-storage-types=%s,%s" %
(default_storage_type, default_storage_type)],
"--enabled-disk-templates=%s,%s" %
(default_disk_template, default_disk_template)],
fail=False)
AssertCommand(["gnt-cluster", "info"])
......
......@@ -38,7 +38,7 @@ _INSTANCE_CHECK_KEY = "instance-check"
_ENABLED_HV_KEY = "enabled-hypervisors"
_VCLUSTER_MASTER_KEY = "vcluster-master"
_VCLUSTER_BASEDIR_KEY = "vcluster-basedir"
_ENABLED_STORAGE_TYPES_KEY = "enabled-storage-types"
_ENABLED_DISK_TEMPLATES_KEY = "enabled-disk-templates"
#: QA configuration (L{_QaConfig})
_config = None
......@@ -360,21 +360,21 @@ class _QaConfig(object):
"""
return self.GetEnabledHypervisors()[0]
def GetEnabledStorageTypes(self):
"""Returns the list of enabled storage types.
def GetEnabledDiskTemplates(self):
"""Returns the list of enabled disk templates.
@rtype: list
"""
return self._GetStringListParameter(
_ENABLED_STORAGE_TYPES_KEY,
list(constants.DEFAULT_ENABLED_STORAGE_TYPES))
_ENABLED_DISK_TEMPLATES_KEY,
list(constants.DEFAULT_ENABLED_DISK_TEMPLATES))
def GetDefaultStorageType(self):
"""Returns the default storage type to be used.
def GetDefaultDiskTemplate(self):
"""Returns the default disk template to be used.
"""
return self.GetEnabledStorageTypes()[0]
return self.GetEnabledDiskTemplates()[0]
def _GetStringListParameter(self, key, default_values):
"""Retrieves a parameter's value that is supposed to be a list of strings.
......@@ -551,18 +551,18 @@ def GetDefaultHypervisor(*args):
return GetConfig().GetDefaultHypervisor(*args)
def GetEnabledStorageTypes(*args):
"""Wrapper for L{_QaConfig.GetEnabledStorageTypes}.
def GetEnabledDiskTemplates(*args):
"""Wrapper for L{_QaConfig.GetEnabledDiskTemplates}.
"""
return GetConfig().GetEnabledStorageTypes(*args)
return GetConfig().GetEnabledDiskTemplates(*args)
def GetDefaultStorageType(*args):
"""Wrapper for L{_QaConfig.GetDefaultStorageType}.
def GetDefaultDiskTemplate(*args):
"""Wrapper for L{_QaConfig.GetDefaultDiskTemplate}.
"""
return GetConfig().GetDefaultStorageType(*args)
return GetConfig().GetDefaultDiskTemplate(*args)
def GetMasterNode():
......
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