diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index f302c11320665fd361abb735c4622716191f9554..56b819bd259366a9afc3ce4476aa7efb4a01f754 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 971e4d3e5cf4945f8c9022f65863cda9e6ca5a80..d50360ca0ad0bd75f2f3b07b4749621704a977b2 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -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", diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index aeb4d43bfce1bee503a3456dd0cafef33735fe5d..09434a70d80274d877e79414ef6389d61cbcd53b 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -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 diff --git a/qa/qa_config.py b/qa/qa_config.py index 25870bada61f060cbee868cbb464aee5617771db..afa553de0a944533b7d0739c853870a6050cc552 100644 --- a/qa/qa_config.py +++ b/qa/qa_config.py @@ -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.