mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(POOLER-139) Fix discovering checked out VM
This commit updates how vmpooler retrieves VMs to add a VM to the running queue as soon as it is checked out. Without this change it is possible that a VM can be discovered when it is checked out before it is added to the running queue if multiple systems are requested. Additionally, the dockerfile is updated to support specifying the version of vmpooler to install.
This commit is contained in:
parent
5e4ba2bc7e
commit
3e26a8f998
3 changed files with 19 additions and 10 deletions
|
|
@ -10,7 +10,12 @@ The format is based on
|
||||||
Tracking in this Changelog began for this project with the tagging of version 0.1.0.
|
Tracking in this Changelog began for this project with the tagging of version 0.1.0.
|
||||||
If you're looking for changes from before this, refer to the project's
|
If you're looking for changes from before this, refer to the project's
|
||||||
git logs & PR history.
|
git logs & PR history.
|
||||||
# [Unreleased](https://github.com/puppetlabs/vmpooler/compare/0.4.0...master)
|
# [Unreleased](https://github.com/puppetlabs/vmpooler/compare/0.5.0...master)
|
||||||
|
|
||||||
|
# [0.5.0](https://github.com/puppetlabs/vmpooler/compare/0.4.0...0.5.0)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Eliminate window for checked out VM to be discovered (POOLER-139)
|
||||||
|
|
||||||
# [0.4.0](https://github.com/puppetlabs/vmpooler/compare/0.3.0...0.4.0)
|
# [0.4.0](https://github.com/puppetlabs/vmpooler/compare/0.3.0...0.4.0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
FROM jruby:9.2-jdk
|
FROM jruby:9.2-jdk
|
||||||
|
|
||||||
|
ARG vmpooler_version=0.5.0
|
||||||
|
|
||||||
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
ENV LOGFILE=/dev/stdout \
|
ENV LOGFILE=/dev/stdout \
|
||||||
RACK_ENV=production
|
RACK_ENV=production
|
||||||
|
|
||||||
RUN gem install vmpooler && \
|
RUN gem install vmpooler -v ${vmpooler_version} && \
|
||||||
chmod +x /usr/local/bin/docker-entrypoint.sh
|
chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -67,22 +67,24 @@ module Vmpooler
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
template_backends.each do |t|
|
template_backends.each do |template_backend|
|
||||||
vm = backend.spop('vmpooler__ready__' + t)
|
vm = backend.spop("vmpooler__ready__#{template_backend}")
|
||||||
return [vm, t, template] if vm
|
if vm
|
||||||
|
backend.sadd("vmpooler__running__#{template_backend}", vm)
|
||||||
|
return [vm, template_backend, template]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
[nil, nil, nil]
|
[nil, nil, nil]
|
||||||
end
|
end
|
||||||
|
|
||||||
def return_vm_to_ready_state(template, vm)
|
def return_vm_to_ready_state(template, vm)
|
||||||
backend.sadd('vmpooler__ready__' + template, vm)
|
backend.smove("vmpooler__running__#{template}", "vmpooler__ready__#{template}", vm)
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_for_starting_vm(template, vm)
|
def account_for_starting_vm(template, vm)
|
||||||
backend.sadd('vmpooler__running__' + template, vm)
|
backend.sadd("vmpooler__migrating__#{template}", vm)
|
||||||
backend.sadd('vmpooler__migrating__' + template, vm)
|
backend.hset("vmpooler__active__#{template}", vm, Time.now)
|
||||||
backend.hset('vmpooler__active__' + template, vm, Time.now)
|
backend.hset("vmpooler__vm__#{vm}", 'checkout', Time.now)
|
||||||
backend.hset('vmpooler__vm__' + vm, 'checkout', Time.now)
|
|
||||||
|
|
||||||
if Vmpooler::API.settings.config[:auth] and has_token?
|
if Vmpooler::API.settings.config[:auth] and has_token?
|
||||||
validate_token(backend)
|
validate_token(backend)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue