(POOLER-129) Allow setting weights for backends

This commit updates get_vm in the vmpooler API to allow for setting weights for backends. Additionally, when an alias for a pool exists, and the backend configured is not weighted, then the selection of the pool based on alias will be randomly sampled. Without this change any pool with the title of the alias is exhausted before an alternate pool with the configured alias is used, which results in an uneven distribution of VMs. When all backends involved are configured with weighted values the VM selection will be based on probability using those weights.

A bug is fixed when setting the default ttl for check_ready_vm.

Pickup is added to handle weighted VM selection.

A dockerfile is added that allows for building and installing vmpooler
from the current HEAD in docker to make for easy testing.
This commit is contained in:
kirby@puppetlabs.com 2018-09-11 11:14:51 -07:00
parent 0e86937245
commit cd73f53561
6 changed files with 69 additions and 26 deletions

View file

@ -1,15 +1,16 @@
module Vmpooler
require 'date'
require 'json'
require 'open-uri'
require 'net/ldap'
require 'open-uri'
require 'pickup'
require 'rbvmomi'
require 'redis'
require 'set'
require 'sinatra/base'
require 'time'
require 'timeout'
require 'yaml'
require 'set'
%w[api graphite logger pool_manager statsd dummy_statsd generic_connection_pool].each do |lib|
require "vmpooler/#{lib}"