diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs index 79061563436d5e6f19840c5620fa95fcc82ccae6..b5824c4e1b5e8b17a390e87f1ce8d2c7c86e69a2 100644 --- a/Ganeti/HTools/Cluster.hs +++ b/Ganeti/HTools/Cluster.hs @@ -198,6 +198,10 @@ detailedCVNames = [ "free_mem_cv" , "reserved_mem_cv" , "offline_score" , "vcpu_ratio_cv" + , "cpu_load_cv" + , "mem_load_cv" + , "disk_load_cv" + , "net_load_cv" ] -- | Compute the mem and disk covariance. @@ -225,7 +229,15 @@ compDetailedCV nl = fromIntegral (offline_inst + online_inst)::Double cpu_l = map Node.pCpu nodes cpu_cv = varianceCoeff cpu_l - in [mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv] + (c_load, m_load, d_load, n_load) = unzip4 $ + map (\n -> + let DynUtil c1 m1 d1 n1 = Node.utilLoad n + DynUtil c2 m2 d2 n2 = Node.utilPool n + in (c1/c2, m1/m2, d1/d2, n1/n2) + ) nodes + in [ mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv + , varianceCoeff c_load, varianceCoeff m_load + , varianceCoeff d_load, varianceCoeff n_load] -- | Compute the /total/ variance. compCV :: Node.List -> Double diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index 49d7b86c6b5ee23e673e0ec99598be4ede5f6be1..57d485996230ea71cd02baf03cb7976d067343d2 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -158,7 +158,7 @@ create name_init mem_t_init mem_n_init mem_f_init , mCpu = noLimit , loDsk = noLimitInt , hiCpu = noLimitInt - , utilPool = T.zeroUtil + , utilPool = T.baseUtil , utilLoad = T.zeroUtil } diff --git a/Ganeti/HTools/Types.hs b/Ganeti/HTools/Types.hs index 81d482525403e16ac84c61ac118fc8d358f5e520..dd15fb60867435093e87f700da59f23f55676585 100644 --- a/Ganeti/HTools/Types.hs +++ b/Ganeti/HTools/Types.hs @@ -31,6 +31,7 @@ module Ganeti.HTools.Types , Weight , DynUtil(..) , zeroUtil + , baseUtil , addUtil , subUtil , Placement @@ -75,6 +76,10 @@ zeroUtil :: DynUtil zeroUtil = DynUtil { cpuWeight = 0, memWeight = 0 , dskWeight = 0, netWeight = 0 } +baseUtil :: DynUtil +baseUtil = DynUtil { cpuWeight = 1, memWeight = 1 + , dskWeight = 1, netWeight = 1 } + addUtil :: DynUtil -> DynUtil -> DynUtil addUtil (DynUtil a1 a2 a3 a4) (DynUtil b1 b2 b3 b4) = DynUtil (a1+b1) (a2+b2) (a3+b3) (a4+b4)