Skip to content

Commit f1eb758

Browse files
authored
Merge pull request #2080 from kshtsk/wip-downburst-defaults
Update downburst defaults
2 parents f9841c0 + afdb81e commit f1eb758

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed

teuthology/orchestra/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def reconnect(self, timeout=30, socket_timeout=None):
408408
self.ssh.close()
409409
if not timeout:
410410
return self._reconnect(timeout=socket_timeout)
411-
action = "reconnect to {self.shortname}"
411+
action = f"reconnect to {self.shortname}"
412412
with safe_while(action=action, timeout=timeout, increment=3, _raise=False) as proceed:
413413
success = False
414414
while proceed():

teuthology/provision/downburst.py

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -311,43 +311,54 @@ def __del__(self):
311311
self.remove_config()
312312

313313

314+
_known_downburst_distros = {
315+
'rhel_minimal': ['6.4', '6.5'],
316+
'centos': ['9.stream', '10.stream'],
317+
'centos_minimal': ['6.4', '6.5'],
318+
'debian': ['6.0', '7.0', '7.9', '8.0'],
319+
'fedora': ['41', '42'],
320+
'opensuse': ['1.0(tumbleweed)',
321+
'15.5(leap)', '15.6(leap)',
322+
'16.0(leap)',
323+
],
324+
'sles': ['12-sp3', '15-sp1', '15-sp2'],
325+
'alma': ['10.0', '8.10', '9.6'],
326+
'rocky': ['10.0', '8.10', '9.6'],
327+
'ubuntu': ['20.04(focal)', '20.10(groovy)',
328+
'21.04(hirsute)', '21.10(impish)',
329+
'22.04(jammy)', '22.10(kinetic)',
330+
'23.04(lunar)', '23.10(mantic)',
331+
'24.04(noble)', '24.10(oracular)',
332+
'25.04(plucky)',
333+
],
334+
}
335+
314336
def get_distro_from_downburst():
315337
"""
316338
Return a table of valid distros.
317339
318340
If downburst is in path use it. If either downburst is unavailable,
319341
or if downburst is unable to produce a json list, then use a default
320-
table.
342+
table or a table from previous successful call.
321343
"""
322-
default_table = {'rhel_minimal': ['6.4', '6.5'],
323-
'fedora': ['17', '18', '19', '20', '22'],
324-
'centos': ['6.3', '6.4', '6.5', '7.0',
325-
'7.2', '7.4', '8.2'],
326-
'centos_minimal': ['6.4', '6.5'],
327-
'ubuntu': ['8.04(hardy)', '9.10(karmic)',
328-
'10.04(lucid)', '10.10(maverick)',
329-
'11.04(natty)', '11.10(oneiric)',
330-
'12.04(precise)', '12.10(quantal)',
331-
'13.04(raring)', '13.10(saucy)',
332-
'14.04(trusty)', 'utopic(utopic)',
333-
'16.04(xenial)', '18.04(bionic)',
334-
'20.04(focal)'],
335-
'sles': ['12-sp3', '15-sp1', '15-sp2'],
336-
'opensuse': ['12.3', '15.1', '15.2'],
337-
'debian': ['6.0', '7.0', '8.0']}
344+
# because sometimes downburst fails to complete list-json
345+
# due to temporary issues with vendor site accessibility
346+
# we cache known downburst distros from previous call
347+
# to be reused in such cases of outage
348+
global _known_downburst_distros
338349
executable_cmd = downburst_executable()
339350
environment_dict = downburst_environment()
340351
if not executable_cmd:
341352
log.warning("Downburst not found!")
342353
log.info('Using default values for supported os_type/os_version')
343-
return default_table
354+
return _known_downburst_distros
344355
try:
345356
log.debug(executable_cmd)
346357
output = subprocess.check_output([executable_cmd, 'list-json'],
347358
env=environment_dict)
348-
downburst_data = json.loads(output)
349-
return downburst_data
359+
_known_downburst_distros = json.loads(output)
360+
return _known_downburst_distros
350361
except (subprocess.CalledProcessError, OSError):
351362
log.exception("Error calling downburst!")
352-
log.info('Using default values for supported os_type/os_version')
353-
return default_table
363+
log.info('Using default values for supported os_type/os_version or values from previous call...')
364+
return _known_downburst_distros

teuthology/test/test_vps_os_vers_parameter_checking.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def fake_downburst_executable():
1717

1818
self.fake_downburst_executable = fake_downburst_executable
1919

20-
def test_ubuntu_precise(self):
20+
def test_ubuntu_noble(self):
2121
self.fake_ctx.os_type = 'ubuntu'
22-
self.fake_ctx.os_version = 'precise'
22+
self.fake_ctx.os_version = 'noble'
2323
with patch.multiple(
2424
provision.downburst,
2525
downburst_executable=self.fake_downburst_executable,
@@ -33,7 +33,7 @@ def test_ubuntu_precise(self):
3333

3434
def test_ubuntu_number(self):
3535
self.fake_ctx.os_type = 'ubuntu'
36-
self.fake_ctx.os_version = '12.04'
36+
self.fake_ctx.os_version = '24.04'
3737
with patch.multiple(
3838
provision.downburst,
3939
downburst_executable=self.fake_downburst_executable,
@@ -71,7 +71,7 @@ def test_bad_type(self):
7171
assert not check_value
7272

7373
def test_bad_version(self):
74-
self.fake_ctx.os_type = 'rhel'
74+
self.fake_ctx.os_type = 'ubuntu'
7575
self.fake_ctx.os_version = 'vampire_bat'
7676
with patch.multiple(
7777
provision.downburst,

0 commit comments

Comments
 (0)