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