mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #301 from mattkirby/checkout_platform
(POOLER-131) Return requested name when getting VMs
This commit is contained in:
commit
4d4ad063bb
4 changed files with 16 additions and 13 deletions
|
|
@ -13,6 +13,9 @@ git logs & PR history.
|
|||
|
||||
# [Unreleased](https://github.com/puppetlabs/vmpooler/compare/0.2.1...master)
|
||||
|
||||
### Fixed
|
||||
- Return label used to request VMs when fulfilling VM requests (POOLER-131)
|
||||
|
||||
# [0.2.1](https://github.com/puppetlabs/vmpooler/compare/0.2.0...0.2.1)
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ module Vmpooler
|
|||
|
||||
template_backends.each do |t|
|
||||
vm = backend.spop('vmpooler__ready__' + t)
|
||||
return [vm, t] if vm
|
||||
return [vm, t, template] if vm
|
||||
end
|
||||
[nil, nil]
|
||||
[nil, nil, nil]
|
||||
end
|
||||
|
||||
def return_vm_to_ready_state(template, vm)
|
||||
|
|
@ -113,27 +113,27 @@ module Vmpooler
|
|||
|
||||
payload.each do |requested, count|
|
||||
count.to_i.times do |_i|
|
||||
vm, name = fetch_single_vm(requested)
|
||||
if !vm
|
||||
vmname, vmpool, vmtemplate = fetch_single_vm(requested)
|
||||
if !vmname
|
||||
failed = true
|
||||
metrics.increment('checkout.empty.' + requested)
|
||||
break
|
||||
else
|
||||
vms << [ name, vm ]
|
||||
metrics.increment('checkout.success.' + name)
|
||||
vms << [ vmpool, vmname, vmtemplate ]
|
||||
metrics.increment('checkout.success.' + vmtemplate)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if failed
|
||||
vms.each do |(name, vm)|
|
||||
return_vm_to_ready_state(name, vm)
|
||||
vms.each do |(vmpool, vmname, vmtemplate)|
|
||||
return_vm_to_ready_state(vmpool, vmname)
|
||||
end
|
||||
status 503
|
||||
else
|
||||
vms.each do |(name, vm)|
|
||||
account_for_starting_vm(name, vm)
|
||||
update_result_hosts(result, name, vm)
|
||||
vms.each do |(vmpool, vmname, vmtemplate)|
|
||||
account_for_starting_vm(vmpool, vmname)
|
||||
update_result_hosts(result, vmtemplate, vmname)
|
||||
end
|
||||
|
||||
result['ok'] = true
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ describe Vmpooler::API::V1 do
|
|||
|
||||
expected = {
|
||||
ok: true,
|
||||
pool1: {
|
||||
poolone: {
|
||||
hostname: 'abcdefghijklmnop'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ describe Vmpooler::API::V1 do
|
|||
|
||||
expected = {
|
||||
ok: true,
|
||||
pool1: {
|
||||
poolone: {
|
||||
hostname: 'abcdefghijklmnop'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue