From 8e671b7c5f4e516fb7f9c52dd14807eaaca331cc Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 25 Nov 2009 15:26:16 +0100
Subject: [PATCH] QA: improve usability with cluster-init: False

When not initialising the cluster, consider all nodes are added, so that
multi-node tests (e.g. export, replace) work correctly (if there are
nodes, of course).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 qa/ganeti-qa.py |  3 +++
 qa/qa_node.py   | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index d66d8c322..5c399e72c 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -77,6 +77,9 @@ def SetupCluster():
   if qa_config.TestEnabled('create-cluster'):
     RunTest(qa_cluster.TestClusterInit)
     RunTest(qa_node.TestNodeAddAll)
+  else:
+    # consider the nodes are already there
+    qa_node.MarkNodeAddedAll()
   if qa_config.TestEnabled('node-info'):
     RunTest(qa_node.TestNodeInfo)
 
diff --git a/qa/qa_node.py b/qa/qa_node.py
index 8d17a4cb3..025683c1c 100644
--- a/qa/qa_node.py
+++ b/qa/qa_node.py
@@ -66,6 +66,18 @@ def TestNodeAddAll():
       _NodeAdd(node, readd=False)
 
 
+def MarkNodeAddedAll():
+  """Mark all nodes as added.
+
+  This is useful if we don't create the cluster ourselves (in qa).
+
+  """
+  master = qa_config.GetMasterNode()
+  for node in qa_config.get('nodes'):
+    if node != master:
+      node['_added'] = True
+
+
 def TestNodeRemoveAll():
   """Removing all nodes from cluster."""
   master = qa_config.GetMasterNode()
-- 
GitLab