From 2f41ea77d971d188dcd2f4f61bd121bd169443ed Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 5 Aug 2011 16:48:49 +0200 Subject: [PATCH] Fix bug in IAllocator parsing of Evacuate result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 342f9172 added stricter checks for the iallocator result in evacuate mode, but it does this irrespective of the result status. When the result has failed and (according to the design) the list of nodes is empty, this code will trigger the following: node1# gnt-instance replace-disks -I hail instance14 Failure: command execution error: Groups of nodes returned by iallocator () differ from original groups (default) After the patch, the result is: node1# gnt-instance replace-disks -I hail instance14 Failure: prerequisites not met for this operation: error type: insufficient_resources, error details: Can't compute nodes using iallocator 'hail': Request failed: β¦ 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 7821e19c3..70efe7721 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -13192,7 +13192,7 @@ class IAllocator(object): request_groups = fn(self.relocate_from) result_groups = fn(rdict["result"]) - if result_groups != request_groups: + if self.success and result_groups != request_groups: raise errors.OpExecError("Groups of nodes returned by iallocator (%s)" " differ from original groups (%s)" % (utils.CommaJoin(result_groups), -- GitLab