Revision a804261a Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
437 437
        best_tbl =
438 438
            foldl'
439 439
            (\ step_tbl em ->
440
                 if Instance.sNode em == Node.noSecondary then step_tbl
441
                    else compareTables step_tbl $
442
                         checkInstanceMove nodes_idx disk_moves ini_tbl em)
440
                 compareTables step_tbl $
441
                 checkInstanceMove nodes_idx disk_moves ini_tbl em)
443 442
            ini_tbl victims
444 443
        Table _ _ _ best_plc = best_tbl
445
    in
446
      if length best_plc == length ini_plc then -- no advancement
447
          ini_tbl
448
      else
449
          best_tbl
444
    in if length best_plc == length ini_plc
445
       then ini_tbl -- no advancement
446
       else best_tbl
450 447

  
451 448
-- | Check if we are allowed to go deeper in the balancing
452 449

  
......
467 464
tryBalance ini_tbl disk_moves =
468 465
    let Table ini_nl ini_il ini_cv _ = ini_tbl
469 466
        all_inst = Container.elems ini_il
467
        reloc_inst = filter (\e -> Instance.sNode e /= Node.noSecondary)
468
                     all_inst
470 469
        node_idx = map Node.idx . filter (not . Node.offline) $
471 470
                   Container.elems ini_nl
472
        fin_tbl = checkMove node_idx disk_moves ini_tbl all_inst
471
        fin_tbl = checkMove node_idx disk_moves ini_tbl reloc_inst
473 472
        (Table _ _ fin_cv _) = fin_tbl
474 473
    in
475 474
      if fin_cv < ini_cv

Also available in: Unified diff