From f25508bef4e85032f0468e5a6f0f8930ff154e66 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 14 Sep 2011 12:43:38 +0200 Subject: [PATCH] hail: add an extra safety check in relocate If we select the primary as new secondary, better to fail than return wrong data to Ganeti. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- htools/Ganeti/HTools/IAlloc.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs index 81e6dfdf1..91b37066f 100644 --- a/htools/Ganeti/HTools/IAlloc.hs +++ b/htools/Ganeti/HTools/IAlloc.hs @@ -283,6 +283,8 @@ processRelocate gl nl il idx 1 exndx = do snode = Instance.sNode inst when (snode == sorig) $ fail "Internal error: instance didn't change secondary node?!" + when (snode == pnode) $ + fail "Internal error: selected primary as new secondary?!" nodes' <- if (nodes == [pnode, snode]) then return [snode] -- only the new secondary is needed -- GitLab