Commit 6a0f22e1 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

QA: Added exclusive_storage to qa_config



QA configuration now tracks the state of the exclusive_storage flag at
cluster level. This will be used to selectively enable tests according to
the configuration.

Also, it's now possible to specify the initial value of the
exclusive_storage flag in the configuration file.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent cf632f3e
......@@ -129,6 +129,10 @@ def SetupCluster(rapi_user, rapi_secret):
"""
RunTestIf("create-cluster", qa_cluster.TestClusterInit,
rapi_user, rapi_secret)
if not qa_config.TestEnabled("create-cluster"):
# If the cluster is already in place, we assume that exclusive-storage is
# already set according to the configuration
qa_config.SetExclusiveStorage(qa_config.get("exclusive-storage", False))
# Test on empty cluster
RunTestIf("node-list", qa_node.TestNodeList)
......
......@@ -21,6 +21,8 @@
"primary_ip_version": 4,
"# Name of the LVM group for the cluster": null,
"vg-name": "xenvg",
"# Cluster-level value of the exclusive-storage flag": null,
"exclusive-storage": null,
"# Network interface for master role": null,
"#master-netdev": "xen-br0",
......
......@@ -201,6 +201,14 @@ def TestClusterInit(rapi_user, rapi_secret):
cmd.append("--nic-parameters=%s" %
",".join(utils.FormatKeyValue(nicparams)))
# Cluster value of the exclusive-storage node parameter
e_s = qa_config.get("exclusive-storage")
if e_s is not None:
cmd.extend(["--node-parameters", "exclusive_storage=%s" % e_s])
else:
e_s = False
qa_config.SetExclusiveStorage(e_s)
cmd.append(qa_config.get("name"))
AssertCommand(cmd)
......@@ -655,6 +663,7 @@ def TestSetExclStorCluster(newvalue):
if effvalue != newvalue:
raise qa_error.Error("exclusive_storage has the wrong value: %s instead"
" of %s" % (effvalue, newvalue))
qa_config.SetExclusiveStorage(newvalue)
return oldvalue
......
......@@ -35,6 +35,8 @@ import qa_error
_INSTANCE_CHECK_KEY = "instance-check"
_ENABLED_HV_KEY = "enabled-hypervisors"
# Key to store the cluster-wide run-time value of the exclusive storage flag
_EXCLUSIVE_STORAGE_KEY = "_exclusive_storage"
cfg = {}
......@@ -242,6 +244,22 @@ def SetInstanceTemplate(inst, template):
inst["_template"] = template
def SetExclusiveStorage(value):
"""Set the expected value of the exclusive_storage flag for the cluster.
"""
cfg[_EXCLUSIVE_STORAGE_KEY] = bool(value)
def GetExclusiveStorage():
"""Get the expected value of the exclusive_storage flag for the cluster.
"""
val = cfg.get(_EXCLUSIVE_STORAGE_KEY)
assert val is not None
return val
def AcquireNode(exclude=None):
"""Returns the least used node.
......
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