Actions
Bug #50880
closedSupports specifying osd_id that is not exist and is not in destroyed.
% Done:
0%
Source:
Tags:
Backport:
pacific,octopus
Regression:
No
Severity:
3 - minor
Reviewed:
Description
------------------------------------------------------------------------
def osd_id_available(osd_id):
"""
Checks to see if an osd ID exists and if it's available for
reuse. Returns True if it is, False if it isn't.
:param osd_id: The osd ID to check
"""
if osd_id is None:
return False
bootstrap_keyring = '/var/lib/ceph/bootstrap-osd/%s.keyring' % conf.cluster
stdout, stderr, returncode = process.call(
[
'ceph',
'--cluster', conf.cluster,
'--name', 'client.bootstrap-osd',
'--keyring', bootstrap_keyring,
'osd',
'tree',
'-f', 'json',
],
show_command=True
)
if returncode != 0:
raise RuntimeError('Unable check if OSD id exists: %s' % osd_id)
output = json.loads(''.join(stdout).strip())
osds = output['nodes']
osd = [osd for osd in osds if str(osd['id']) str(osd_id)]
if osd and osd[0].get('status') "destroyed":
return True
return False
----------------------------------------------------
The currently specified ID must be in a destroyed state.
As long as the ID does not exist in the cluster, it is okay
Updated by Guillaume Abrioux over 2 years ago
- Pull request ID changed from 41379 to 43109
Updated by Guillaume Abrioux over 2 years ago
- Status changed from New to Pending Backport
- Target version set to v17.0.0
- Backport set to pacific,octopus
Updated by Backport Bot over 2 years ago
- Copied to Backport #52597: octopus: Supports specifying osd_id that is not exist and is not in destroyed. added
Updated by Backport Bot over 2 years ago
- Copied to Backport #52598: pacific: Supports specifying osd_id that is not exist and is not in destroyed. added
Updated by Guillaume Abrioux over 2 years ago
- Status changed from Pending Backport to Resolved
Actions