Revision 9bb5721c htools/Ganeti/HTools/Cluster.hs

b/htools/Ganeti/HTools/Cluster.hs
52 52
    , doNextBalance
53 53
    , tryBalance
54 54
    , compCV
55
    , compCVNodes
55 56
    , compDetailedCV
56 57
    , printStats
57 58
    , iMoveToJob
......
283 284
detailedCVWeights = map fst detailedCVInfo
284 285

  
285 286
-- | Compute the mem and disk covariance.
286
compDetailedCV :: Node.List -> [Double]
287
compDetailedCV nl =
287
compDetailedCV :: [Node.Node] -> [Double]
288
compDetailedCV all_nodes =
288 289
    let
289
        all_nodes = Container.elems nl
290 290
        (offline, nodes) = partition Node.offline all_nodes
291 291
        mem_l = map Node.pMem nodes
292 292
        dsk_l = map Node.pDsk nodes
......
328 328
       , pri_tags_score ]
329 329

  
330 330
-- | Compute the /total/ variance.
331
compCVNodes :: [Node.Node] -> Double
332
compCVNodes = sum . zipWith (*) detailedCVWeights . compDetailedCV
333

  
334
-- | Wrapper over 'compCVNodes' for callers that have a 'Node.List'.
331 335
compCV :: Node.List -> Double
332
compCV = sum . zipWith (*) detailedCVWeights . compDetailedCV
336
compCV = compCVNodes . Container.elems
337

  
333 338

  
334 339
-- | Compute online nodes from a 'Node.List'.
335 340
getOnline :: Node.List -> [Node.Node]
......
1164 1169
-- | Shows statistics for a given node list.
1165 1170
printStats :: Node.List -> String
1166 1171
printStats nl =
1167
    let dcvs = compDetailedCV nl
1172
    let dcvs = compDetailedCV $ Container.elems nl
1168 1173
        (weights, names) = unzip detailedCVInfo
1169 1174
        hd = zip3 (weights ++ repeat 1) (names ++ repeat "unknown") dcvs
1170 1175
        formatted = map (\(w, header, val) ->

Also available in: Unified diff