mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 10:28:41 -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)
|
# [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)
|
# [0.2.1](https://github.com/puppetlabs/vmpooler/compare/0.2.0...0.2.1)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,9 @@ module Vmpooler
|
||||||
|
|
||||||
template_backends.each do |t|
|
template_backends.each do |t|
|
||||||
vm = backend.spop('vmpooler__ready__' + t)
|
vm = backend.spop('vmpooler__ready__' + t)
|
||||||
return [vm, t] if vm
|
return [vm, t, template] if vm
|
||||||
end
|
end
|
||||||
[nil, nil]
|
[nil, nil, nil]
|
||||||
end
|
end
|
||||||
|
|
||||||
def return_vm_to_ready_state(template, vm)
|
def return_vm_to_ready_state(template, vm)
|
||||||
|
|
@ -113,27 +113,27 @@ module Vmpooler
|
||||||
|
|
||||||
payload.each do |requested, count|
|
payload.each do |requested, count|
|
||||||
count.to_i.times do |_i|
|
count.to_i.times do |_i|
|
||||||
vm, name = fetch_single_vm(requested)
|
vmname, vmpool, vmtemplate = fetch_single_vm(requested)
|
||||||
if !vm
|
if !vmname
|
||||||
failed = true
|
failed = true
|
||||||
metrics.increment('checkout.empty.' + requested)
|
metrics.increment('checkout.empty.' + requested)
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
vms << [ name, vm ]
|
vms << [ vmpool, vmname, vmtemplate ]
|
||||||
metrics.increment('checkout.success.' + name)
|
metrics.increment('checkout.success.' + vmtemplate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if failed
|
if failed
|
||||||
vms.each do |(name, vm)|
|
vms.each do |(vmpool, vmname, vmtemplate)|
|
||||||
return_vm_to_ready_state(name, vm)
|
return_vm_to_ready_state(vmpool, vmname)
|
||||||
end
|
end
|
||||||
status 503
|
status 503
|
||||||
else
|
else
|
||||||
vms.each do |(name, vm)|
|
vms.each do |(vmpool, vmname, vmtemplate)|
|
||||||
account_for_starting_vm(name, vm)
|
account_for_starting_vm(vmpool, vmname)
|
||||||
update_result_hosts(result, name, vm)
|
update_result_hosts(result, vmtemplate, vmname)
|
||||||
end
|
end
|
||||||
|
|
||||||
result['ok'] = true
|
result['ok'] = true
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ describe Vmpooler::API::V1 do
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
ok: true,
|
ok: true,
|
||||||
pool1: {
|
poolone: {
|
||||||
hostname: 'abcdefghijklmnop'
|
hostname: 'abcdefghijklmnop'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ describe Vmpooler::API::V1 do
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
ok: true,
|
ok: true,
|
||||||
pool1: {
|
poolone: {
|
||||||
hostname: 'abcdefghijklmnop'
|
hostname: 'abcdefghijklmnop'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue