The issue that was fixed with the previous patch would
have been detected earlier if the QA would actually
run a 'verify' after the modify operations. For 'verify'
to not raise false negatives, we need to first reduce
the candidate pool size, because otherwise QA fails
with a warning about the mininmum pool size being
violated.

Signed-off-by: Helga Velroyen <[email protected]>
---
 qa/qa_config.py | 18 ++++++++++++++++++
 qa/qa_node.py   | 13 +++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/qa/qa_config.py b/qa/qa_config.py
index 276b92c..78e8865 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -497,6 +497,17 @@ class _QaConfig(object):
     """
     return self["nodes"][0]
 
+  def GetAllNodes(self):
+    """Returns the list of nodes.
+
+    This is not intended to 'acquire' those nodes. For that,
+    C{AcquireManyNodes} is more inteded. However, often it is
+    helpful to know the total number of nodes available to
+    adjust cluster parameters and that's where this function
+    is useful.
+    """
+    return self["nodes"]
+
   def GetInstanceCheckScript(self):
     """Returns path to instance check script or C{None}.
 
@@ -851,6 +862,13 @@ def GetMasterNode():
   return GetConfig().GetMasterNode()
 
 
+def GetAllNodes():
+  """Wrapper for L{_QaConfig.GetAllNodeNames}.
+
+  """
+  return GetConfig().GetAllNodes()
+
+
 def AcquireInstance(_cfg=None):
   """Returns an instance which isn't in use.
 
diff --git a/qa/qa_node.py b/qa/qa_node.py
index b752932..d1d1403 100644
--- a/qa/qa_node.py
+++ b/qa/qa_node.py
@@ -252,6 +252,16 @@ def TestNodeEvacuate(node, node2):
 def TestNodeModify(node):
   """gnt-node modify"""
 
+  default_pool_size = 10
+  nodes = qa_config.GetAllNodes()
+  test_pool_size = len(nodes) - 1
+
+  # Reduce the number of master candidates, because otherwise all
+  # subsequent 'gnt-cluster verify' commands fail due to not enough
+  # master candidates.
+  AssertCommand(["gnt-cluster", "modify",
+                 "--candidate-pool-size=%s" % test_pool_size])
+
   # make sure enough master candidates will be available by disabling the
   # master candidate role first with --auto-promote
   AssertCommand(["gnt-node", "modify", "--master-candidate=no",
@@ -262,6 +272,7 @@ def TestNodeModify(node):
     for value in ["yes", "no"]:
       AssertCommand(["gnt-node", "modify", "--force",
                      "--%s=%s" % (flag, value), node.primary])
+      AssertCommand(["gnt-cluster", "verify"])
 
   AssertCommand(["gnt-node", "modify", "--master-candidate=yes", node.primary])
 
@@ -270,6 +281,8 @@ def TestNodeModify(node):
                  node.primary])
 
   AssertRedirectedCommand(["gnt-cluster", "verify"])
+  AssertCommand(["gnt-cluster", "modify",
+                 "--candidate-pool-size=%s" % default_pool_size])
 
 
 def _CreateOobScriptStructure():
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to