Revision 80b27509

b/htools/Ganeti/HTools/Cluster.hs
898 898
                 inst@(Instance.Instance {Instance.diskTemplate = DTDrbd8})
899 899
                 gdx avail_nodes =
900 900
  do
901
    let op_fn = ReplaceSecondary
901 902
    (nl', inst', _, ndx) <- annotateResult "Can't find any good node" $
902 903
                            eitherToResult $
903
                            foldl' (evacDrbdSecondaryInner nl inst gdx)
904
                            foldl' (evacDrbdSecondaryInner nl inst gdx op_fn)
904 905
                            (Left "no nodes available") avail_nodes
905 906
    let idx = Instance.idx inst
906 907
        il' = Container.add idx inst' il
907
        ops = iMoveToJob nl' il' idx (ReplaceSecondary ndx)
908
        ops = iMoveToJob nl' il' idx (op_fn ndx)
908 909
    return (nl', il', ops)
909 910

  
910 911
-- The algorithm for ChangeAll is as follows:
......
956 957
evacDrbdSecondaryInner :: Node.List -- ^ Cluster node list
957 958
                       -> Instance.Instance -- ^ Instance being evacuated
958 959
                       -> Gdx -- ^ The group index of the instance
960
                       -> (Ndx -> IMove) -- ^ Operation constructor
959 961
                       -> EvacInnerState  -- ^ Current best solution
960 962
                       -> Ndx  -- ^ Node we're evaluating as new secondary
961 963
                       -> EvacInnerState -- ^ New best solution
962
evacDrbdSecondaryInner nl inst gdx accu ndx =
963
  case applyMove nl inst (ReplaceSecondary ndx) of
964
evacDrbdSecondaryInner nl inst gdx op_fn accu ndx =
965
  case applyMove nl inst (op_fn ndx) of
964 966
    OpFail fm ->
965 967
      case accu of
966 968
        Right _ -> accu

Also available in: Unified diff