From 90eb468c7ea5a55294789c8ea7e5b96841100f40 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 3 Dec 2008 11:12:04 +0000
Subject: [PATCH] CheckBEParams handle a bool BE_AUTO_BALANCE

This only happens at cluster init, if the value is not user-specified.

Reviewed-by: imsnah
---
 lib/utils.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/utils.py b/lib/utils.py
index 17b5d3c65..97d6b8198 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -542,12 +542,13 @@ def CheckBEParams(beparams):
           beparams[item] = val
       if item in (constants.BE_AUTO_BALANCE):
         val = beparams[item]
-        if val == constants.VALUE_TRUE:
-          beparams[item] = True
-        elif val == constants.VALUE_FALSE:
-          beparams[item] = False
-        else:
-          raise errors.OpPrereqError("Invalid %s value: %s" % (item, val))
+        if not isinstance(val, bool):
+          if val == constants.VALUE_TRUE:
+            beparams[item] = True
+          elif val == constants.VALUE_FALSE:
+            beparams[item] = False
+          else:
+            raise errors.OpPrereqError("Invalid %s value: %s" % (item, val))
 
 
 def NiceSort(name_list):
-- 
GitLab