vmpooler 0.14.5 → 0.14.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a00a8643a9f748b6e4969c1704d609f43ea2e6fbcf733f75d80b9710f2e0887
4
- data.tar.gz: 679f9ec5fda317ee478c7e23c39a81d95efd5f0ae961f7d071b94f7ef5977af2
3
+ metadata.gz: 1dcbff566ca53b6dd3ec05d98b1210b83552e7389a9a9943a20f81984839b8ac
4
+ data.tar.gz: 9a3bdcd8323fcc806c532e610f8a0a28246c84ad98c46744a48c069222169faa
5
5
  SHA512:
6
- metadata.gz: acc4f1a92edf4c6b4ee86bc337429ec23dc173ab74405986e82bdd096054aca3f372c8552fa2dda020f29281b9ec4627c02e4be7367a7a6ab124414b0c90273a
7
- data.tar.gz: 20021a38a843d2b4e82c46ad4206119692023a42e67f207d688402ac140fe8496cc27be157575bb2d785cf2cc28af0d4368654d73f7f2575af789075b7dbc3e7
6
+ metadata.gz: 00adf48793ad92e95bd9400cecd2993b18c60617c5a272d402009e905654e85b9ec2cef361dbb80f0bfc7978180299bb6b06392c87df48739a66a03c2c26639d
7
+ data.tar.gz: 5f1970fe7d1a74e8430908531cf0e9d67845054250b9d681fdbe43752d393779f1976160f4d479628441aeaf60085acb3cfaafd52476301eb255f52de586c98b
@@ -9,6 +9,7 @@ redis_port = config[:redis]['port']
9
9
  redis_password = config[:redis]['password']
10
10
  redis_connection_pool_size = config[:redis]['connection_pool_size']
11
11
  redis_connection_pool_timeout = config[:redis]['connection_pool_timeout']
12
+ redis_reconnect_attempts = config[:redis]['reconnect_attempts']
12
13
  logger_file = config[:config]['logfile']
13
14
 
14
15
  logger = Vmpooler::Logger.new logger_file
@@ -43,7 +44,7 @@ if torun.include? :manager
43
44
  Vmpooler::PoolManager.new(
44
45
  config,
45
46
  logger,
46
- Vmpooler.redis_connection_pool(redis_host, redis_port, redis_password, redis_connection_pool_size, redis_connection_pool_timeout, metrics),
47
+ Vmpooler.redis_connection_pool(redis_host, redis_port, redis_password, redis_connection_pool_size, redis_connection_pool_timeout, metrics, redis_reconnect_attempts),
47
48
  metrics
48
49
  ).execute!
49
50
  end
@@ -58,59 +58,58 @@ module Vmpooler
58
58
  end
59
59
 
60
60
  # Set some configuration defaults
61
- parsed_config[:config]['task_limit'] = string_to_int(ENV['TASK_LIMIT']) || parsed_config[:config]['task_limit'] || 10
62
- parsed_config[:config]['ondemand_clone_limit'] = string_to_int(ENV['ONDEMAND_CLONE_LIMIT']) || parsed_config[:config]['ondemand_clone_limit'] || 10
61
+ parsed_config[:config]['task_limit'] = string_to_int(ENV['TASK_LIMIT']) || parsed_config[:config]['task_limit'] || 10
62
+ parsed_config[:config]['ondemand_clone_limit'] = string_to_int(ENV['ONDEMAND_CLONE_LIMIT']) || parsed_config[:config]['ondemand_clone_limit'] || 10
63
63
  parsed_config[:config]['max_ondemand_instances_per_request'] = string_to_int(ENV['MAX_ONDEMAND_INSTANCES_PER_REQUEST']) || parsed_config[:config]['max_ondemand_instances_per_request'] || 10
64
- parsed_config[:config]['migration_limit'] = string_to_int(ENV['MIGRATION_LIMIT']) if ENV['MIGRATION_LIMIT']
65
- parsed_config[:config]['vm_checktime'] = string_to_int(ENV['VM_CHECKTIME']) || parsed_config[:config]['vm_checktime'] || 1
66
- parsed_config[:config]['vm_lifetime'] = string_to_int(ENV['VM_LIFETIME']) || parsed_config[:config]['vm_lifetime'] || 24
67
- parsed_config[:config]['max_lifetime_upper_limit'] = string_to_int(ENV['MAX_LIFETIME_UPPER_LIMIT']) || parsed_config[:config]['max_lifetime_upper_limit']
68
- parsed_config[:config]['ready_ttl'] = string_to_int(ENV['READY_TTL']) || parsed_config[:config]['ready_ttl'] || 60
69
- parsed_config[:config]['ondemand_request_ttl'] = string_to_int(ENV['ONDEMAND_REQUEST_TTL']) || parsed_config[:config]['ondemand_request_ttl'] || 5
70
- parsed_config[:config]['prefix'] = ENV['PREFIX'] || parsed_config[:config]['prefix'] || ''
71
-
72
- parsed_config[:config]['logfile'] = ENV['LOGFILE'] if ENV['LOGFILE']
73
-
74
- parsed_config[:config]['site_name'] = ENV['SITE_NAME'] if ENV['SITE_NAME']
75
- parsed_config[:config]['domain'] = ENV['DOMAIN'] if ENV['DOMAIN']
76
- parsed_config[:config]['clone_target'] = ENV['CLONE_TARGET'] if ENV['CLONE_TARGET']
77
- parsed_config[:config]['timeout'] = string_to_int(ENV['TIMEOUT']) if ENV['TIMEOUT']
78
- parsed_config[:config]['vm_lifetime_auth'] = string_to_int(ENV['VM_LIFETIME_AUTH']) if ENV['VM_LIFETIME_AUTH']
79
- parsed_config[:config]['max_tries'] = string_to_int(ENV['MAX_TRIES']) if ENV['MAX_TRIES']
80
- parsed_config[:config]['retry_factor'] = string_to_int(ENV['RETRY_FACTOR']) if ENV['RETRY_FACTOR']
81
- parsed_config[:config]['create_folders'] = true?(ENV['CREATE_FOLDERS']) if ENV['CREATE_FOLDERS']
82
- parsed_config[:config]['create_template_delta_disks'] = ENV['CREATE_TEMPLATE_DELTA_DISKS'] if ENV['CREATE_TEMPLATE_DELTA_DISKS']
64
+ parsed_config[:config]['migration_limit'] = string_to_int(ENV['MIGRATION_LIMIT']) if ENV['MIGRATION_LIMIT']
65
+ parsed_config[:config]['vm_checktime'] = string_to_int(ENV['VM_CHECKTIME']) || parsed_config[:config]['vm_checktime'] || 1
66
+ parsed_config[:config]['vm_lifetime'] = string_to_int(ENV['VM_LIFETIME']) || parsed_config[:config]['vm_lifetime'] || 24
67
+ parsed_config[:config]['max_lifetime_upper_limit'] = string_to_int(ENV['MAX_LIFETIME_UPPER_LIMIT']) || parsed_config[:config]['max_lifetime_upper_limit']
68
+ parsed_config[:config]['ready_ttl'] = string_to_int(ENV['READY_TTL']) || parsed_config[:config]['ready_ttl'] || 60
69
+ parsed_config[:config]['ondemand_request_ttl'] = string_to_int(ENV['ONDEMAND_REQUEST_TTL']) || parsed_config[:config]['ondemand_request_ttl'] || 5
70
+ parsed_config[:config]['prefix'] = ENV['PREFIX'] || parsed_config[:config]['prefix'] || ''
71
+ parsed_config[:config]['logfile'] = ENV['LOGFILE'] if ENV['LOGFILE']
72
+ parsed_config[:config]['site_name'] = ENV['SITE_NAME'] if ENV['SITE_NAME']
73
+ parsed_config[:config]['domain'] = ENV['DOMAIN'] if ENV['DOMAIN']
74
+ parsed_config[:config]['clone_target'] = ENV['CLONE_TARGET'] if ENV['CLONE_TARGET']
75
+ parsed_config[:config]['timeout'] = string_to_int(ENV['TIMEOUT']) if ENV['TIMEOUT']
76
+ parsed_config[:config]['vm_lifetime_auth'] = string_to_int(ENV['VM_LIFETIME_AUTH']) if ENV['VM_LIFETIME_AUTH']
77
+ parsed_config[:config]['max_tries'] = string_to_int(ENV['MAX_TRIES']) if ENV['MAX_TRIES']
78
+ parsed_config[:config]['retry_factor'] = string_to_int(ENV['RETRY_FACTOR']) if ENV['RETRY_FACTOR']
79
+ parsed_config[:config]['create_folders'] = true?(ENV['CREATE_FOLDERS']) if ENV['CREATE_FOLDERS']
80
+ parsed_config[:config]['experimental_features'] = ENV['EXPERIMENTAL_FEATURES'] if ENV['EXPERIMENTAL_FEATURES']
81
+ parsed_config[:config]['purge_unconfigured_folders'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] if ENV['PURGE_UNCONFIGURED_FOLDERS']
82
+ parsed_config[:config]['usage_stats'] = ENV['USAGE_STATS'] if ENV['USAGE_STATS']
83
+ parsed_config[:config]['request_logger'] = ENV['REQUEST_LOGGER'] if ENV['REQUEST_LOGGER']
84
+ parsed_config[:config]['create_template_delta_disks'] = ENV['CREATE_TEMPLATE_DELTA_DISKS'] if ENV['CREATE_TEMPLATE_DELTA_DISKS']
83
85
  set_linked_clone(parsed_config)
84
- parsed_config[:config]['experimental_features'] = ENV['EXPERIMENTAL_FEATURES'] if ENV['EXPERIMENTAL_FEATURES']
85
- parsed_config[:config]['purge_unconfigured_folders'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] if ENV['PURGE_UNCONFIGURED_FOLDERS']
86
- parsed_config[:config]['usage_stats'] = ENV['USAGE_STATS'] if ENV['USAGE_STATS']
87
- parsed_config[:config]['request_logger'] = ENV['REQUEST_LOGGER'] if ENV['REQUEST_LOGGER']
88
-
89
- parsed_config[:redis] = parsed_config[:redis] || {}
90
- parsed_config[:redis]['server'] = ENV['REDIS_SERVER'] || parsed_config[:redis]['server'] || 'localhost'
91
- parsed_config[:redis]['port'] = string_to_int(ENV['REDIS_PORT']) if ENV['REDIS_PORT']
92
- parsed_config[:redis]['password'] = ENV['REDIS_PASSWORD'] if ENV['REDIS_PASSWORD']
93
- parsed_config[:redis]['data_ttl'] = string_to_int(ENV['REDIS_DATA_TTL']) || parsed_config[:redis]['data_ttl'] || 168
94
- parsed_config[:redis]['connection_pool_size'] = string_to_int(ENV['REDIS_CONNECTION_POOL_SIZE']) || parsed_config[:redis]['connection_pool_size'] || 10
86
+
87
+ parsed_config[:redis] = parsed_config[:redis] || {}
88
+ parsed_config[:redis]['server'] = ENV['REDIS_SERVER'] || parsed_config[:redis]['server'] || 'localhost'
89
+ parsed_config[:redis]['port'] = string_to_int(ENV['REDIS_PORT']) if ENV['REDIS_PORT']
90
+ parsed_config[:redis]['password'] = ENV['REDIS_PASSWORD'] if ENV['REDIS_PASSWORD']
91
+ parsed_config[:redis]['data_ttl'] = string_to_int(ENV['REDIS_DATA_TTL']) || parsed_config[:redis]['data_ttl'] || 168
92
+ parsed_config[:redis]['connection_pool_size'] = string_to_int(ENV['REDIS_CONNECTION_POOL_SIZE']) || parsed_config[:redis]['connection_pool_size'] || 10
95
93
  parsed_config[:redis]['connection_pool_timeout'] = string_to_int(ENV['REDIS_CONNECTION_POOL_TIMEOUT']) || parsed_config[:redis]['connection_pool_timeout'] || 5
94
+ parsed_config[:redis]['reconnect_attempts'] = string_to_int(ENV['REDIS_RECONNECT_ATTEMPTS']) || parsed_config[:redis]['reconnect_attempts'] || 10
96
95
 
97
- parsed_config[:statsd] = parsed_config[:statsd] || {} if ENV['STATSD_SERVER']
96
+ parsed_config[:statsd] = parsed_config[:statsd] || {} if ENV['STATSD_SERVER']
98
97
  parsed_config[:statsd]['server'] = ENV['STATSD_SERVER'] if ENV['STATSD_SERVER']
99
98
  parsed_config[:statsd]['prefix'] = ENV['STATSD_PREFIX'] if ENV['STATSD_PREFIX']
100
- parsed_config[:statsd]['port'] = string_to_int(ENV['STATSD_PORT']) if ENV['STATSD_PORT']
99
+ parsed_config[:statsd]['port'] = string_to_int(ENV['STATSD_PORT']) if ENV['STATSD_PORT']
101
100
 
102
- parsed_config[:graphite] = parsed_config[:graphite] || {} if ENV['GRAPHITE_SERVER']
101
+ parsed_config[:graphite] = parsed_config[:graphite] || {} if ENV['GRAPHITE_SERVER']
103
102
  parsed_config[:graphite]['server'] = ENV['GRAPHITE_SERVER'] if ENV['GRAPHITE_SERVER']
104
103
  parsed_config[:graphite]['prefix'] = ENV['GRAPHITE_PREFIX'] if ENV['GRAPHITE_PREFIX']
105
- parsed_config[:graphite]['port'] = string_to_int(ENV['GRAPHITE_PORT']) if ENV['GRAPHITE_PORT']
104
+ parsed_config[:graphite]['port'] = string_to_int(ENV['GRAPHITE_PORT']) if ENV['GRAPHITE_PORT']
106
105
 
107
106
  parsed_config[:auth] = parsed_config[:auth] || {} if ENV['AUTH_PROVIDER']
108
107
  if parsed_config.key? :auth
109
- parsed_config[:auth]['provider'] = ENV['AUTH_PROVIDER'] if ENV['AUTH_PROVIDER']
110
- parsed_config[:auth][:ldap] = parsed_config[:auth][:ldap] || {} if parsed_config[:auth]['provider'] == 'ldap'
111
- parsed_config[:auth][:ldap]['host'] = ENV['LDAP_HOST'] if ENV['LDAP_HOST']
112
- parsed_config[:auth][:ldap]['port'] = string_to_int(ENV['LDAP_PORT']) if ENV['LDAP_PORT']
113
- parsed_config[:auth][:ldap]['base'] = ENV['LDAP_BASE'] if ENV['LDAP_BASE']
108
+ parsed_config[:auth]['provider'] = ENV['AUTH_PROVIDER'] if ENV['AUTH_PROVIDER']
109
+ parsed_config[:auth][:ldap] = parsed_config[:auth][:ldap] || {} if parsed_config[:auth]['provider'] == 'ldap'
110
+ parsed_config[:auth][:ldap]['host'] = ENV['LDAP_HOST'] if ENV['LDAP_HOST']
111
+ parsed_config[:auth][:ldap]['port'] = string_to_int(ENV['LDAP_PORT']) if ENV['LDAP_PORT']
112
+ parsed_config[:auth][:ldap]['base'] = ENV['LDAP_BASE'] if ENV['LDAP_BASE']
114
113
  parsed_config[:auth][:ldap]['user_object'] = ENV['LDAP_USER_OBJECT'] if ENV['LDAP_USER_OBJECT']
115
114
  end
116
115
 
@@ -164,7 +163,7 @@ module Vmpooler
164
163
  pools
165
164
  end
166
165
 
167
- def self.redis_connection_pool(host, port, password, size, timeout, metrics)
166
+ def self.redis_connection_pool(host, port, password, size, timeout, metrics, redis_reconnect_attempts = 0)
168
167
  Vmpooler::PoolManager::GenericConnectionPool.new(
169
168
  metrics: metrics,
170
169
  connpool_type: 'redis_connection_pool',
@@ -173,13 +172,14 @@ module Vmpooler
173
172
  timeout: timeout
174
173
  ) do
175
174
  connection = Concurrent::Hash.new
176
- redis = new_redis(host, port, password)
175
+ redis = new_redis(host, port, password, redis_reconnect_attempts)
177
176
  connection['connection'] = redis
178
177
  end
179
178
  end
180
179
 
181
- def self.new_redis(host = 'localhost', port = nil, password = nil)
182
- Redis.new(host: host, port: port, password: password)
180
+ def self.new_redis(host = 'localhost', port = nil, password = nil, redis_reconnect_attempts = 10)
181
+ Redis.new(host: host, port: port, password: password, reconnect_attempts: redis_reconnect_attempts, reconnect_delay: 1.5,
182
+ reconnect_delay_max: 10.0)
183
183
  end
184
184
 
185
185
  def self.pools(conf)
@@ -21,6 +21,7 @@ module Vmpooler
21
21
  REDIS_CONNECT_BUCKETS = [1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 18.0, 23.0].freeze
22
22
 
23
23
  @p_metrics = {}
24
+ @torun = []
24
25
 
25
26
  def initialize(logger, params = {})
26
27
  @prefix = params['prefix'] || 'vmpooler'
@@ -368,6 +369,7 @@ module Vmpooler
368
369
  # Top level method to register all the prometheus metrics.
369
370
 
370
371
  def setup_prometheus_metrics(torun)
372
+ @torun = torun
371
373
  @p_metrics = vmpooler_metrics_table
372
374
  @p_metrics.each do |name, metric_spec|
373
375
  # Only register metrics appropriate to api or manager
@@ -399,7 +401,10 @@ module Vmpooler
399
401
  metric_key = sublabels.shift.to_sym
400
402
  raise("Invalid Metric #{metric_key} for #{label}") unless @p_metrics.key? metric_key
401
403
 
402
- metric = @p_metrics[metric_key].clone
404
+ metric_spec = @p_metrics[metric_key]
405
+ raise("Invalid Component #{component} for #{metric_key}") if (metric_spec[:torun] & @torun).nil?
406
+
407
+ metric = metric_spec.clone
403
408
 
404
409
  if metric.key? :metric_suffixes
405
410
  metric_subkey = sublabels.shift.to_sym
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vmpooler
4
- VERSION = '0.14.5'
4
+ VERSION = '0.14.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmpooler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-21 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pickup
@@ -84,16 +84,22 @@ dependencies:
84
84
  name: rbvmomi
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '2.1'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '4.0'
90
93
  type: :runtime
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - "~>"
97
+ - - ">="
95
98
  - !ruby/object:Gem::Version
96
99
  version: '2.1'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '4.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: sinatra
99
105
  requirement: !ruby/object:Gem::Requirement