import uuid
import time
import shlex
+import pwd
+import grp
"""
Prepare:
check_osd_id(osd_id)
return osd_id
+def get_ceph_user():
+ if pwd.getpwnam('ceph') and grp.getgrnam('ceph'):
+ return 'ceph'
+ else:
+ return 'root'
+
def path_set_context(path):
# restore selinux context to default policy values
if which('restorecon'):
],
)
+ # if ceph user exists, set owner to ceph
+ if get_ceph_user() == 'ceph':
+ command(
+ [
+ 'chown', '-R', 'ceph:ceph',
+ path,
+ ],
+ )
+
def _check_output(args=None, **kwargs):
out, ret = command(args, **kwargs)
if ret:
'--osd-journal', os.path.join(path, 'journal'),
'--osd-uuid', fsid,
'--keyring', os.path.join(path, 'keyring'),
+ '--setuser', get_ceph_user(),
+ '--setgroup', get_ceph_user(),
],
)
# TODO ceph-osd --mkfs removes the monmap file?