Re: Deterministic naming of LVM volumes (ceph-volume)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Willem Jan Withagen (wjw@xxxxxxxxxxx):
>     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 / info@xxxxxx
_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com



[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux