This just adds the primary node of the instance as 'non-allocable'
during the choosing of the new secondary.

Signed-off-by: Iustin Pop <[email protected]>
Reviewed-by: Guido Trotter <[email protected]>
(cherry picked from commit 7073b3a86856bcd8d8a62c0b72f82deaabb8d8f1)

Signed-off-by: Iustin Pop <[email protected]>
---
 This needs to be on stable-2.5, committed on the wrong branch, sorry.

 htools/Ganeti/HTools/Cluster.hs |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index e036f95..36595c8 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -1107,10 +1107,11 @@ tryNodeEvac _ ini_nl ini_il mode idxs =
                       splitCluster ini_nl ini_il
         (fin_nl, fin_il, esol) =
             foldl' (\state@(nl, il, _) inst ->
-                        let gdx = instancePriGroup nl inst in
+                        let gdx = instancePriGroup nl inst
+                            pdx = Instance.pNode inst in
                         updateEvacSolution state (Instance.idx inst) $
                         availableGroupNodes group_ndx
-                          excl_ndx gdx >>=
+                          (IntSet.insert pdx excl_ndx) gdx >>=
                         nodeEvacInstance nl il mode inst gdx
                    )
             (ini_nl, ini_il, emptyEvacSolution)
-- 
1.7.7

Reply via email to