-fixNodes =
- foldl' (\accu (idx, inst) ->
- let
- pdx = Instance.pnode inst
- sdx = Instance.snode inst
- pold = fromJust $ lookup pdx accu
- pnew = Node.setPri pold idx
- pnew' = Node.addCpus pnew (Instance.vcpus inst)
- ac1 = deleteBy assocEqual (pdx, pold) accu
- ac2 = (pdx, pnew'):ac1
- in
- if sdx /= Node.noSecondary then
- let
- sold = fromJust $ lookup sdx accu
- snew = Node.setSec sold idx
- ac3 = deleteBy assocEqual (sdx, sold) ac2
- ac4 = (sdx, snew):ac3
- in ac4
- else
- ac2
- )
+fixNodes accu (idx, inst) =
+ let
+ pdx = Instance.pnode inst
+ sdx = Instance.snode inst
+ pold = fromJust $ lookup pdx accu
+ pnew = Node.setPri pold idx
+ pnew' = Node.addCpus pnew (Instance.vcpus inst)
+ ac1 = deleteBy assocEqual (pdx, pold) accu
+ ac2 = (pdx, pnew'):ac1
+ in
+ if sdx /= Node.noSecondary
+ then let sold = fromJust $ lookup sdx accu
+ snew = Node.setSec sold idx
+ ac3 = deleteBy assocEqual (sdx, sold) ac2
+ in (sdx, snew):ac3
+ else ac2