hybrid_platforms_conductor 32.8.2 → 32.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +36 -16
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +16 -2
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +3 -21
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +40 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +68 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 378b6da76cab8e20f60c0517f7bbef90933b5d573069437ee16d913ca81c0689
|
4
|
+
data.tar.gz: 1924dd81e2740b50ee55758271282729d6df1fd6a45b555f96c321d1b40e54e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a72778375c154e42829a430bec151a7553b79874d1a878e129d80eed22b0f77f094751ee370c84441e7ed658d9e7b87e80c8f950ba64b491e1e62eec1f4a2f
|
7
|
+
data.tar.gz: e437a3f4871bde44d6bcbcd8a588dd83ff33c0374cee3769eada500a3acf04606e37144f98d2a49aaf69e0ff8cdd935d3eaa396fea5bb19ac485184df883db24
|
@@ -74,13 +74,13 @@ module HybridPlatformsConductor
|
|
74
74
|
# First check if we already have a test container that corresponds to this node and environment
|
75
75
|
@lxc_details = nil
|
76
76
|
with_proxmox do |proxmox|
|
77
|
-
proxmox
|
77
|
+
proxmox_get(proxmox, 'nodes').each do |node_info|
|
78
78
|
if proxmox_test_info[:test_config][:pve_nodes].include?(node_info['node']) && node_info['status'] == 'online'
|
79
|
-
proxmox
|
79
|
+
proxmox_get(proxmox, "nodes/#{node_info['node']}/lxc").each do |lxc_info|
|
80
80
|
vm_id = Integer(lxc_info['vmid'])
|
81
81
|
if vm_id.between?(*proxmox_test_info[:test_config][:vm_ids_range])
|
82
82
|
# Check if the description contains our ID
|
83
|
-
lxc_config = proxmox
|
83
|
+
lxc_config = proxmox_get(proxmox, "nodes/#{node_info['node']}/lxc/#{vm_id}/config")
|
84
84
|
vm_description_lines = (lxc_config['description'] || '').split("\n")
|
85
85
|
hpc_marker_idx = vm_description_lines.index('===== HPC info =====')
|
86
86
|
unless hpc_marker_idx.nil?
|
@@ -222,8 +222,8 @@ module HybridPlatformsConductor
|
|
222
222
|
with_proxmox do |proxmox|
|
223
223
|
vm_id_str = @lxc_details[:vm_id].to_s
|
224
224
|
status =
|
225
|
-
if proxmox
|
226
|
-
status_info = proxmox
|
225
|
+
if proxmox_get(proxmox, "nodes/#{@lxc_details[:pve_node]}/lxc").any? { |data_info| data_info['vmid'] == vm_id_str }
|
226
|
+
status_info = proxmox_get(proxmox, "nodes/#{@lxc_details[:pve_node]}/lxc/#{@lxc_details[:vm_id]}/status/current")
|
227
227
|
# Careful that it is possible that somebody destroyed the VM and so its status is missing
|
228
228
|
status = status_info.key?('status') ? status_info['status'].to_sym : :missing
|
229
229
|
status = :exited if status == :stopped
|
@@ -292,11 +292,27 @@ module HybridPlatformsConductor
|
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
295
|
-
#
|
296
|
-
|
297
|
-
|
298
|
-
#
|
299
|
-
|
295
|
+
# Perform a get operation on the API
|
296
|
+
# Protect the get API methods with a retry mechanism in case of 5xx errors.
|
297
|
+
#
|
298
|
+
# Parameters::
|
299
|
+
# * *proxmox* (Proxmox): The Proxmox instance
|
300
|
+
# * *path* (String): Path to get
|
301
|
+
# Result::
|
302
|
+
# * Object: API response
|
303
|
+
def proxmox_get(proxmox, path)
|
304
|
+
response = nil
|
305
|
+
idx_try = 0
|
306
|
+
loop do
|
307
|
+
response = proxmox.get(path)
|
308
|
+
break if !(response.is_a?(String)) || !(response =~ /^NOK: error code = 5\d\d$/)
|
309
|
+
log_warn "[ #{@node}/#{@environment} ] - Proxmox API call get #{path} returned error #{response} (attempt ##{idx_try}/#{proxmox_test_info[:api_max_retries]})"
|
310
|
+
raise "[ #{@node}/#{@environment} ] - Proxmox API call get #{path} returns #{response} continuously (tried #{idx_try + 1} times)" if idx_try >= proxmox_test_info[:api_max_retries]
|
311
|
+
idx_try += 1
|
312
|
+
sleep proxmox_test_info[:api_wait_between_retries_secs] + rand(5)
|
313
|
+
end
|
314
|
+
response
|
315
|
+
end
|
300
316
|
|
301
317
|
# Run a Proxmox task.
|
302
318
|
# Handle a retry mechanism in case of 5xx errors.
|
@@ -313,11 +329,11 @@ module HybridPlatformsConductor
|
|
313
329
|
while task.nil? do
|
314
330
|
task = proxmox.send(http_method, "nodes/#{pve_node}/#{sub_path}", *args)
|
315
331
|
if task =~ /^NOK: error code = 5\d\d$/
|
316
|
-
log_warn "[ #{@node}/#{@environment} ] - Proxmox API call #{http_method} nodes/#{pve_node}/#{sub_path} #{args} returned error #{task} (attempt ##{idx_try}/#{
|
332
|
+
log_warn "[ #{@node}/#{@environment} ] - Proxmox API call #{http_method} nodes/#{pve_node}/#{sub_path} #{args} returned error #{task} (attempt ##{idx_try}/#{proxmox_test_info[:api_max_retries]})"
|
317
333
|
task = nil
|
334
|
+
break if idx_try >= proxmox_test_info[:api_max_retries]
|
318
335
|
idx_try += 1
|
319
|
-
|
320
|
-
sleep RETRY_WAIT_TIME_SECS + rand(5)
|
336
|
+
sleep proxmox_test_info[:api_wait_between_retries_secs] + rand(5)
|
321
337
|
end
|
322
338
|
end
|
323
339
|
if task.nil?
|
@@ -358,7 +374,7 @@ module HybridPlatformsConductor
|
|
358
374
|
# Result::
|
359
375
|
# * String: The task status
|
360
376
|
def task_status(proxmox, pve_node, task)
|
361
|
-
status_info = proxmox
|
377
|
+
status_info = proxmox_get(proxmox, "nodes/#{pve_node}/tasks/#{task}/status")
|
362
378
|
"#{status_info['status']}#{status_info['exitstatus'] ? ":#{status_info['exitstatus']}" : ''}"
|
363
379
|
end
|
364
380
|
|
@@ -377,7 +393,9 @@ module HybridPlatformsConductor
|
|
377
393
|
(proxmox_test_info[:test_config].merge(
|
378
394
|
proxmox_api_url: proxmox_test_info[:api_url],
|
379
395
|
futex_file: '/tmp/hpc_proxmox_allocations.futex',
|
380
|
-
logs_dir: '/tmp/hpc_proxmox_waiter_logs'
|
396
|
+
logs_dir: '/tmp/hpc_proxmox_waiter_logs',
|
397
|
+
api_max_retries: proxmox_test_info[:api_max_retries],
|
398
|
+
api_wait_between_retries_secs: proxmox_test_info[:api_wait_between_retries_secs]
|
381
399
|
)).to_json
|
382
400
|
)
|
383
401
|
result = nil
|
@@ -486,7 +504,7 @@ module HybridPlatformsConductor
|
|
486
504
|
# So remaining length is 255 - 13 = 242 characters.
|
487
505
|
MAX_FILE_ID_SIZE = 242
|
488
506
|
|
489
|
-
# Get an ID unique for
|
507
|
+
# Get an ID unique for this node/environment and that can be used in file names.
|
490
508
|
#
|
491
509
|
# Result::
|
492
510
|
# * String: ID
|
@@ -506,6 +524,8 @@ module HybridPlatformsConductor
|
|
506
524
|
# Result::
|
507
525
|
# * Hash<Symbol,Object>: Configuration of the Proxmox instance to be used:
|
508
526
|
# * *api_url* (String): The Proxmox API URL
|
527
|
+
# * *api_max_retries* (Integer): Max number of API retries
|
528
|
+
# * *api_wait_between_retries_secs* (Integer): Number of seconds to wait between API retries
|
509
529
|
# * *sync_node* (String): Node to be used to synchronize Proxmox resources acquisition
|
510
530
|
# * *test_config* (Hash<Symbol,Object>): The test configuration. Check ProxmoxWaiter#initialize (config_file structure) method to get details.
|
511
531
|
# * *vm_config* (Hash<Symbol,Object>): Extra configuration of a created container. Check #request_lxc_creation_for results to get details.
|
@@ -26,6 +26,8 @@ class ProxmoxWaiter
|
|
26
26
|
# * *proxmox_api_url* (String): Proxmox API URL.
|
27
27
|
# * *futex_file* (String): Path to the file serving as a futex.
|
28
28
|
# * *logs_dir* (String): Path to the directory containing logs [default: '.']
|
29
|
+
# * *api_max_retries* (Integer): Max number of API retries
|
30
|
+
# * *api_wait_between_retries_secs* (Integer): Number of seconds to wait between API retries
|
29
31
|
# * *pve_nodes* (Array<String>): List of PVE nodes allowed to spawn new containers [default: all]
|
30
32
|
# * *vm_ips_list* (Array<String>): The list of IPs that are available for the Proxomx containers.
|
31
33
|
# * *vm_ids_range* ([Integer, Integer]): Minimum and maximum reservable VM ID
|
@@ -637,11 +639,23 @@ class ProxmoxWaiter
|
|
637
639
|
|
638
640
|
# Get a path from the API it returns its JSON result.
|
639
641
|
# Keep a cache of it, whose lifespan is this ProxmoxWaiter instance.
|
642
|
+
# Have a retry mechanism to make sure eventual non-deterministic 5xx errors are not an issue.
|
640
643
|
#
|
641
644
|
# Parameters::
|
642
645
|
# * *path* (String): API path to query
|
643
|
-
|
644
|
-
|
646
|
+
# Result::
|
647
|
+
# * Object: The API response
|
648
|
+
def api_get(path, nbr_retries: 3, wait_between_retry_secs: 10)
|
649
|
+
unless @gets_cache.key?(path)
|
650
|
+
idx_try = 0
|
651
|
+
loop do
|
652
|
+
@gets_cache[path] = @proxmox.get(path)
|
653
|
+
break unless @gets_cache[path].is_a?(String) && @gets_cache[path] =~ /^NOK: error code = 5\d\d$/
|
654
|
+
raise "Proxmox API get #{path} returns #{@gets_cache[path]} continuously (tried #{idx_try + 1} times)" if idx_try >= @config['api_max_retries']
|
655
|
+
idx_try += 1
|
656
|
+
sleep @config['api_wait_between_retries_secs']
|
657
|
+
end
|
658
|
+
end
|
645
659
|
@gets_cache[path]
|
646
660
|
end
|
647
661
|
|
@@ -28,6 +28,26 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
it 'retries a few times before ending in error for a 5xx API error' do
|
32
|
+
with_sync_node do
|
33
|
+
mock_proxmox(mocked_pve_nodes: [{ 'pve_node_name' => { error_strings: ['NOK: error code = 500'] * 5 } }])
|
34
|
+
result = call_reserve_proxmox_container(2, 1024, 4, config: { api_max_retries: 4 })
|
35
|
+
expect(result[:error]).not_to eq nil
|
36
|
+
expect(result[:error]).to match /Unhandled exception from reserve_proxmox_container: Proxmox API get nodes\/pve_node_name\/lxc returns NOK: error code = 500 continuously \(tried 5 times\)/
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'retries API errors a few times until it gets resolved' do
|
41
|
+
with_sync_node do
|
42
|
+
mock_proxmox(mocked_pve_nodes: [{ 'pve_node_name' => { error_strings: ['NOK: error code = 500'] * 3 } }])
|
43
|
+
expect(call_reserve_proxmox_container(2, 1024, 4, config: { api_max_retries: 4 })).to eq(
|
44
|
+
pve_node: 'pve_node_name',
|
45
|
+
vm_id: 1000,
|
46
|
+
vm_ip: '192.168.0.100'
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
31
51
|
end
|
32
52
|
|
33
53
|
end
|
@@ -39,16 +39,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
39
39
|
mock_proxmox_to_start_node(nbr_api_errors: 3)
|
40
40
|
]
|
41
41
|
instance.create
|
42
|
-
|
43
|
-
old_wait_secs = HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_get(:RETRY_WAIT_TIME_SECS)
|
44
|
-
begin
|
45
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
46
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, 1)
|
47
|
-
instance.start
|
48
|
-
ensure
|
49
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
50
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, old_wait_secs)
|
51
|
-
end
|
42
|
+
instance.start
|
52
43
|
end
|
53
44
|
end
|
54
45
|
|
@@ -58,19 +49,10 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
58
49
|
# 1 - The info on existing containers
|
59
50
|
mock_proxmox_to_get_nodes_info,
|
60
51
|
# 2 - The start of the container - fail too many times
|
61
|
-
mock_proxmox_to_start_node(nbr_api_errors:
|
52
|
+
mock_proxmox_to_start_node(nbr_api_errors: 4, task_status: nil)
|
62
53
|
]
|
63
54
|
instance.create
|
64
|
-
|
65
|
-
old_wait_secs = HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_get(:RETRY_WAIT_TIME_SECS)
|
66
|
-
begin
|
67
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
68
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, 1)
|
69
|
-
expect { instance.start }.to raise_error '[ node/test ] - Proxmox API call post nodes/pve_node_name/lxc/1024/status/start [] is constantly failing. Giving up.'
|
70
|
-
ensure
|
71
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
72
|
-
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, old_wait_secs)
|
73
|
-
end
|
55
|
+
expect { instance.start }.to raise_error '[ node/test ] - Proxmox API call post nodes/pve_node_name/lxc/1024/status/start [] is constantly failing. Giving up.'
|
74
56
|
end
|
75
57
|
end
|
76
58
|
|
@@ -23,6 +23,46 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
|
27
|
+
it '' do
|
28
|
+
with_test_proxmox_platform do |instance|
|
29
|
+
mock_proxmox_calls_with [
|
30
|
+
# 1 - The info on existing containers
|
31
|
+
mock_proxmox_to_get_nodes_info,
|
32
|
+
# 2 - The start of the container - fail a few times
|
33
|
+
mock_proxmox_to_start_node(nbr_api_errors: 2)
|
34
|
+
]
|
35
|
+
instance.create
|
36
|
+
instance.start
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'retries calls to the API when getting back errors 5xx' do
|
41
|
+
with_test_proxmox_platform do |instance|
|
42
|
+
mock_proxmox_calls_with [
|
43
|
+
# 1 - The info on existing containers
|
44
|
+
mock_proxmox_to_get_nodes_info,
|
45
|
+
# 2 - The status of the container
|
46
|
+
mock_proxmox_to_status_node(nbr_api_errors: 3)
|
47
|
+
]
|
48
|
+
instance.create
|
49
|
+
expect(instance.state).to eq :created
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'fails to get an instance\'s status when the Proxmox API fails too many times' do
|
54
|
+
with_test_proxmox_platform do |instance|
|
55
|
+
mock_proxmox_calls_with [
|
56
|
+
# 1 - The info on existing containers
|
57
|
+
mock_proxmox_to_get_nodes_info,
|
58
|
+
# 2 - The status of the container
|
59
|
+
mock_proxmox_to_status_node(nbr_api_errors: 4, status: nil)
|
60
|
+
]
|
61
|
+
instance.create
|
62
|
+
expect { instance.state }.to raise_error '[ node/test ] - Proxmox API call get nodes/pve_node_name/lxc returns NOK: error code = 500 continuously (tried 4 times)'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
26
66
|
end
|
27
67
|
|
28
68
|
end
|
@@ -23,6 +23,8 @@ module HybridPlatformsConductorTest
|
|
23
23
|
test_platform path: '#{repository}'
|
24
24
|
proxmox(
|
25
25
|
api_url: 'https://my-proxmox.my-domain.com:8006',
|
26
|
+
api_max_retries: 3,
|
27
|
+
api_wait_between_retries_secs: 0,
|
26
28
|
sync_node: 'node',
|
27
29
|
test_config: {
|
28
30
|
pve_nodes: ['pve_node_name'],
|
@@ -75,12 +77,20 @@ module HybridPlatformsConductorTest
|
|
75
77
|
# * *proxmox_password* (String or nil): Proxmox password used to connect to Proxmox API [default: nil]
|
76
78
|
# * *proxmox_realm* (String or nil): Proxmox realm used to connect to Proxmox API [default: 'pam']
|
77
79
|
# * *nodes_info* (Array<Hash>): Nodes info returned by the Proxmox API [default: []]
|
80
|
+
# * *nbr_api_errors* (Integer): Number of API errors 500 to mock before getting a successful query [defaults: 0]
|
78
81
|
# * *extra_expects* (Proc or nil): Code called for additional expectations on the proxmox instance, or nil if none [default: nil]
|
79
82
|
# * Parameters::
|
80
83
|
# * *proxmox* (Double): The mocked Proxmox instance
|
81
84
|
# Result::
|
82
85
|
# * Proc: Code called in place of Proxmox.new. Signature is the same as Proxmox.new.
|
83
|
-
def mock_proxmox_to_get_nodes_info(
|
86
|
+
def mock_proxmox_to_get_nodes_info(
|
87
|
+
proxmox_user: nil,
|
88
|
+
proxmox_password: nil,
|
89
|
+
proxmox_realm: 'pam',
|
90
|
+
nodes_info: [],
|
91
|
+
nbr_api_errors: 0,
|
92
|
+
extra_expects: nil
|
93
|
+
)
|
84
94
|
proc do |url, pve_node, user, password, realm, options|
|
85
95
|
expect(url).to eq 'https://my-proxmox.my-domain.com:8006/api2/json/'
|
86
96
|
expect(pve_node).to eq 'my-proxmox'
|
@@ -97,8 +107,10 @@ module HybridPlatformsConductorTest
|
|
97
107
|
# Nothing
|
98
108
|
end
|
99
109
|
# Mock checking existing nodes
|
100
|
-
|
101
|
-
|
110
|
+
idx_try = 0
|
111
|
+
expect(proxmox).to receive(:get).exactly(nbr_api_errors + 1).times.with('nodes') do
|
112
|
+
idx_try += 1
|
113
|
+
idx_try <= nbr_api_errors ? 'NOK: error code = 500' : nodes_info
|
102
114
|
end
|
103
115
|
extra_expects.call(proxmox) unless extra_expects.nil?
|
104
116
|
proxmox
|
@@ -243,13 +255,15 @@ module HybridPlatformsConductorTest
|
|
243
255
|
# Parameters::
|
244
256
|
# * *proxmox_user* (String or nil): Proxmox user used to connect to Proxmox API [default: nil]
|
245
257
|
# * *proxmox_password* (String or nil): Proxmox password used to connect to Proxmox API [default: nil]
|
246
|
-
# * *status* (String): Mocked status [default: 'created']
|
258
|
+
# * *status* (String or nil): Mocked status, or nil if it should not be asked [default: 'created']
|
259
|
+
# * *nbr_api_errors* (Integer): Number of API errors 500 to mock before getting a successful query [defaults: 0]
|
247
260
|
# Result::
|
248
261
|
# * Proc: Code called in place of Proxmox.new. Signature is the same as Proxmox.new.
|
249
262
|
def mock_proxmox_to_status_node(
|
250
263
|
proxmox_user: nil,
|
251
264
|
proxmox_password: nil,
|
252
|
-
|
265
|
+
status: 'created',
|
266
|
+
nbr_api_errors: 0
|
253
267
|
)
|
254
268
|
proc do |url, pve_node, user, password, realm, options|
|
255
269
|
expect(url).to eq 'https://my-proxmox.my-domain.com:8006/api2/json/'
|
@@ -267,17 +281,25 @@ module HybridPlatformsConductorTest
|
|
267
281
|
# Nothing
|
268
282
|
end
|
269
283
|
# Mock getting status of a container
|
270
|
-
|
271
|
-
|
284
|
+
idx_try = 0
|
285
|
+
expect(proxmox).to receive(:get).exactly(nbr_api_errors + (status.nil? ? 0 : 1)).times.with('nodes/pve_node_name/lxc') do
|
286
|
+
idx_try += 1
|
287
|
+
if idx_try <= nbr_api_errors
|
288
|
+
'NOK: error code = 500'
|
289
|
+
else
|
290
|
+
[
|
291
|
+
{
|
292
|
+
'vmid' => '1024'
|
293
|
+
}
|
294
|
+
]
|
295
|
+
end
|
296
|
+
end
|
297
|
+
unless status.nil?
|
298
|
+
expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1024/status/current') do
|
272
299
|
{
|
273
|
-
'
|
300
|
+
'status' => status
|
274
301
|
}
|
275
|
-
|
276
|
-
end
|
277
|
-
expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1024/status/current') do
|
278
|
-
{
|
279
|
-
'status' => 'created'
|
280
|
-
}
|
302
|
+
end
|
281
303
|
end
|
282
304
|
proxmox
|
283
305
|
end
|
@@ -548,13 +570,17 @@ module HybridPlatformsConductorTest
|
|
548
570
|
]
|
549
571
|
when /^nodes\/([^\/]+)\/lxc$/
|
550
572
|
pve_node_name = $1
|
551
|
-
pve_nodes[pve_node_name][:
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
573
|
+
if pve_nodes[pve_node_name][:error_strings].nil? || pve_nodes[pve_node_name][:error_strings].empty?
|
574
|
+
pve_nodes[pve_node_name][:lxc_containers].map do |vm_id, vm_info|
|
575
|
+
{
|
576
|
+
'vmid' => vm_id.to_s,
|
577
|
+
'maxdisk' => vm_info[:maxdisk],
|
578
|
+
'maxmem' => vm_info[:maxmem],
|
579
|
+
'cpus' => vm_info[:cpus]
|
580
|
+
}
|
581
|
+
end
|
582
|
+
else
|
583
|
+
pve_nodes[pve_node_name][:error_strings].shift
|
558
584
|
end
|
559
585
|
when /^nodes\/([^\/]+)\/lxc\/([^\/]+)\/config$/
|
560
586
|
pve_node_name = $1
|
@@ -642,14 +668,26 @@ module HybridPlatformsConductorTest
|
|
642
668
|
# * *wait_before_retry* (Integer): Specify the number of seconds to wait before retry [default: 0]
|
643
669
|
# * *create* (Hash or nil): Create file content, or nil if none [default: nil]
|
644
670
|
# * *destroy* (Hash or nil): Destroy file content, or nil if none [default: nil]
|
671
|
+
# * *api_max_retries* (Integer): Max number of API retries [default: 3]
|
672
|
+
# * *api_wait_between_retries_secs* (Integer): Number of seconds to wait between API retries [default: 0]
|
645
673
|
# Result::
|
646
674
|
# * Hash: JSON result of the call
|
647
|
-
def call_reserve_proxmox_container_with(
|
675
|
+
def call_reserve_proxmox_container_with(
|
676
|
+
config: {},
|
677
|
+
max_retries: 1,
|
678
|
+
wait_before_retry: 0,
|
679
|
+
create: nil,
|
680
|
+
destroy: nil,
|
681
|
+
api_max_retries: 3,
|
682
|
+
api_wait_between_retries_secs: 0
|
683
|
+
)
|
648
684
|
# Make sure we set default values in the config
|
649
685
|
config = {
|
650
686
|
proxmox_api_url: 'https://my-proxmox.my-domain.com:8006',
|
651
687
|
futex_file: "#{@repository}/proxmox/allocations.futex",
|
652
688
|
logs_dir: "#{Dir.tmpdir}/hpc_test_proxmox_waiter_logs",
|
689
|
+
api_max_retries: api_max_retries,
|
690
|
+
api_wait_between_retries_secs: api_wait_between_retries_secs,
|
653
691
|
pve_nodes: ['pve_node_name'],
|
654
692
|
vm_ips_list: %w[
|
655
693
|
192.168.0.100
|
@@ -716,7 +754,14 @@ module HybridPlatformsConductorTest
|
|
716
754
|
# * *wait_before_retry* (Integer): Specify the number of seconds to wait before retry [default: 0]
|
717
755
|
# Result::
|
718
756
|
# * Hash: JSON result of the call
|
719
|
-
def call_reserve_proxmox_container(
|
757
|
+
def call_reserve_proxmox_container(
|
758
|
+
cpus,
|
759
|
+
ram_mb,
|
760
|
+
disk_gb,
|
761
|
+
config: {},
|
762
|
+
max_retries: 1,
|
763
|
+
wait_before_retry: 0
|
764
|
+
)
|
720
765
|
call_reserve_proxmox_container_with(
|
721
766
|
config: config,
|
722
767
|
max_retries: max_retries,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hybrid_platforms_conductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 32.
|
4
|
+
version: 32.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muriel Salvan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: range_operators
|