Commit fe3d6f02 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add an availDisk node function

This function returns the amount of available disk, which depends on
whether a low disk limit has been configured or not and on the free disk
space of the node.
parent 836533fa
......@@ -52,6 +52,8 @@ module Ganeti.HTools.Node
, removeSec
, addPri
, addSec
-- * Stats
, availDisk
-- * Formatting
, list
-- * Misc stuff
......@@ -339,6 +341,20 @@ addSec t inst pdx =
r_mem = new_rmem, p_dsk = new_dp,
p_rem = new_prem}
-- * Stats functions
-- | Computes the amount of available disk on a given node
availDisk :: Node -> Int
availDisk t =
let _f = f_dsk t
_l = lo_dsk t
in
if _l == noLimitInt
then _f
else if _f < _l
then 0
else _f - _l
-- * Display functions
-- | String converter for the node list functionality.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment