Commit f2e50930 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Restrict instance moves in hroller to the same node group



When scheduling rolling reboots, hroller looks for nodes to evacuate
the non-redundant instances to. This is done by greedily moving
instances to other nodes that can take them, policy wise and capacity
wise. There is, however, another restriction to be taken into account:
instances should only be moved within a node group. This is achieved
by this patch.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 342a9b3b
......@@ -113,10 +113,14 @@ locateInstances idxs ndxs conf =
clearNodes :: [Ndx] -> [Ndx] -> (Node.List, Instance.List)
-> Result ([Ndx], (Node.List, Instance.List))
clearNodes [] _ conf = return ([], conf)
clearNodes (ndx:ndxs) targets conf = withFirst `mplus` withoutFirst where
clearNodes (ndx:ndxs) targets conf@(nl, _) =
withFirst `mplus` withoutFirst where
withFirst = do
let othernodes = delete ndx targets
conf' <- locateInstances (nonRedundant conf ndx) othernodes conf
grp = Node.group $ Container.find ndx nl
othernodesSameGroup =
filter ((==) grp . Node.group . flip Container.find nl) othernodes
conf' <- locateInstances (nonRedundant conf ndx) othernodesSameGroup conf
(ndxs', conf'') <- clearNodes ndxs othernodes conf'
return (ndx:ndxs', conf'')
withoutFirst = clearNodes ndxs targets conf
......
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