Revision 9dcec001 Ganeti/HTools/Cluster.hs
b/Ganeti/HTools/Cluster.hs | ||
---|---|---|
624 | 624 |
-> Instance.List -- ^ The instance list |
625 | 625 |
-> Instance.Instance -- ^ The instance to allocate |
626 | 626 |
-> Int -- ^ Required number of nodes |
627 |
-> m [(Maybe Node.List, [Node.Node])] -- ^ Possible solution list |
|
627 |
-> m [(Maybe Node.List, Instance.Instance, [Node.Node])] |
|
628 |
-- ^ Possible solution list |
|
628 | 629 |
tryAlloc nl _ inst 2 = |
629 | 630 |
let all_nodes = getOnline nl |
630 | 631 |
all_pairs = liftM2 (,) all_nodes all_nodes |
631 | 632 |
ok_pairs = filter (\(x, y) -> Node.idx x /= Node.idx y) all_pairs |
632 |
sols = map (\(p, s) -> |
|
633 |
(fst $ allocateOnPair nl inst p s, [p, s]))
|
|
633 |
sols = map (\(p, s) -> let (mnl, i) = allocateOnPair nl inst p s
|
|
634 |
in (mnl, i, [p, s]))
|
|
634 | 635 |
ok_pairs |
635 | 636 |
in return sols |
636 | 637 |
|
637 | 638 |
tryAlloc nl _ inst 1 = |
638 | 639 |
let all_nodes = getOnline nl |
639 |
sols = map (\p -> (fst $ allocateOnSingle nl inst p, [p])) |
|
640 |
sols = map (\p -> let (mnl, i) = allocateOnSingle nl inst p |
|
641 |
in (mnl, i, [p])) |
|
640 | 642 |
all_nodes |
641 | 643 |
in return sols |
642 | 644 |
|
... | ... | |
651 | 653 |
-> Idx -- ^ The index of the instance to move |
652 | 654 |
-> Int -- ^ The numver of nodes required |
653 | 655 |
-> [Ndx] -- ^ Nodes which should not be used |
654 |
-> m [(Maybe Node.List, [Node.Node])] -- ^ Solution list |
|
656 |
-> m [(Maybe Node.List, Instance.Instance, [Node.Node])] |
|
657 |
-- ^ Solution list |
|
655 | 658 |
tryReloc nl il xid 1 ex_idx = |
656 | 659 |
let all_nodes = getOnline nl |
657 | 660 |
inst = Container.find xid il |
658 | 661 |
ex_idx' = (Instance.pnode inst):ex_idx |
659 | 662 |
valid_nodes = filter (not . flip elem ex_idx' . Node.idx) all_nodes |
660 | 663 |
valid_idxes = map Node.idx valid_nodes |
661 |
sols1 = map (\x -> let (mnl, _, _, _) =
|
|
662 |
applyMove nl inst (ReplaceSecondary x)
|
|
663 |
in (mnl, [Container.find x nl]) |
|
664 |
sols1 = map (\x -> let (mnl, i, _, _) =
|
|
665 |
applyMove nl inst (ReplaceSecondary x) |
|
666 |
in (mnl, i, [Container.find x nl])
|
|
664 | 667 |
) valid_idxes |
665 | 668 |
in return sols1 |
666 | 669 |
|
Also available in: Unified diff