Fix ceph-mon can not print log due to incorrect permission on log file
Change-Id: I34cd8ba1e45b90e60bd9c49d7d3973008bd95559 Signed-off-by: dongdong tao <dongdong.tao@canonical.com> Closes-Bug: #1783526
This commit is contained in:
parent
37fbda6bd8
commit
af6478c4b4
|
@ -1287,6 +1287,7 @@ def add_keyring_to_ceph(keyring, secret, hostname, path, done, init_marker):
|
|||
subprocess.check_call(['ceph-mon', '--mkfs',
|
||||
'-i', hostname,
|
||||
'--keyring', keyring])
|
||||
chownr('/var/log/ceph', ceph_user(), ceph_user())
|
||||
chownr(path, ceph_user(), ceph_user())
|
||||
with open(done, 'w'):
|
||||
pass
|
||||
|
@ -1466,6 +1467,11 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
|
|||
' skipping.'.format(dev))
|
||||
return
|
||||
|
||||
if is_mapped_luks_device(dev):
|
||||
log('{} is a mapped LUKS device,'
|
||||
' skipping.'.format(dev))
|
||||
return
|
||||
|
||||
if cmp_pkgrevno('ceph', '12.2.4') >= 0:
|
||||
cmd = _ceph_volume(dev,
|
||||
osd_journal,
|
||||
|
@ -1677,6 +1683,31 @@ def is_active_bluestore_device(dev):
|
|||
return False
|
||||
|
||||
|
||||
def is_luks_device(dev):
|
||||
"""
|
||||
Determine if dev is a LUKS-formatted block device.
|
||||
|
||||
:param: dev: A full path to a block device to check for LUKS header
|
||||
presence
|
||||
:returns: boolean: indicates whether a device is used based on LUKS header.
|
||||
"""
|
||||
return True if _luks_uuid(dev) else False
|
||||
|
||||
|
||||
def is_mapped_luks_device(dev):
|
||||
"""
|
||||
Determine if dev is a mapped LUKS device
|
||||
:param: dev: A full path to a block device to be checked
|
||||
:returns: boolean: indicates whether a device is mapped
|
||||
"""
|
||||
_, dirs, _ = next(os.walk(
|
||||
'/sys/class/block/{}/holders/'
|
||||
.format(os.path.basename(os.path.realpath(dev))))
|
||||
)
|
||||
is_held = len(dirs) > 0
|
||||
return is_held and is_luks_device(dev)
|
||||
|
||||
|
||||
def get_conf(variable):
|
||||
"""
|
||||
Get the value of the given configuration variable from the
|
||||
|
@ -1689,6 +1720,7 @@ def get_conf(variable):
|
|||
return subprocess.check_output([
|
||||
'ceph-osd',
|
||||
'--show-config-value={}'.format(variable),
|
||||
'--no-mon-config',
|
||||
]).strip()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue