When checking whether a node can be evacuated, do not
consider the node itself as an escape location.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/HTools/GlobalN1.hs | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/Ganeti/HTools/GlobalN1.hs b/src/Ganeti/HTools/GlobalN1.hs
index d60479c..ced324e 100644
--- a/src/Ganeti/HTools/GlobalN1.hs
+++ b/src/Ganeti/HTools/GlobalN1.hs
@@ -37,7 +37,6 @@ module Ganeti.HTools.GlobalN1
   ) where
 
 import Control.Monad (foldM)
-import qualified Data.IntMap as IntMap
 import Data.List (partition)
 
 import Ganeti.BasicTypes (isOk, Result)
@@ -78,8 +77,6 @@ canEvacuateNode (nl, il) n = isOk $ do
   (nl', il') <- opToResult
                 . foldM move (nl, il) $ map (flip (,) Failover) drbdIdxs
   -- evacuate other instances
-  let n' = Node.setOffline n True
-      nl'' = Container.add (Node.idx n') n' nl'
-  _ <- foldM (evac (Node.group n') . map Node.idx $ IntMap.elems nl'')
-             (nl'',il') sharedIdxs
+  let escapenodes = filter (/= Node.idx n) $ Container.keys nl'
+  _ <- foldM (evac (Node.group n) escapenodes) (nl',il') sharedIdxs
   return ()
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to