def maybe_mkdir(*a, **kw):
"""
- Creates a new directory if it doesn't exist, removes
+ Creates a new directory if it doesn't exist, removes
existing symlink before creating the directory.
"""
# remove any symlink, if it is there..
def get_conf(cluster, variable):
"""
- Get the value of the given configuration variable from the
+ Get the value of the given configuration variable from the
cluster.
:raises: Error if call to ceph-conf fails.
options,
):
"""
- Mounts a device with given filessystem type and
+ Mounts a device with given filessystem type and
mount options to a tempfile path under /var/lib/ceph/tmp.
"""
# pick best-of-breed mount options based on fs type
osd_id,
keyring,
):
- subprocess.check_call(
- args=[
- '/usr/bin/ceph',
- '--cluster', cluster,
- '--name', 'client.bootstrap-osd',
- '--keyring', keyring,
- 'auth', 'add', 'osd.{osd_id}'.format(osd_id=osd_id),
- '-i', os.path.join(path, 'keyring'),
- 'osd', 'allow *',
- 'mon', 'allow rwx',
- ],
- )
+ try:
+ # try dumpling+ cap scheme
+ subprocess.check_call(
+ args=[
+ '/usr/bin/ceph',
+ '--cluster', cluster,
+ '--name', 'client.bootstrap-osd',
+ '--keyring', keyring,
+ 'auth', 'add', 'osd.{osd_id}'.format(osd_id=osd_id),
+ '-i', os.path.join(path, 'keyring'),
+ 'osd', 'allow *',
+ 'mon', 'allow profile osd',
+ ],
+ )
+ except subprocess.CalledProcessError as err:
+ if err.errno == errno.EACCES:
+ # try old cap scheme
+ subprocess.check_call(
+ args=[
+ '/usr/bin/ceph',
+ '--cluster', cluster,
+ '--name', 'client.bootstrap-osd',
+ '--keyring', keyring,
+ 'auth', 'add', 'osd.{osd_id}'.format(osd_id=osd_id),
+ '-i', os.path.join(path, 'keyring'),
+ 'osd', 'allow *',
+ 'mon', 'allow rwx',
+ ],
+ )
+ else:
+ raise
def move_mount(
)
else:
raise Error('%s is not a directory or block device', args.path)
-
+
start_daemon(
cluster=cluster,
osd_id=osd_id,
print '%s%s %s' % (prefix, dev, ', '.join(desc))
-
+
def main_list(args):
partmap = list_all_partitions()