Revision 94a420ed

b/src/Ganeti/HTools/Cluster.hs
46 46
  , printSolutionLine
47 47
  , formatCmds
48 48
  , involvedNodes
49
  , getMoves
49 50
  , splitJobs
50 51
  -- * Display functions
51 52
  , printNodes
......
1412 1413
      inst = Container.find i il
1413 1414
  in nub . filter (>= 0) $ [np, ns] ++ Instance.allNodes inst
1414 1415

  
1416
-- | From two adjacent cluster tables get the list of moves that transitions
1417
-- from to the other
1418
getMoves :: (Table, Table) -> [MoveJob]
1419
getMoves (Table _ initial_il _ initial_plc, Table final_nl _ _ final_plc) =
1420
  let
1421
    plctoMoves (plc@(idx, p, s, mv, _)) =
1422
      let inst = Container.find idx initial_il
1423
          inst_name = Instance.name inst
1424
          affected = involvedNodes initial_il plc
1425
          np = Node.alias $ Container.find p final_nl
1426
          ns = Node.alias $ Container.find s final_nl
1427
          (_, cmds) = computeMoves inst inst_name mv np ns
1428
      in (affected, idx, mv, cmds)
1429
  in map plctoMoves . reverse . drop (length initial_plc) $ reverse final_plc
1430
             
1415 1431
-- | Inner function for splitJobs, that either appends the next job to
1416 1432
-- the current jobset, or starts a new jobset.
1417 1433
mergeJobs :: ([JobSet], [Ndx]) -> MoveJob -> ([JobSet], [Ndx])

Also available in: Unified diff