Project

General

Profile

Actions

Bug #50880

closed

Supports specifying osd_id that is not exist and is not in destroyed.

Added by daolong zhang almost 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
% Done:

0%

Source:
Tags:
Backport:
pacific,octopus
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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


Related issues 2 (0 open2 closed)

Copied to ceph-volume - Backport #52597: octopus: Supports specifying osd_id that is not exist and is not in destroyed.ResolvedGuillaume AbriouxActions
Copied to ceph-volume - Backport #52598: pacific: Supports specifying osd_id that is not exist and is not in destroyed.ResolvedCory SnyderActions
Actions #1

Updated by Guillaume Abrioux over 2 years ago

  • Pull request ID changed from 41379 to 43109
Actions #2

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
Actions #3

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
Actions #4

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
Actions #5

Updated by Guillaume Abrioux over 2 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF