(POOLER-158) Add capability to provision VMs on demand

This change adds a capability to vmpooler to provision instances on
demand. Without this change vmpooler only supports retrieving machines
from pre-provisioned pools.

Additionally, this change refactors redis interactions to reduce round
trips to redis. Specifically, multi and pipelined redis commands are
added where possible to reduce the number of times we are calling redis.

To support the redis refactor the redis interaction has changed to
leveraging a connection pool. In addition to offering multiple
connections for pool manager to use, the redis interactions in pool
manager are now thread safe.

Ready TTL is now a global parameter that can be set as a default for all
pools. A default of 0 has been removed, because this is an unreasonable
default behavior, which would leave a provisioned instance in the pool
indefinitely.

Pool empty messages have been removed when the pool size is set to 0.
Without this change, when a pool was set to a size of 0 the API and pool
manager would both show that a pool is empty.
This commit is contained in:
kirby@puppetlabs.com 2020-04-06 10:52:05 -07:00
parent e9a79cb6db
commit 86e92de4cf
34 changed files with 3247 additions and 1099 deletions

View file

@ -195,14 +195,21 @@
#
# - data_ttl
# How long (in hours) to retain metadata in Redis after VM destruction.
# (optional; default: '168')
# (default: 168)
#
# - redis_connection_pool_size
# Maximum number of connections to utilize for the redis connection pool.
# (default: 10)
#
# - redis_connection_pool_timeout
# How long a task should wait (in seconds) for a redis connection when all connections are in use.
# (default: 5)
# Example:
:redis:
server: 'redis.example.com'
# :graphs:
#
# This section contains the server and prefix information for a graphite-
@ -368,15 +375,19 @@
#
# - task_limit
# The number of concurrent VM creation tasks to perform.
# (optional; default: '10')
# (default: 10)
#
# - ondemand_clone_limit
# The number of concurrent VM creation tasks to perform for ondemand VM requests.
# (default: 10)
#
# - timeout
# How long (in minutes) before marking a clone in 'pending' queues as 'failed' and retrying.
# (optional; default: '15')
# (default: 15)
#
# - vm_checktime
# How often (in minutes) to check the sanity of VMs in 'ready' queues.
# (optional; default: '1')
# (default: 1)
#
# - vm_lifetime
# How long (in hours) to keep VMs in 'running' queues before destroying.
@ -510,10 +521,21 @@
# Expects a string value
# (optional)
#
# - max_ondemand_instances_per_request
# The maximum number of instances any individual ondemand request may contain per pool.
# (default: 10)
#
# - ondemand_request_ttl
# The amount of time (in minutes) to give for a ondemand request to be fulfilled before considering it to have failed.
# (default: 5)
#
# - ready_ttl
# How long (in minutes) a ready VM should stay in the ready queue.
# (default: 60)
#
# Example:
:config:
site_name: 'vmpooler'
:config: site_name: 'vmpooler'
logfile: '/var/log/vmpooler.log'
task_limit: 10
timeout: 15