Currently there is no way to QA with (for example) an initrd because
the QA only inits the cluster with the default parameters. This makes
it impossible to QA using anything but the default parameters, which
doesn't always work.

Additionally, we add OS parameters and OS hypervisor parameters, for
completeness and for testing that these commands also work.
---
 Sending this against 2.4 so that we can add new QA options for both 2.4 and
 master.

 Tested on a small 1-node cluster just for the init/modify part.

 qa/qa-sample.json |    8 ++++++++
 qa/qa_cluster.py  |   28 ++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index 6e62f80..e7e0d1c 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -2,6 +2,14 @@
   "name": "xen-test",
   "rename": "xen-test-rename",
   "enabled-hypervisors": "xen-pvm",
+  "# Dict of hypervisor name and parameters (like on the cmd line)": null,
+  "hypervisor-parameters": {},
+  "# Backend parameters (like on the cmd line)": null,
+  "backend-parameters": "",
+  "# Dict of OS name and parameters (like on the cmd line)": null,
+  "os-parameters": {},
+  "# Dict of OS name and value dict of hypervisor  parameters": null,
+  "os-hvp": {},
   "primary_ip_version": 4,
 
   "os": "debian-etch",
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 176bcd9..aa1fd70 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -96,6 +96,30 @@ def TestClusterInit(rapi_user, rapi_secret):
 
   AssertCommand(cmd)
 
+  cmd = ["gnt-cluster", "modify"]
+  # hypervisor parameter modifications
+  hvp = qa_config.get("hypervisor-parameters", {})
+  for k, v in hvp.items():
+    cmd.extend(["-H", "%s:%s" % (k, v)])
+  # backend parameter modifications
+  bep = qa_config.get("backend-parameters", "")
+  if bep:
+    cmd.extend(["-B", bep])
+
+  if len(cmd) > 2:
+    AssertCommand(cmd)
+
+  # OS parameters
+  osp = qa_config.get("os-parameters", {})
+  for k, v in osp.items():
+    AssertCommand(["gnt-os", "modify", "-O", v, k])
+
+  # OS hypervisor parameters
+  os_hvp = qa_config.get("os-hvp", {})
+  for os_name in os_hvp:
+    for hv, hvp in os_hvp[os_name].items():
+      AssertCommand(["gnt-os", "modify", "-H", "%s:%s" % (hv, hvp), os_name])
+
 
 def TestClusterRename():
   """gnt-cluster rename"""
@@ -206,6 +230,10 @@ def TestClusterModifyBe():
     ]:
     AssertCommand(cmd, fail=fail)
 
+  # redo the original-requested BE parameters, if any
+  bep = qa_config.get("backend-parameters", "")
+  if bep:
+    AssertCommand(["gnt-cluster", "modify", "-B", bep])
 
 def TestClusterInfo():
   """gnt-cluster info"""
-- 
1.7.3.1

Reply via email to