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

Signed-off-by: Bernardo Dal Seno <[email protected]>
---
 qa/ganeti-qa.py   |  4 ++++
 qa/qa-sample.json |  2 ++
 qa/qa_cluster.py  |  9 +++++++++
 qa/qa_config.py   | 17 +++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index fe1ffed..a3d51d3 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -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)
diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index d2c8790..f6f4e6e 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -19,6 +19,8 @@
   "# Dict of OS name and value dict of hypervisor  parameters": null,
   "os-hvp": {},
   "primary_ip_version": 4,
+  "# Cluster value of the exclusive-storage flag": null,
+  "exclusive-storage": null,
 
   "# Network interface for master role": null,
   "#master-netdev": "xen-br0",
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 407e06b..4e4d311 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -198,6 +198,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)
 
@@ -645,6 +653,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)
 
 
 def _BuildSetESCmd(value, node_name):
diff --git a/qa/qa_config.py b/qa/qa_config.py
index 25870ba..86838ce 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -35,6 +35,7 @@ import qa_error
 
 _INSTANCE_CHECK_KEY = "instance-check"
 _ENABLED_HV_KEY = "enabled-hypervisors"
+_EXCLUSIVE_STORAGE_KEY = "_exclusive_storage"
 
 
 cfg = {}
@@ -242,6 +243,22 @@ def SetInstanceTemplate(inst, template):
   inst["_template"] = template
 
 
+def SetExclusiveStorage(value):
+  """Set the exclusive_storage flag value for the cluster.
+
+  """
+  cfg[_EXCLUSIVE_STORAGE_KEY] = bool(value)
+
+
+def GetExclusiveStorage():
+  """Get 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.
 
-- 
1.8.1

-- 
You received this message because you are subscribed to the Google Groups 
"ganeti-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to