mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Round capacity percentage to 1 decimal place
This commit is contained in:
parent
34a6355940
commit
97fe235561
2 changed files with 4 additions and 4 deletions
|
|
@ -186,7 +186,7 @@ module Vmpooler
|
|||
result[:status] = 0
|
||||
end
|
||||
|
||||
result[:capacity_percent] = (result[:capacity_current].to_f / result[:capacity_total].to_f) * 100.0
|
||||
result[:capacity_percent] = ((result[:capacity_current].to_f / result[:capacity_total].to_f) * 100.0).round(1)
|
||||
|
||||
result[:cloning] = $redis.get('vmpooler__tasks__clone')
|
||||
result[:booting] = result[:pending].to_i - result[:cloning].to_i
|
||||
|
|
@ -195,10 +195,10 @@ module Vmpooler
|
|||
|
||||
result[:clone_total] = $redis.hlen('vmpooler__clone__' + Date.today.to_s)
|
||||
if result[:clone_total] > 0
|
||||
result[:clone_average] = $redis.hvals('vmpooler__clone__' + Date.today.to_s).map(&:to_f).reduce(:+) / result[:clone_total]
|
||||
result[:clone_average] = ($redis.hvals('vmpooler__clone__' + Date.today.to_s).map(&:to_f).reduce(:+) / result[:clone_total]).round(1)
|
||||
end
|
||||
|
||||
result[:uptime] = Time.now - $config[:uptime] if $config[:uptime]
|
||||
result[:uptime] = (Time.now - $config[:uptime]).round(1) if $config[:uptime]
|
||||
|
||||
JSON.pretty_generate(Hash[result.sort_by { |k, _v| k }])
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue