Fix hspace's KM metrics
authorIustin Pop <iustin@google.com>
Tue, 4 May 2010 11:42:39 +0000 (13:42 +0200)
committerIustin Pop <iustin@google.com>
Tue, 4 May 2010 11:42:39 +0000 (13:42 +0200)
We returned the KM_POOL_* metrics as the final state, not as the delta
between the final and the initial state.

Ganeti/HTools/Cluster.hs

index 694e997..1afc08c 100644 (file)
@@ -187,14 +187,16 @@ totalResources nl =
 -- | Compute the delta between two cluster state.
 --
 -- This is used when doing allocations, to understand better the
--- available cluster resources.
+-- available cluster resources. The return value is a triple of the
+-- current used values, the delta that was still allocated, and what
+-- was left unallocated.
 computeAllocationDelta :: CStats -> CStats -> AllocStats
 computeAllocationDelta cini cfin =
     let CStats {csImem = i_imem, csIdsk = i_idsk, csIcpu = i_icpu} = cini
         CStats {csImem = f_imem, csIdsk = f_idsk, csIcpu = f_icpu,
                 csTmem = t_mem, csTdsk = t_dsk, csVcpu = v_cpu } = cfin
         rini = RSpec i_icpu i_imem i_idsk
-        rfin = RSpec f_icpu f_imem f_idsk
+        rfin = RSpec (f_icpu - i_icpu) (f_imem - i_imem) (f_idsk - i_idsk)
         un_cpu = if v_cpu == Node.noLimitInt
                  then Node.noLimitInt
                  else v_cpu - f_icpu