On Mon, Oct 05, 2015 at 09:54:08AM +0200, 'Oleg Ponomarev' via ganeti-devel 
wrote:
> After this changenegative value of fMem and fMemForth becomes a usual

s/changen/change, n/

> practice. A negative value means that memory over-commitment takes
> place. On each operation on the node we check that over-commitment

s/node/node,

> ratio doesn't exceed the memory-ratio ipolicy.
> 
> Signed-off-by: Oleg Ponomarev <[email protected]>
> ---
>  src/Ganeti/HTools/Node.hs | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/src/Ganeti/HTools/Node.hs b/src/Ganeti/HTools/Node.hs
> index 477f15b..6bc1cd5 100644
> --- a/src/Ganeti/HTools/Node.hs
> +++ b/src/Ganeti/HTools/Node.hs
> @@ -458,6 +458,17 @@ setPolicy pol node =
>  computeMaxRes :: P.PeerMap -> P.Elem
>  computeMaxRes = P.maxElem
>  
> +-- | Calculates the lower acceptable amount of free memory. It's a negative
> +-- value, thanks to memory over-commitment
> +
> +fMemTresholdHelper :: Double -> Double -> Int -> Int
> +fMemTresholdHelper ratio tmem nmem =
> +  truncate $ -(ratio - 1) * (tmem - fromIntegral nmem)

as this fMemTresholdHelper is only used to define fMemThreshold, please
inline there. Also -(ratio -1) can be replaced by (1 - ratio).

> +
> +fMemTreshold :: Node -> Int
> +fMemTreshold t =
> +  fMemTresholdHelper (T.iPolicyMemoryRatio $ iPolicy t) (tMem t) (nMem t)
> +

> @@ -882,6 +893,7 @@ addPriEx force t inst =
>        new_load_forth = utilLoadForth t `T.addUtil` Instance.util inst
>        new_plist_forth = iname:pListForth t
>  
> +

Why add a newline here?

>        updateForthcomingFields n =
>          n { pTags = addTags old_tags inst_tags
>  

Rest looks good

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to