Project

General

Profile

Actions

Bug #24936

closed

ceph-volume: check_id function do the wrong job

Added by 伟杰 谭 almost 6 years ago. Updated almost 6 years ago.

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

0%

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

Description

source:https://github.com/ceph/ceph/blob/aa158b68f0ae48ea9c9dda03d9ab08770fd19f96/src/ceph-volume/ceph_volume/util/prepare.py

in github file line 79,function check_id may check the osd_id whether already used or not,but its return make me confuse

If my cluster have osd.0 already,this function would return True,so 0 will be use by the next steps.But if osd_id is available,function's return will return False

anyway,this function(check_id) can not work in a right way.

def check_id(osd_id):
    """ 
    Checks to see if an osd ID exists or not. Returns True
    if it does exist, False if it doesn'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']
    return any([str(osd['id']) == str(osd_id) for osd in osds])
Actions #1

Updated by Nathan Cutler almost 6 years ago

  • Project changed from Ceph to ceph-volume
  • Subject changed from ceph-deploy: check_id function do the wrong job to ceph-volume: check_id function do the wrong job
  • Description updated (diff)
Actions #2

Updated by Alfredo Deza almost 6 years ago

  • Status changed from New to Duplicate

Known issue, in progress at #24044

Actions

Also available in: Atom PDF