mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
Merge pull request #20787 from ceph/wip-rm23260
ceph-volume fix filestore OSD creation after mon-config changes Reviewed-by: Andrew Schoen <aschoen@redhat.com>
This commit is contained in:
commit
e7b3cc9619
src/ceph-volume/ceph_volume
@ -67,7 +67,7 @@ def prepare_filestore(device, journal, secrets, tags, osd_id, fsid):
|
||||
# get the latest monmap
|
||||
prepare_utils.get_monmap(osd_id)
|
||||
# prepare the osd filesystem
|
||||
prepare_utils.osd_mkfs_filestore(osd_id, fsid)
|
||||
prepare_utils.osd_mkfs_filestore(osd_id, fsid, cephx_secret)
|
||||
# write the OSD keyring if it doesn't exist already
|
||||
prepare_utils.write_keyring(osd_id, cephx_secret)
|
||||
if secrets.get('dmcrypt_key'):
|
||||
|
@ -116,6 +116,31 @@ class TestFormatDevice(object):
|
||||
assert expected == fake_run.calls[0]['args'][0]
|
||||
|
||||
|
||||
mkfs_filestore_flags = [
|
||||
'ceph-osd',
|
||||
'--cluster',
|
||||
'--osd-objectstore', 'filestore',
|
||||
'--mkfs',
|
||||
'-i',
|
||||
'--monmap',
|
||||
'--keyfile', '-', # goes through stdin
|
||||
'--osd-data',
|
||||
'--osd-journal',
|
||||
'--osd-uuid',
|
||||
'--setuser', 'ceph',
|
||||
'--setgroup', 'ceph'
|
||||
]
|
||||
|
||||
|
||||
class TestOsdMkfsFilestore(object):
|
||||
|
||||
@pytest.mark.parametrize('flag', mkfs_filestore_flags)
|
||||
def test_keyring_is_used(self, fake_call, monkeypatch, flag):
|
||||
monkeypatch.setattr(system, 'chown', lambda path: True)
|
||||
prepare.osd_mkfs_filestore(1, 'asdf', keyring='secret')
|
||||
assert flag in fake_call.calls[0]['args'][0]
|
||||
|
||||
|
||||
class TestOsdMkfsBluestore(object):
|
||||
|
||||
def test_keyring_is_added(self, fake_call, monkeypatch):
|
||||
|
@ -298,7 +298,7 @@ def osd_mkfs_bluestore(osd_id, fsid, keyring=None, wal=False, db=False):
|
||||
process.call(command, stdin=keyring, show_command=True)
|
||||
|
||||
|
||||
def osd_mkfs_filestore(osd_id, fsid):
|
||||
def osd_mkfs_filestore(osd_id, fsid, keyring):
|
||||
"""
|
||||
Create the files for the OSD to function. A normal call will look like:
|
||||
|
||||
@ -318,7 +318,7 @@ def osd_mkfs_filestore(osd_id, fsid):
|
||||
system.chown(journal)
|
||||
system.chown(path)
|
||||
|
||||
process.run([
|
||||
command = [
|
||||
'ceph-osd',
|
||||
'--cluster', conf.cluster,
|
||||
# undocumented flag, sets the `type` file to contain 'filestore'
|
||||
@ -326,9 +326,11 @@ def osd_mkfs_filestore(osd_id, fsid):
|
||||
'--mkfs',
|
||||
'-i', osd_id,
|
||||
'--monmap', monmap,
|
||||
'--keyfile', '-', # goes through stdin
|
||||
'--osd-data', path,
|
||||
'--osd-journal', journal,
|
||||
'--osd-uuid', fsid,
|
||||
'--setuser', 'ceph',
|
||||
'--setgroup', 'ceph'
|
||||
])
|
||||
]
|
||||
process.call(command, stdin=keyring, terminal_verbose=True, show_command=True)
|
||||
|
Loading…
Reference in New Issue
Block a user