diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs
index 92a1a02e4d67d612866d731dc6c24c6c1497d5b3..0abec278a22e8c7a796561e28a18466b8725b658 100644
--- a/Ganeti/HTools/Node.hs
+++ b/Ganeti/HTools/Node.hs
@@ -242,7 +242,11 @@ setMdsk t val = t { mDsk = val,
 
 -- | Sets the max cpu usage ratio
 setMcpu :: Node -> Double -> Node
-setMcpu t val = t { mCpu = val, hiCpu = floor (val * tCpu t) }
+setMcpu t val = t { mCpu = val, hiCpu = hcpu }
+    where new_hcpu = floor (val * tCpu t)::Int
+          hcpu = if new_hcpu < 0
+                 then noLimitInt
+                 else new_hcpu
 
 -- | Computes the maximum reserved memory for peers from a peer map.
 computeMaxRes :: P.PeerMap -> P.Elem