Commit dacd8ba4 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

QA: Extend cluster QA wrt enabled storage types

This extends the QA scripts to test the changes in 'gnt-cluster init',
'gnt-cluster info', and 'gnt-cluster modify' with respect to enabled
storage types.
Signed-off-by: default avatarHelga Velroyen <>
Reviewed-by: default avatarGuido Trotter <>
parent c074a9e8
......@@ -177,6 +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-rename", qa_cluster.TestClusterRename),
("cluster-info", qa_cluster.TestClusterVersion),
("cluster-info", qa_cluster.TestClusterInfo),
......@@ -27,6 +27,7 @@
"vg-name": "xenvg",
"# Cluster-level value of the exclusive-storage flag": null,
"exclusive-storage": null,
"enabled-storage-types": "lvm-vg",
"# Additional arguments for initializing cluster": null,
"cluster-init-args": [],
......@@ -190,6 +190,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" %
for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count",
......@@ -402,6 +404,33 @@ def TestClusterModifyDisk():
AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True)
def TestClusterModifyStorageTypes():
"""gnt-cluster modify --enabled-storage-types=..."""
default_storage_type = qa_config.GetDefaultStorageType()
["gnt-cluster", "modify",
"--enabled-storage-types=%s" % default_storage_type],
AssertCommand(["gnt-cluster", "info"])
["gnt-cluster", "modify",
"--enabled-storage-types=%s" %
AssertCommand(["gnt-cluster", "info"])
# bogus types
AssertCommand(["gnt-cluster", "modify",
# duplicate entries do no harm
["gnt-cluster", "modify",
"--enabled-storage-types=%s,%s" %
(default_storage_type, default_storage_type)],
AssertCommand(["gnt-cluster", "info"])
def TestClusterModifyBe():
"""gnt-cluster modify -B"""
for fail, cmd in [
......@@ -38,6 +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"
#: QA configuration (L{_QaConfig})
_config = None
......@@ -348,29 +349,51 @@ class _QaConfig(object):
@rtype: list
return self._GetStringListParameter(
def GetDefaultHypervisor(self):
"""Returns the default hypervisor to be used.
return self.GetEnabledHypervisors()[0]
def GetEnabledStorageTypes(self):
"""Returns the list of enabled storage types.
@rtype: list
return self._GetStringListParameter(
def GetDefaultStorageType(self):
"""Returns the default storage type to be used.
return self.GetEnabledStorageTypes()[0]
def _GetStringListParameter(self, key, default_values):
"""Retrieves a parameter's value that is supposed to be a list of strings.
@rtype: list
value = self._data[_ENABLED_HV_KEY]
value = self._data[key]
except KeyError:
return default_values
if value is None:
return []
elif isinstance(value, basestring):
# The configuration key ("enabled-hypervisors") implies there can be
# multiple values. Multiple hypervisors are comma-separated on the
# command line option to "gnt-cluster init", so we need to handle them
# equally here.
return value.split(",")
return value
def GetDefaultHypervisor(self):
"""Returns the default hypervisor to be used.
return self.GetEnabledHypervisors()[0]
def SetExclusiveStorage(self, value):
"""Set the expected value of the C{exclusive_storage} flag for the cluster.
......@@ -528,6 +551,20 @@ def GetDefaultHypervisor(*args):
return GetConfig().GetDefaultHypervisor(*args)
def GetEnabledStorageTypes(*args):
"""Wrapper for L{_QaConfig.GetEnabledStorageTypes}.
return GetConfig().GetEnabledStorageTypes(*args)
def GetDefaultStorageType(*args):
"""Wrapper for L{_QaConfig.GetDefaultStorageType}.
return GetConfig().GetDefaultStorageType(*args)
def GetMasterNode():
"""Wrapper for L{_QaConfig.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