Revision f2e50930 src/Ganeti/HTools/Program/Hroller.hs

b/src/Ganeti/HTools/Program/Hroller.hs
113 113
clearNodes :: [Ndx] -> [Ndx] -> (Node.List, Instance.List)
114 114
              -> Result ([Ndx], (Node.List, Instance.List))
115 115
clearNodes [] _ conf = return ([], conf)
116
clearNodes (ndx:ndxs) targets conf = withFirst `mplus` withoutFirst where
116
clearNodes (ndx:ndxs) targets conf@(nl, _) =
117
  withFirst `mplus` withoutFirst where
117 118
  withFirst = do
118 119
     let othernodes = delete ndx targets
119
     conf' <- locateInstances (nonRedundant conf ndx) othernodes conf
120
         grp = Node.group $ Container.find ndx nl
121
         othernodesSameGroup =
122
           filter ((==) grp . Node.group . flip Container.find nl) othernodes
123
     conf' <- locateInstances (nonRedundant conf ndx) othernodesSameGroup conf
120 124
     (ndxs', conf'') <- clearNodes ndxs othernodes conf'
121 125
     return (ndx:ndxs', conf'')
122 126
  withoutFirst = clearNodes ndxs targets conf

Also available in: Unified diff