diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index 67c421b2f01a62d0b6d4ac654faa9335a75b4ffc..34210ccd19c711af8cec3bcf2f8e43ba79931e74 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -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.