Quoting Willem Jan Withagen ([email protected]):
> LOG.debug('Allocating OSD id...')
> secrets = Secrets()
> try:
> wanttobe = read_one_line(path, 'wanttobe')
> if os.path.exists(os.path.join(path, 'wanttobe')):
> os.unlink(os.path.join(path, 'wanttobe'))
> id_arg = wanttobe and [wanttobe] or []
> osd_id = command_with_stdin(
> [
> 'ceph',
> '--cluster', cluster,
> '--name', 'client.bootstrap-osd',
> '--keyring', keyring,
> '-i', '-',
> 'osd', 'new',
> fsid,
> ] + id_arg,
> secrets.get_json()
> )
> except subprocess.CalledProcessError as e:
> raise Error('ceph osd create failed', e, e.output)
> osd_id = must_be_one_line(osd_id)
> check_osd_id(osd_id)
> secrets.write_osd_keyring(osd_keyring, osd_id)
> return osd_id
ceph-volume code has something similar (ceph_volume/util/prepare.py)
def create_id(fsid, json_secrets):
"""
:param fsid: The osd fsid to create, always required
:param json_secrets: a json-ready object with whatever secrets are wanted
to be passed to the monitor
"""
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,
'-i', '-',
'osd', 'new', fsid
],
stdin=json_secrets
)
if returncode != 0:
raise RuntimeError('Unable to create a new OSD id')
return ' '.join(stdout).strip()
In the meantime we have found the following Warning in the docs [1]:
"In general, explicitly specifying {id} is not recommended. IDs are allocated as
an array, and skipping entries consumes some extra memory. This can become
significant if there are large gaps and/or clusters are large. If {id} is not
specified, the smallest available is used."
So, a "ceph osd ls" should give us a list, and we will pick the smallest
available number as the new osd id to use. We will make a check in the
(ansible) deployment code to see Ceph will indeed use that number.
Thanks,
Gr. Stefan
[1]: http://docs.ceph.com/docs/master/rados/operations/add-or-rm-osds/
--
| BIT BV http://www.bit.nl/ Kamer van Koophandel 09090351
| GPG: 0xD14839C6 +31 318 648 688 / [email protected]
_______________________________________________
ceph-users mailing list
[email protected]
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com