> -possibleMoves MirrorExternal _ True _ tdx =
> +possibleMoves MirrorExternal _ True False _ tdx =
>    [ FailoverToAny tdx ]
>  
> -possibleMoves MirrorInternal _ False _ tdx =
> +possibleMoves MirrorExternal _ True True _ _ = []
> +

[...]

> +      migrations = concatMap (possibleMoves mir_type use_secondary inst_moves
> +                              False (rest_mig, primary_drained)) nodes
>        all_moves =
>          if disk_moves
> -          then concatMap (possibleMoves mir_type use_secondary inst_moves
> -                          (rest_mig, primary_drained))
> -               nodes
> -          else []
> +          then migrations ++
> +               concatMap (possibleMoves mir_type use_secondary inst_moves
> +                          True (rest_mig, primary_drained)) nodes
> +          else migrations
>      in
>        -- iterate over the possible nodes for this instance
>        foldl' (checkSingleStep ini_tbl target) aft_failover all_moves

While technically avoiding the problem of considering certain moves
twice, the solution is quite hackish: from the description "generate
the possible moves" I would not guess that FailoverToAny is disallowed(!)
for externally mirrored instances as soon as we allow(!) disk moves.

Why not define possibleMoves to really return all possible moves under
the given constraints and have a simple

all_moves = concatMap (possibleMoves mir_type use_secondary inst_moves 
disk_moves (rest_mig, primary_drained)) nodes

?

Thanks,
Klaus


-- 
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

Reply via email to