mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #75 from sschneid/query_destroyed_vms
Use 'checkout' time to calculate 'running' time
This commit is contained in:
commit
34fd054a48
1 changed files with 6 additions and 1 deletions
|
|
@ -453,7 +453,12 @@ module Vmpooler
|
||||||
|
|
||||||
result[params[:hostname]]['template'] = rdata['template']
|
result[params[:hostname]]['template'] = rdata['template']
|
||||||
result[params[:hostname]]['lifetime'] = rdata['lifetime'] || $config[:config]['vm_lifetime']
|
result[params[:hostname]]['lifetime'] = rdata['lifetime'] || $config[:config]['vm_lifetime']
|
||||||
result[params[:hostname]]['running'] = ((Time.now - Time.parse($redis.hget('vmpooler__active__' + result[params[:hostname]]['template'], params[:hostname]))) / 60 / 60).round(2)
|
|
||||||
|
if rdata['destroy']
|
||||||
|
result[params[:hostname]]['running'] = ((Time.parse(rdata['destroy']) - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
|
||||||
|
else
|
||||||
|
result[params[:hostname]]['running'] = ((Time.now - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
|
||||||
|
end
|
||||||
|
|
||||||
rdata.keys.each do |key|
|
rdata.keys.each do |key|
|
||||||
if key.match('^tag\:(.+?)$')
|
if key.match('^tag\:(.+?)$')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue