From 934c62dc6418e3bfe6869eadb024e5cb3215ed85 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 31 Mar 2010 11:51:15 +0200
Subject: [PATCH] Fix IAllocator multi-evacuate message

Since Ganeti passes full host names (not common-suffix-stripped), we
need to remove the suffix from the evac_nodes keys too. In case one node
is not part of the cluster, it will lead to a wrong error message, but
for now it fixes the problem.
---
 Ganeti/HTools/IAlloc.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Ganeti/HTools/IAlloc.hs b/Ganeti/HTools/IAlloc.hs
index b5c9ab6f9..52eaf1251 100644
--- a/Ganeti/HTools/IAlloc.hs
+++ b/Ganeti/HTools/IAlloc.hs
@@ -134,7 +134,8 @@ parseData body = do
         "multi-evacuate" ->
             do
               ex_names <- fromObj "evac_nodes" request
-              ex_nodes <- mapM (Container.findByName map_n) ex_names
+              let ex_names' = map (stripSuffix $ length csf) ex_names
+              ex_nodes <- mapM (Container.findByName map_n) ex_names'
               let ex_ndx = map Node.idx ex_nodes
               return $ Evacuate ex_ndx
         other -> fail ("Invalid request type '" ++ other ++ "'")
-- 
GitLab