From 579f4ee5329a2b366b1c8c6cdb30cb8743e7ddd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Wed, 26 Sep 2012 14:53:53 +0200
Subject: [PATCH] Verify the node count just if the allocation was successful
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/masterd/iallocator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/masterd/iallocator.py b/lib/masterd/iallocator.py
index e86097dc5..71b83d68e 100644
--- a/lib/masterd/iallocator.py
+++ b/lib/masterd/iallocator.py
@@ -195,7 +195,7 @@ class IAReqInstanceAlloc(IARequestBase):
     """
     IARequestBase.ValidateResult(self, ia, result)
 
-    if len(result) != self.RequiredNodes():
+    if ia.success and len(result) != self.RequiredNodes():
       raise errors.ResultValidationError("iallocator returned invalid number"
                                          " of nodes (%s), required %s" %
                                          (len(result), self.RequiredNodes()))
-- 
GitLab