Commit a7e1fd89 authored by Iustin Pop's avatar Iustin Pop
Browse files

hbal: relax restrictions on split instances

The recent patch series on hcheck made me realise how much pain we
have due to hbal not being able to work (at all) with split instances.

This is sub-optimal; ideally, hbal would degrade its behaviour, but
not completely refuse to work. This patch does this, by marking any
split instances as not movable (since such instances most likely mean
that some manual intervention is done on then), but otherwise
proceeding with the rebalance of the selected node group.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarRené Nussbaumer <>
parent 5b93f2ec
......@@ -55,6 +55,7 @@ import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.Node as Node
import qualified Ganeti.HTools.Group as Group
import qualified Ganeti.HTools.Cluster as Cluster
import Ganeti.HTools.Types
import Ganeti.HTools.Utils
......@@ -246,6 +247,13 @@ updateMovable selinsts exinsts inst =
then Instance.setMovable inst False
else inst
-- | Disables moves for instances with a split group.
disableSplitMoves :: Node.List -> Instance.Instance -> Instance.Instance
disableSplitMoves nl inst =
if not . isOk . Cluster.instanceGroup nl $ inst
then Instance.setMovable inst False
else inst
-- | Compute the longest common suffix of a list of strings that
-- starts with a dot.
longestDomain :: [String] -> String
......@@ -302,8 +310,9 @@ mergeData um extags selinsts exinsts cdata@(ClusterData gl nl il2 tags _) =
nl3 = (setNodePolicy gl .
computeAlias common_suffix .
(`Node.buildPeers` il4)) nl2
il5 = (disableSplitMoves nl3) il4
in if' (null lkp_unknown)
(Ok cdata { cdNodes = nl3, cdInstances = il4 })
(Ok cdata { cdNodes = nl3, cdInstances = il5 })
(Bad $ "Unknown instance(s): " ++ show(map lrContent lkp_unknown))
-- | Checks the cluster data for consistency.
......@@ -301,11 +301,10 @@ checkCluster verbose nl il = do
-- hbal doesn't currently handle split clusters
let split_insts = Cluster.findSplitInstances nl il
unless (null split_insts) $ do
unless (null split_insts || verbose <= 1) $ do
hPutStrLn stderr "Found instances belonging to multiple node groups:"
mapM_ (\i -> hPutStrLn stderr $ " " ++ i) split_insts
hPutStrLn stderr "Aborting."
exitWith $ ExitFailure 1
hPutStrLn stderr "These instances will not be moved."
printf "Loaded %d nodes, %d instances\n"
(Container.size nl)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment