mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(DIO-608) vmpooler SUT handed out multiple times
Before this change if the smove returned false, we would continue handing out the VM which presumably could still be in the 'ready' state. Upon 'delete' that ready VM would not be picked up and return a 404 which is consistent with the behavior seen. Adding a metric to keep track of the smove failures since this is not expected. I think some API logging would be good to add in the future.
This commit is contained in:
parent
48b4fb9a6b
commit
9c6f50691d
1 changed files with 9 additions and 2 deletions
|
|
@ -83,8 +83,13 @@ module Vmpooler
|
|||
vms.reverse.each do |vm|
|
||||
ready = vm_ready?(vm, config['domain'])
|
||||
if ready
|
||||
backend.smove("vmpooler__ready__#{template_backend}", "vmpooler__running__#{template_backend}", vm)
|
||||
smoved = backend.smove("vmpooler__ready__#{template_backend}", "vmpooler__running__#{template_backend}", vm)
|
||||
if smoved
|
||||
return [vm, template_backend, template]
|
||||
else
|
||||
metrics.increment("checkout.smove.failed.#{template_backend}")
|
||||
return [nil, nil, nil]
|
||||
end
|
||||
else
|
||||
backend.smove("vmpooler__ready__#{template_backend}", "vmpooler__completed__#{template_backend}", vm)
|
||||
metrics.increment("checkout.nonresponsive.#{template_backend}")
|
||||
|
|
@ -874,6 +879,8 @@ module Vmpooler
|
|||
|
||||
status 200
|
||||
result['ok'] = true
|
||||
else
|
||||
metrics.increment('delete.srem.failed')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue