From 8fe9239ee5e338e00b486609b306e32add066fe5 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 16 Mar 2010 11:34:06 +0100
Subject: [PATCH] Fix behaviour of gnt-node modify -C no

The current check on whether we require auto_promote or not is wrong, as
we check whether we will have exactly the correct number of master
candidates left. But it is fine if we have more (e.g. when CPS=10 and
mc_remaning=19) than the current number, and in that case we shouldn't
require auto promotion.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cmdlib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 32fdef9af..4d15b6933 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3339,7 +3339,7 @@ class LUSetNodeParams(LogicalUnit):
       # candidates
       (mc_remaining, mc_should, _) = \
           self.cfg.GetMasterCandidateStats(exceptions=[node.name])
-      if mc_remaining != mc_should:
+      if mc_remaining < mc_should:
         raise errors.OpPrereqError("Not enough master candidates, please"
                                    " pass auto_promote to allow promotion",
                                    errors.ECODE_INVAL)
-- 
GitLab