This patch makes sure that the Ganeti RAPI credentials are setup,
if any, on cluster init time.

Signed-off-by: René Nussbaumer <r...@google.com>
---
 qa/qa-sample.json |    3 +++
 qa/qa_cluster.py  |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index 8f6f4db..ae09588 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -6,6 +6,9 @@
   "os": "debian-etch",
   "mem": "512M",
 
+  "rapi-user": "foobar",
+  "rapi-pass": "barfoo",
+
   "# Lists of disk sizes": null,
   "disk": ["1G", "512M"],
   "disk-growth": ["2G", "768M"],
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 5c88a04..37d1c45 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -79,6 +79,21 @@ def TestClusterInit():
   AssertEqual(StartSSH(master['primary'],
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
+  # Create RAPI credentials
+  rapi_user = qa_config.get("rapi-user", default=None)
+  rapi_pass = qa_config.get("rapi-pass", default=None)
+
+  if rapi_user and rapi_pass:
+    cmds = []
+
+    cred_string = "%s %s write" % (rapi_user, rapi_pass)
+    cmds.append(("echo %s >> %s" %
+                 (utils.ShellQuote(cred_string),
+                  utils.ShellQuote(constants.RAPI_USERS_FILE))))
+    cmds.append("%s stop-master" % constants.DAEMON_UTIL)
+    cmds.append("%s start-master" % constants.DAEMON_UTIL)
+    AssertEqual(StartSSH(master['primary'], ' && '.join(cmds)).wait(), 0)
+
 
 def TestClusterRename():
   """gnt-cluster rename"""
-- 
1.7.0.1



-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to