From ee9724b9443afa2c12b930501b900d9002008ab5 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 16 Oct 2009 15:40:31 +0200 Subject: [PATCH] Start using the utilisation scores in balancing This enables the per-node load/total available capacity scores to be used in balancing. Note that the total available capacity is currently fixed at zero and cannot be changed by the user. --- Ganeti/HTools/Cluster.hs | 14 +++++++++++++- Ganeti/HTools/Node.hs | 2 +- Ganeti/HTools/Types.hs | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs index 790615634..b5824c4e1 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 49d7b86c6..57d485996 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 81d482525..dd15fb608 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) -- GitLab