Revision e0eb63f0 Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
563 563
    else
564 564
        if c == b then {- Failover and ... -}
565 565
            if d == a then {- that's all -}
566
                ("f", [printf "migrate %s" i])
566
                ("f", [printf "migrate -f %s" i])
567 567
            else
568 568
                (printf "f r:%s" d,
569
                 [printf "migrate %s" i,
569
                 [printf "migrate -f %s" i,
570 570
                  printf "replace-disks -n %s %s" d i])
571 571
        else
572 572
            if d == a then {- ... and keep primary as secondary -}
573 573
                (printf "r:%s f" c,
574 574
                 [printf "replace-disks -n %s %s" c i,
575
                  printf "migrate %s" i])
575
                  printf "migrate -f %s" i])
576 576
            else
577 577
                if d == b then {- ... keep same secondary -}
578 578
                    (printf "f r:%s f" c,
579
                     [printf "migrate %s" i,
579
                     [printf "migrate -f %s" i,
580 580
                      printf "replace-disks -n %s %s" c i,
581
                      printf "migrate %s" i])
581
                      printf "migrate -f %s" i])
582 582

  
583 583
                else {- Nothing in common -}
584 584
                    (printf "r:%s f r:%s" c d,
585 585
                     [printf "replace-disks -n %s %s" c i,
586
                      printf "migrate %s" i,
586
                      printf "migrate -f %s" i,
587 587
                      printf "replace-disks -n %s %s" d i])
588 588

  
589 589
{-| Converts a placement to string format -}
......
616 616

  
617 617
formatCmds :: [[String]] -> String
618 618
formatCmds cmd_strs =
619
    unlines $ map ("  echo " ++) $
619
    unlines $
620 620
    concat $ map (\(a, b) ->
621
        (printf "step %d" (a::Int)):(map ("gnt-instance " ++) b)) $
621
        (printf "echo step %d" (a::Int)):
622
        (printf "check"):
623
        (map ("gnt-instance " ++) b)) $
622 624
        zip [1..] cmd_strs
623 625

  
624 626
{-| Converts a solution to string format -}

Also available in: Unified diff