diff options
author | Jan Fajerski <jfajerski@suse.com> | 2020-09-07 14:54:01 +0200 |
---|---|---|
committer | Jan Fajerski <jfajerski@suse.com> | 2020-09-25 11:50:23 +0200 |
commit | 7f766846328aac82d75175ed2c1c0bf3438a99e0 (patch) | |
tree | 9edaca6bc5f56b925b51e851f60df8d4cdd7b394 /src/ceph-volume | |
parent | doc: update ceph-volume lvm batch docs (diff) | |
download | ceph-7f766846328aac82d75175ed2c1c0bf3438a99e0.tar.xz ceph-7f766846328aac82d75175ed2c1c0bf3438a99e0.zip |
ceph-volume: make --journal optional, add --journal-slots
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
Diffstat (limited to 'src/ceph-volume')
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/batch.py | 7 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/common.py | 8 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/prepare.py | 51 |
3 files changed, 51 insertions, 15 deletions
diff --git a/src/ceph-volume/ceph_volume/devices/lvm/batch.py b/src/ceph-volume/ceph_volume/devices/lvm/batch.py index 78b323cc1f5..a26c965db9a 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/batch.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/batch.py @@ -276,9 +276,14 @@ class Batch(object): type=int, help='Provision slots on WAL device, can remain unoccupied' ) + def journal_size_in_mb_hack(size): + # give user time to adjust, then remove here + if size and size[-1].isdigit(): + size += 'M' + return disk.Size.parse(size) parser.add_argument( '--journal-size', - type=disk.Size.parse, + type=journal_size_in_mb_hack, help='Override the "osd_journal_size" value, in megabytes' ) parser.add_argument( diff --git a/src/ceph-volume/ceph_volume/devices/lvm/common.py b/src/ceph-volume/ceph_volume/devices/lvm/common.py index e8d976540b3..2ad8562ae61 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/common.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/common.py @@ -128,13 +128,19 @@ filestore_args = { 'help': 'Use the filestore objectstore', }, '--journal': { - 'help': '(REQUIRED) A logical volume (vg_name/lv_name), or path to a device', + 'help': 'A logical volume (vg_name/lv_name), or path to a device', }, '--journal-size': { 'help': 'Size of journal LV in case a raw block device was passed in --journal', 'default': '0', 'type': disk.Size.parse }, + '--journal-slots': { + 'help': ('Intended number of slots on journal device. The new OSD gets one' + 'of those slots or 1/nth of the available capacity'), + 'type': int, + 'default': 1, + }, } def get_default_args(): diff --git a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py index a951546a879..fe1132dd5b8 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py @@ -135,7 +135,7 @@ class Prepare(object): raise RuntimeError('unable to use device') return uuid - def setup_device(self, device_type, device_name, tags, size): + def setup_device(self, device_type, device_name, tags, size, slots): """ Check if ``device`` is an lv, if so, set the tags, making sure to update the tags with the lv_uuid and lv_path which the incoming tags @@ -170,9 +170,7 @@ class Prepare(object): kwargs = { 'device': device_name, 'tags': tags, - 'slots': getattr(self.args, - 'block_{}_slots'.format(device_type), - 1), + 'slots': slots } #TODO use get_block_db_size and co here to get configured size in #conf file @@ -302,7 +300,28 @@ class Prepare(object): #TODO: allow auto creation of journal on passed device, only works # when physical device is passed, not LV if not self.args.journal: - raise RuntimeError('--journal is required when using --filestore') + logger.info(('no journal was specifed, creating journal lv ' + 'on {}').format(self.args.data)) + self.args.journal = self.args.data + self.args.journal_size = disk.Size(g=5) + # need to adjust data size/slots for colocated journal + if self.args.data_size: + self.args.data_size -= self.args.journal_size + if self.args.data_slots == 1: + self.args.data_slots = 0 + else: + raise RuntimeError(('Can\'t handle multiple filestore OSDs ' + 'with colocated journals yet. Please ' + 'create journal LVs manually')) + tags['ceph.cephx_lockbox_secret'] = cephx_lockbox_secret + tags['ceph.encrypted'] = encrypted + + journal_device, journal_uuid, tags = self.setup_device( + 'journal', + self.args.journal, + tags, + self.args.journal_size, + self.args.journal_slots) try: vg_name, lv_name = self.args.data.split('/') @@ -316,15 +335,13 @@ class Prepare(object): tags['ceph.data_device'] = data_lv.lv_path tags['ceph.data_uuid'] = data_lv.lv_uuid - tags['ceph.cephx_lockbox_secret'] = cephx_lockbox_secret - tags['ceph.encrypted'] = encrypted tags['ceph.vdo'] = api.is_vdo(data_lv.lv_path) - - journal_device, journal_uuid, tags = self.setup_device( - 'journal', self.args.journal, tags, self.args.journal_size) - tags['ceph.type'] = 'data' data_lv.set_tags(tags) + if not journal_device.startswith('/'): + # we got a journal lv, set rest of the tags + api.get_first_lv(filters={'lv_name': lv_name, + 'vg_name': vg_name}).set_tags(tags) prepare_filestore( data_lv.lv_path, @@ -352,9 +369,17 @@ class Prepare(object): tags['ceph.vdo'] = api.is_vdo(block_lv.lv_path) wal_device, wal_uuid, tags = self.setup_device( - 'wal', self.args.block_wal, tags, self.args.block_wal_size) + 'wal', + self.args.block_wal, + tags, + self.args.block_wal_size, + self.args.block_wal_slots) db_device, db_uuid, tags = self.setup_device( - 'db', self.args.block_db, tags, self.args.block_db_size) + 'db', + self.args.block_db, + tags, + self.args.block_db_size, + self.args.block_db_slots) tags['ceph.type'] = 'block' block_lv.set_tags(tags) |