diff options
author | Guillaume Abrioux <gabrioux@ibm.com> | 2023-03-22 10:57:40 +0100 |
---|---|---|
committer | Guillaume Abrioux <gabrioux@ibm.com> | 2023-05-15 13:05:39 +0200 |
commit | cda1b1499c07cc20494163279762d33c88c8bd6f (patch) | |
tree | 375b470ecf5e34393a13116ac497d771d903c6c3 /src/ceph-volume/ceph_volume/devices | |
parent | Merge pull request #51343 from guits/tracker_59640 (diff) | |
download | ceph-cda1b1499c07cc20494163279762d33c88c8bd6f.tar.xz ceph-cda1b1499c07cc20494163279762d33c88c8bd6f.zip |
ceph-volume: drop filestore support
FileStore support has been dropped as of Ceph Reef, let's drop
it in ceph-volume too.
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
Diffstat (limited to 'src/ceph-volume/ceph_volume/devices')
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/activate.py | 103 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/batch.py | 56 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/common.py | 27 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/create.py | 4 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/prepare.py | 112 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/lvm/zap.py | 3 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/raw/prepare.py | 2 | ||||
-rw-r--r-- | src/ceph-volume/ceph_volume/devices/simple/activate.py | 32 |
8 files changed, 27 insertions, 312 deletions
diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 53ed6aa4791..feb91053b44 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -15,86 +15,6 @@ from .listing import direct_report logger = logging.getLogger(__name__) -def activate_filestore(osd_lvs, no_systemd=False): - # find the osd - for osd_lv in osd_lvs: - if osd_lv.tags.get('ceph.type') == 'data': - data_lv = osd_lv - break - else: - raise RuntimeError('Unable to find a data LV for filestore activation') - - is_encrypted = data_lv.tags.get('ceph.encrypted', '0') == '1' - is_vdo = data_lv.tags.get('ceph.vdo', '0') - - osd_id = data_lv.tags['ceph.osd_id'] - configuration.load_ceph_conf_path(data_lv.tags['ceph.cluster_name']) - configuration.load() - # it may have a volume with a journal - for osd_lv in osd_lvs: - if osd_lv.tags.get('ceph.type') == 'journal': - osd_journal_lv = osd_lv - break - else: - osd_journal_lv = None - - # TODO: add sensible error reporting if this is ever the case - # blow up with a KeyError if this doesn't exist - osd_fsid = data_lv.tags['ceph.osd_fsid'] - if not osd_journal_lv: - # must be a disk partition, by querying blkid by the uuid we are ensuring that the - # device path is always correct - journal_uuid = data_lv.tags['ceph.journal_uuid'] - osd_journal = disk.get_device_from_partuuid(journal_uuid) - else: - journal_uuid = osd_journal_lv.lv_uuid - osd_journal = data_lv.tags['ceph.journal_device'] - - if not osd_journal: - raise RuntimeError('unable to detect an lv or device journal for OSD %s' % osd_id) - - # this is done here, so that previous checks that ensure path availability - # and correctness can still be enforced, and report if any issues are found - if is_encrypted: - lockbox_secret = data_lv.tags['ceph.cephx_lockbox_secret'] - # this keyring writing is idempotent - encryption_utils.write_lockbox_keyring(osd_id, osd_fsid, lockbox_secret) - dmcrypt_secret = encryption_utils.get_dmcrypt_key(osd_id, osd_fsid) - encryption_utils.luks_open(dmcrypt_secret, data_lv.lv_path, data_lv.lv_uuid) - encryption_utils.luks_open(dmcrypt_secret, osd_journal, journal_uuid) - - osd_journal = '/dev/mapper/%s' % journal_uuid - source = '/dev/mapper/%s' % data_lv.lv_uuid - else: - source = data_lv.lv_path - - # mount the osd - destination = '/var/lib/ceph/osd/%s-%s' % (conf.cluster, osd_id) - if not system.device_is_mounted(source, destination=destination): - prepare_utils.mount_osd(source, osd_id, is_vdo=is_vdo) - - # ensure that the OSD destination is always chowned properly - system.chown(destination) - - # always re-do the symlink regardless if it exists, so that the journal - # device path that may have changed can be mapped correctly every time - destination = '/var/lib/ceph/osd/%s-%s/journal' % (conf.cluster, osd_id) - process.run(['ln', '-snf', osd_journal, destination]) - - # make sure that the journal has proper permissions - system.chown(osd_journal) - - if no_systemd is False: - # enable the ceph-volume unit for this OSD - systemctl.enable_volume(osd_id, osd_fsid, 'lvm') - - # enable the OSD - systemctl.enable_osd(osd_id) - - # start the OSD - systemctl.start_osd(osd_id) - terminal.success("ceph-volume lvm activate successful for osd ID: %s" % osd_id) - def get_osd_device_path(osd_lvs, device_type, dmcrypt_secret=None): """ @@ -279,30 +199,16 @@ class Activate(object): # This argument is only available when passed in directly or via # systemd, not when ``create`` is being used + # placeholder when a new objectstore support will be added if getattr(args, 'auto_detect_objectstore', False): logger.info('auto detecting objectstore') - # may get multiple lvs, so can't do get_the_lvs() calls here - for lv in lvs: - has_journal = lv.tags.get('ceph.journal_uuid') - if has_journal: - logger.info('found a journal associated with the OSD, ' - 'assuming filestore') - return activate_filestore(lvs, args.no_systemd) - - logger.info('unable to find a journal associated with the OSD, ' - 'assuming bluestore') - return activate_bluestore(lvs, args.no_systemd) - # explicit filestore/bluestore flags take precedence + # explicit 'objectstore' flags take precedence if getattr(args, 'bluestore', False): activate_bluestore(lvs, args.no_systemd, getattr(args, 'no_tmpfs', False)) - elif getattr(args, 'filestore', False): - activate_filestore(lvs, args.no_systemd) elif any('ceph.block_device' in lv.tags for lv in lvs): activate_bluestore(lvs, args.no_systemd, getattr(args, 'no_tmpfs', False)) - elif any('ceph.data_device' in lv.tags for lv in lvs): - activate_filestore(lvs, args.no_systemd) def main(self): sub_command_help = dedent(""" @@ -349,11 +255,6 @@ class Activate(object): help='force bluestore objectstore activation', ) parser.add_argument( - '--filestore', - action='store_true', - help='force filestore objectstore activation', - ) - parser.add_argument( '--all', dest='activate_all', action='store_true', diff --git a/src/ceph-volume/ceph_volume/devices/lvm/batch.py b/src/ceph-volume/ceph_volume/devices/lvm/batch.py index d867fe2d87e..69a3f672b48 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/batch.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/batch.py @@ -29,11 +29,10 @@ def device_formatter(devices): return ''.join(lines) -def ensure_disjoint_device_lists(data, db=[], wal=[], journal=[]): +def ensure_disjoint_device_lists(data, db=[], wal=[]): # check that all device lists are disjoint with each other if not all([set(data).isdisjoint(set(db)), set(data).isdisjoint(set(wal)), - set(data).isdisjoint(set(journal)), set(db).isdisjoint(set(wal))]): raise Exception('Device lists are not disjoint') @@ -221,13 +220,6 @@ class Batch(object): help='Devices to provision OSDs wal volumes', ) parser.add_argument( - '--journal-devices', - nargs='*', - type=arg_validators.ValidBatchDevice(), - default=[], - help='Devices to provision OSDs journal volumes', - ) - parser.add_argument( '--auto', action='store_true', help=('deploy multi-device OSDs if rotational and non-rotational drives ' @@ -247,11 +239,6 @@ class Batch(object): help='bluestore objectstore (default)', ) parser.add_argument( - '--filestore', - action='store_true', - help='filestore objectstore', - ) - parser.add_argument( '--report', action='store_true', help='Only report on OSD that would be created and exit', @@ -323,25 +310,6 @@ class Batch(object): type=int, help='Provision slots on WAL device, can remain unoccupied' ) - def journal_size_in_mb_hack(size): - # TODO give user time to adjust, then remove this - if size and size[-1].isdigit(): - mlogger.warning('DEPRECATION NOTICE') - mlogger.warning('--journal-size as integer is parsed as megabytes') - mlogger.warning('A future release will parse integers as bytes') - mlogger.warning('Add a "M" to explicitly pass a megabyte size') - size += 'M' - return disk.Size.parse(size) - parser.add_argument( - '--journal-size', - type=journal_size_in_mb_hack, - help='Override the "osd_journal_size" value, in megabytes' - ) - parser.add_argument( - '--journal-slots', - type=int, - help='Provision slots on journal device, can remain unoccupied' - ) parser.add_argument( '--prepare', action='store_true', @@ -356,7 +324,7 @@ class Batch(object): ) self.args = parser.parse_args(argv) self.parser = parser - for dev_list in ['', 'db_', 'wal_', 'journal_']: + for dev_list in ['', 'db_', 'wal_']: setattr(self, '{}usable'.format(dev_list), []) def report(self, plan): @@ -395,7 +363,7 @@ class Batch(object): ''' Helper for legacy auto behaviour. Sorts drives into rotating and non-rotating, the latter being used for - db or journal. + db. ''' mlogger.warning('DEPRECATION NOTICE') mlogger.warning('You are using the legacy automatic disk sorting behavior') @@ -408,10 +376,7 @@ class Batch(object): # no need for additional sorting, we'll only deploy standalone on ssds return self.args.devices = rotating - if self.args.filestore: - self.args.journal_devices = ssd - else: - self.args.db_devices = ssd + self.args.db_devices = ssd @decorators.needs_root def main(self): @@ -420,19 +385,18 @@ class Batch(object): # Default to bluestore here since defaulting it in add_argument may # cause both to be True - if not self.args.bluestore and not self.args.filestore: + if not self.args.bluestore: self.args.bluestore = True if (self.args.auto and not self.args.db_devices and not - self.args.wal_devices and not self.args.journal_devices): + self.args.wal_devices): self._sort_rotational_disks() self._check_slot_args() ensure_disjoint_device_lists(self.args.devices, self.args.db_devices, - self.args.wal_devices, - self.args.journal_devices) + self.args.wal_devices) plan = self.get_plan(self.args) @@ -453,7 +417,6 @@ class Batch(object): defaults = common.get_default_args() global_args = [ 'bluestore', - 'filestore', 'dmcrypt', 'crush_device_class', 'no_systemd', @@ -473,8 +436,6 @@ class Batch(object): if args.bluestore: plan = self.get_deployment_layout(args, args.devices, args.db_devices, args.wal_devices) - elif args.filestore: - plan = self.get_deployment_layout(args, args.devices, args.journal_devices) return plan def get_deployment_layout(self, args, devices, fast_devices=[], @@ -500,7 +461,8 @@ class Batch(object): return plan requested_osds = args.osds_per_device * len(phys_devs) + len(lvm_devs) - fast_type = 'block_db' if args.bluestore else 'journal' + if args.bluestore: + fast_type = 'block_db' fast_allocations = self.fast_allocations(fast_devices, requested_osds, num_osds, diff --git a/src/ceph-volume/ceph_volume/devices/lvm/common.py b/src/ceph-volume/ceph_volume/devices/lvm/common.py index edc8e1cbce1..35e53181aff 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/common.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/common.py @@ -126,33 +126,12 @@ bluestore_args = { }, } -filestore_args = { - '--filestore': { - 'action': 'store_true', - 'help': 'Use the filestore objectstore', - }, - '--journal': { - 'help': 'A logical volume (vg_name/lv_name), or path to a device', - 'type': arg_validators.ValidDevice(as_string=True), - }, - '--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(): defaults = {} def format_name(name): return name.strip('-').replace('-', '_').replace('.', '_') - for argset in (common_args, filestore_args, bluestore_args): + for argset in (common_args, bluestore_args): defaults.update({format_name(name): val.get('default', None) for name, val in argset.items()}) return defaults @@ -168,7 +147,6 @@ def common_parser(prog, description): description=description, ) - filestore_group = parser.add_argument_group('filestore') bluestore_group = parser.add_argument_group('bluestore') for name, kwargs in common_args.items(): @@ -177,9 +155,6 @@ def common_parser(prog, description): for name, kwargs in bluestore_args.items(): bluestore_group.add_argument(name, **kwargs) - for name, kwargs in filestore_args.items(): - filestore_group.add_argument(name, **kwargs) - # Do not parse args, so that consumers can do something before the args get # parsed triggering argparse behavior return parser diff --git a/src/ceph-volume/ceph_volume/devices/lvm/create.py b/src/ceph-volume/ceph_volume/devices/lvm/create.py index af2cd96c084..631a21b239d 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/create.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/create.py @@ -68,10 +68,10 @@ class Create(object): if len(self.argv) == 0: print(sub_command_help) return - exclude_group_options(parser, groups=['filestore', 'bluestore'], argv=self.argv) + exclude_group_options(parser, groups=['bluestore'], argv=self.argv) args = parser.parse_args(self.argv) # Default to bluestore here since defaulting it in add_argument may # cause both to be True - if not args.bluestore and not args.filestore: + if not args.bluestore: args.bluestore = True self.create(args) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py index 2f715fdba12..1cf19d98d92 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) def prepare_dmcrypt(key, device, device_type, tags): """ Helper for devices that are encrypted. The operations needed for - block, db, wal, or data/journal devices are all the same + block, db, wal devices are all the same """ if not device: return '' @@ -37,50 +37,6 @@ def prepare_dmcrypt(key, device, device_type, tags): return '/dev/mapper/%s' % uuid -def prepare_filestore(device, journal, secrets, tags, osd_id, fsid): - """ - :param device: The name of the logical volume to work with - :param journal: similar to device but can also be a regular/plain disk - :param secrets: A dict with the secrets needed to create the osd (e.g. cephx) - :param id_: The OSD id - :param fsid: The OSD fsid, also known as the OSD UUID - """ - cephx_secret = secrets.get('cephx_secret', prepare_utils.create_key()) - - # encryption-only operations - if secrets.get('dmcrypt_key'): - # format and open ('decrypt' devices) and re-assign the device and journal - # variables so that the rest of the process can use the mapper paths - key = secrets['dmcrypt_key'] - device = prepare_dmcrypt(key, device, 'data', tags) - journal = prepare_dmcrypt(key, journal, 'journal', tags) - - # vdo detection - is_vdo = api.is_vdo(device) - # create the directory - prepare_utils.create_osd_path(osd_id) - # format the device - prepare_utils.format_device(device) - # mount the data device - prepare_utils.mount_osd(device, osd_id, is_vdo=is_vdo) - # symlink the journal - prepare_utils.link_journal(journal, osd_id) - # get the latest monmap - prepare_utils.get_monmap(osd_id) - # prepare the osd filesystem - 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'): - # if the device is going to get activated right away, this can be done - # here, otherwise it will be recreated - encryption_utils.write_lockbox_keyring( - osd_id, - fsid, - tags['ceph.cephx_lockbox_secret'] - ) - - def prepare_bluestore(block, wal, db, secrets, tags, osd_id, fsid): """ :param block: The name of the logical volume for the bluestore data @@ -201,7 +157,7 @@ class Prepare(object): a device or partition will result in error. :param arg: The value of ``--data`` when parsing args - :param device_type: Usually, either ``data`` or ``block`` (filestore vs. bluestore) + :param device_type: Usually ``block`` :param osd_uuid: The OSD uuid """ device = self.args.data @@ -298,60 +254,7 @@ class Prepare(object): 'ceph.crush_device_class': crush_device_class, 'ceph.osdspec_affinity': prepare_utils.get_osdspec_affinity() } - if self.args.filestore: - if not self.args.journal: - 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('/') - data_lv = api.get_single_lv(filters={'lv_name': lv_name, - 'vg_name': vg_name}) - except ValueError: - data_lv = None - - if not data_lv: - data_lv = self.prepare_data_device('data', osd_fsid) - - tags['ceph.data_device'] = data_lv.lv_path - tags['ceph.data_uuid'] = data_lv.lv_uuid - tags['ceph.vdo'] = api.is_vdo(data_lv.lv_path) - 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_single_lv(filters={'lv_name': lv_name, - 'vg_name': vg_name}).set_tags(tags) - - prepare_filestore( - data_lv.lv_path, - journal_device, - secrets, - tags, - self.osd_id, - osd_fsid, - ) - elif self.args.bluestore: + if self.args.bluestore: try: vg_name, lv_name = self.args.data.split('/') block_lv = api.get_single_lv(filters={'lv_name': lv_name, @@ -427,15 +330,10 @@ class Prepare(object): if len(self.argv) == 0: print(sub_command_help) return - exclude_group_options(parser, argv=self.argv, groups=['filestore', 'bluestore']) + exclude_group_options(parser, argv=self.argv, groups=['bluestore']) self.args = parser.parse_args(self.argv) - # the unfortunate mix of one superset for both filestore and bluestore - # makes this validation cumbersome - if self.args.filestore: - if not self.args.journal: - raise SystemExit('--journal is required when using --filestore') # Default to bluestore here since defaulting it in add_argument may # cause both to be True - if not self.args.bluestore and not self.args.filestore: + if not self.args.bluestore: self.args.bluestore = True self.safe_prepare() diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py index 708716e5e37..2f6e00f8774 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/zap.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/zap.py @@ -101,10 +101,9 @@ def ensure_associated_lvs(lvs, lv_tags={}): # leaving many journals with osd.1 - usually, only a single LV will be # returned - journal_lvs = api.get_lvs(tags=merge_dict(lv_tags, {'ceph.type': 'journal'})) db_lvs = api.get_lvs(tags=merge_dict(lv_tags, {'ceph.type': 'db'})) wal_lvs = api.get_lvs(tags=merge_dict(lv_tags, {'ceph.type': 'wal'})) - backing_devices = [(journal_lvs, 'journal'), (db_lvs, 'db'), + backing_devices = [(db_lvs, 'db'), (wal_lvs, 'wal')] verified_devices = [] diff --git a/src/ceph-volume/ceph_volume/devices/raw/prepare.py b/src/ceph-volume/ceph_volume/devices/raw/prepare.py index 3c96eedacf3..6165da3a643 100644 --- a/src/ceph-volume/ceph_volume/devices/raw/prepare.py +++ b/src/ceph-volume/ceph_volume/devices/raw/prepare.py @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) def prepare_dmcrypt(key, device, device_type, fsid): """ Helper for devices that are encrypted. The operations needed for - block, db, wal, or data/journal devices are all the same + block, db, wal, devices are all the same """ if not device: return '' diff --git a/src/ceph-volume/ceph_volume/devices/simple/activate.py b/src/ceph-volume/ceph_volume/devices/simple/activate.py index 7439141c03a..f3dcdcef838 100644 --- a/src/ceph-volume/ceph_volume/devices/simple/activate.py +++ b/src/ceph-volume/ceph_volume/devices/simple/activate.py @@ -9,7 +9,6 @@ from textwrap import dedent from ceph_volume import process, decorators, terminal, conf from ceph_volume.util import system, disk from ceph_volume.util import encryption as encryption_utils -from ceph_volume.util import prepare as prepare_utils from ceph_volume.systemd import systemctl @@ -36,29 +35,15 @@ class Activate(object): try: objectstore = json_config['type'] except KeyError: - if {'data', 'journal'}.issubset(set(devices)): - logger.warning( - '"type" key not found, assuming "filestore" since journal key is present' - ) - objectstore = 'filestore' - else: - logger.warning( - '"type" key not found, assuming "bluestore" since journal key is not present' - ) - objectstore = 'bluestore' + logger.warning( + '"type" key not found, assuming "bluestore" since journal key is not present' + ) + objectstore = 'bluestore' # Go through all the device combinations that are absolutely required, # raise an error describing what was expected and what was found # otherwise. - if objectstore == 'filestore': - if {'data', 'journal'}.issubset(set(devices)): - return True - else: - found = [i for i in devices if i in ['data', 'journal']] - mlogger.error("Required devices (data, and journal) not present for filestore") - mlogger.error('filestore devices found: %s', found) - raise RuntimeError('Unable to activate filestore OSD due to missing devices') - else: + if objectstore == 'bluestore': # This is a bit tricky, with newer bluestore we don't need data, older implementations # do (e.g. with ceph-disk). ceph-volume just uses a tmpfs that doesn't require data. if {'block', 'data'}.issubset(set(devices)): @@ -176,19 +161,14 @@ class Activate(object): "be skipped, consider cleaning legacy " "json file {}".format(osd_metadata['fsid'], args.json_config)) - journal_device = self.get_device(osd_metadata.get('journal', {}).get('uuid')) block_device = self.get_device(osd_metadata.get('block', {}).get('uuid')) block_db_device = self.get_device(osd_metadata.get('block.db', {}).get('uuid')) block_wal_device = self.get_device(osd_metadata.get('block.wal', {}).get('uuid')) if not system.device_is_mounted(data_device, destination=osd_dir): - if osd_metadata.get('type') == 'filestore': - prepare_utils.mount_osd(data_device, osd_id) - else: - process.run(['mount', '-v', data_device, osd_dir]) + process.run(['mount', '-v', data_device, osd_dir]) device_map = { - 'journal': journal_device, 'block': block_device, 'block.db': block_db_device, 'block.wal': block_wal_device |