Revision f4161783 Ganeti/HTools/Cluster.hs
b/Ganeti/HTools/Cluster.hs | ||
---|---|---|
63 | 63 |
, tieredAlloc |
64 | 64 |
, instanceGroup |
65 | 65 |
, findSplitInstances |
66 |
, splitCluster |
|
66 | 67 |
) where |
67 | 68 |
|
68 | 69 |
import Data.List |
... | ... | |
856 | 857 |
where isOk x = case x of |
857 | 858 |
Bad _ -> False |
858 | 859 |
_ -> True |
860 |
|
|
861 |
-- | Splits a cluster into the component node groups |
|
862 |
splitCluster :: Node.List -> Instance.List -> |
|
863 |
[(GroupID, (Node.List, Instance.List))] |
|
864 |
splitCluster nl il = |
|
865 |
let ngroups = Node.computeGroups (Container.elems nl) |
|
866 |
in map (\(guuid, nodes) -> |
|
867 |
let nidxs = map Node.idx nodes |
|
868 |
nodes' = zip nidxs nodes |
|
869 |
instances = Container.filter ((`elem` nidxs) . Instance.pNode) il |
|
870 |
in (guuid, (Container.fromAssocList nodes', instances))) ngroups |
Also available in: Unified diff