> > Optional nitpick: > s/bad_items/bad_nodes/ > > > > + gl' = foldl (flip $ IntMap.adjust Group.setUnallocable) gl > > + $ map Node.group bad_items > > + grps_remaining = any Group.isAllocable $ IntMap.elems gl' > > + stop_allocation = case Cluster.computeBadItems nl il of > > > > As the bad items have already been computed earlier, can't you just use > bad_items / bad_nodes here? > This also eliminates the tuple matching in the second case. >
I propose the following interdiff, but I'll also resend the fully rebased series according to your comment on patch 3. commit 19348eed94dd43390bfddb2861c5f8fc879f9f86 Author: Klaus Aehlig <[email protected]> Date: Wed Jun 25 14:18:33 2014 +0200 ...INTERDIFF [PATCH stable-2.10 04/10] Make hspace support --independent-groups diff --git a/src/Ganeti/HTools/Program/Hspace.hs b/src/Ganeti/HTools/Program/Hspace.hs index 962a06c..f67623b 100644 --- a/src/Ganeti/HTools/Program/Hspace.hs +++ b/src/Ganeti/HTools/Program/Hspace.hs @@ -481,13 +481,13 @@ main opts args = do printCluster machine_r (Cluster.totalResources nl) (length all_nodes) (Node.haveExclStorage nl) - let (bad_items, _) = Cluster.computeBadItems nl il + let (bad_nodes, _) = Cluster.computeBadItems nl il gl' = foldl (flip $ IntMap.adjust Group.setUnallocable) gl - $ map Node.group bad_items + $ map Node.group bad_nodes grps_remaining = any Group.isAllocable $ IntMap.elems gl' - stop_allocation = case Cluster.computeBadItems nl il of + stop_allocation = case () of _ | independent_grps && grps_remaining -> Nothing - ([], _) -> Nothing + _ | null bad_nodes -> Nothing _ -> Just ([(FailN1, 1)]::FailStats, nl, il, [], []) alloclimit = if optMaxLength opts == -1 then Nothing -- Klaus Aehlig Google Germany GmbH, Dienerstr. 12, 80331 Muenchen Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores
