Revision e2436511 Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
187 187
-- | Compute the delta between two cluster state.
188 188
--
189 189
-- This is used when doing allocations, to understand better the
190
-- available cluster resources.
190
-- available cluster resources. The return value is a triple of the
191
-- current used values, the delta that was still allocated, and what
192
-- was left unallocated.
191 193
computeAllocationDelta :: CStats -> CStats -> AllocStats
192 194
computeAllocationDelta cini cfin =
193 195
    let CStats {csImem = i_imem, csIdsk = i_idsk, csIcpu = i_icpu} = cini
194 196
        CStats {csImem = f_imem, csIdsk = f_idsk, csIcpu = f_icpu,
195 197
                csTmem = t_mem, csTdsk = t_dsk, csVcpu = v_cpu } = cfin
196 198
        rini = RSpec i_icpu i_imem i_idsk
197
        rfin = RSpec f_icpu f_imem f_idsk
199
        rfin = RSpec (f_icpu - i_icpu) (f_imem - i_imem) (f_idsk - i_idsk)
198 200
        un_cpu = if v_cpu == Node.noLimitInt
199 201
                 then Node.noLimitInt
200 202
                 else v_cpu - f_icpu

Also available in: Unified diff