mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Display VM state in GET /vm/:hostname route
This commit is contained in:
parent
f3979de5ef
commit
64bbd7c973
2 changed files with 8 additions and 1 deletions
|
|
@ -211,7 +211,8 @@ $ curl --url vmpooler.company.com/vm/pxpmtoonx7fiqg6
|
|||
"pxpmtoonx7fiqg6": {
|
||||
"template": "centos-6-x86_64",
|
||||
"lifetime": 12,
|
||||
"running": 3,
|
||||
"running": 3.1,
|
||||
"state": "running",
|
||||
"domain": "company.com"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -426,8 +426,14 @@ module Vmpooler
|
|||
|
||||
if rdata['destroy']
|
||||
result[params[:hostname]]['running'] = ((Time.parse(rdata['destroy']) - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
|
||||
result[params[:hostname]]['state'] = 'destroyed'
|
||||
elsif rdata['checkout']
|
||||
result[params[:hostname]]['running'] = ((Time.now - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
|
||||
result[params[:hostname]]['state'] = 'running'
|
||||
elsif rdata['check']
|
||||
result[params[:hostname]]['state'] = 'ready'
|
||||
else
|
||||
result[params[:hostname]]['state'] = 'pending'
|
||||
end
|
||||
|
||||
rdata.keys.each do |key|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue