diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index cbc2117a4f1d3dcdc7e696ba8eb6c9be8281758a..1156ee2b586128bc52a8ff9a954c4fa3abb267cd 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -101,7 +101,11 @@ setXmem t val = t { x_mem = val } -- | Sets the free memory setFmem :: Node -> Int -> Node -setFmem t val = t { f_mem = val } +setFmem t new_mem = + let new_n1 = computeFailN1 (r_mem t) new_mem (f_dsk t) + new_mp = (fromIntegral new_mem) / (t_mem t) + in + t { f_mem = new_mem, failN1 = new_n1, p_mem = new_mp } -- | Given the rmem, free memory and disk, computes the failn1 status. computeFailN1 :: Int -> Int -> Int -> Bool