Revision e4d31268

b/Ganeti/HTools/Cluster.hs
179 179
                  , "free_disk_cv"
180 180
                  , "n1_score"
181 181
                  , "reserved_mem_cv"
182
                  , "offline_score"
182
                  , "offline_all_cnt"
183 183
                  , "vcpu_ratio_cv"
184 184
                  , "cpu_load_cv"
185 185
                  , "mem_load_cv"
......
207 207
        res_l = map Node.pRem nodes
208 208
        -- metric: reserved memory covariance
209 209
        res_cv = varianceCoeff res_l
210
        offline_inst = sum . map (\n -> (length . Node.pList $ n) +
211
                                        (length . Node.sList $ n)) $ offline
212
        online_inst = sum . map (\n -> (length . Node.pList $ n) +
213
                                       (length . Node.sList $ n)) $ nodes
214
        -- metric: ratio of instances on offline nodes
215
        off_score = if offline_inst == 0
216
                    then 0::Double
217
                    else fromIntegral offline_inst /
218
                         fromIntegral (offline_inst + online_inst)::Double
210
        -- offline instances metrics
211
        offline_ipri = sum . map (length . Node.pList) $ offline
212
        offline_isec = sum . map (length . Node.sList) $ offline
213
        -- metric: count of instances on offline nodes
214
        off_score = fromIntegral (offline_ipri + offline_isec)::Double
219 215
        cpu_l = map Node.pCpu nodes
220 216
        -- metric: covariance of vcpu/pcpu ratio
221 217
        cpu_cv = varianceCoeff cpu_l

Also available in: Unified diff