mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(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:
parent
1f6f08d172
commit
811fd8b60f
34 changed files with 3326 additions and 1098 deletions
|
|
@ -7,6 +7,8 @@ config = Vmpooler.config
|
|||
redis_host = config[:redis]['server']
|
||||
redis_port = config[:redis]['port']
|
||||
redis_password = config[:redis]['password']
|
||||
redis_connection_pool_size = config[:redis]['connection_pool_size']
|
||||
redis_connection_pool_timeout = config[:redis]['connection_pool_timeout']
|
||||
logger_file = config[:config]['logfile']
|
||||
|
||||
metrics = Vmpooler.new_metrics(config)
|
||||
|
|
@ -36,7 +38,7 @@ if torun.include? 'manager'
|
|||
Vmpooler::PoolManager.new(
|
||||
config,
|
||||
Vmpooler.new_logger(logger_file),
|
||||
Vmpooler.new_redis(redis_host, redis_port, redis_password),
|
||||
Vmpooler.redis_connection_pool(redis_host, redis_port, redis_password, redis_connection_pool_size, redis_connection_pool_timeout, metrics),
|
||||
metrics
|
||||
).execute!
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue