Skip to content

Commit

Permalink
Merge pull request ceph#50657 from guits/remove-filestore-cv
Browse files Browse the repository at this point in the history
ceph-volume: drop filestore support
  • Loading branch information
guits authored May 22, 2023
2 parents 0f64042 + 2f78121 commit 8a94605
Show file tree
Hide file tree
Showing 44 changed files with 59 additions and 1,182 deletions.
1 change: 0 additions & 1 deletion src/ceph-volume/ceph_volume/api/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,6 @@ def create_lv(name_prefix,
# be so this function will set it after creation using the mapping
# XXX add CEPH_VOLUME_LVM_DEBUG to enable -vvvv on lv operations
type_path_tag = {
'journal': 'ceph.journal_device',
'data': 'ceph.data_device',
'block': 'ceph.block_device',
'wal': 'ceph.wal_device',
Expand Down
103 changes: 2 additions & 101 deletions src/ceph-volume/ceph_volume/devices/lvm/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,86 +15,6 @@
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):
"""
Expand Down Expand Up @@ -279,30 +199,16 @@ def activate(self, args, osd_id=None, osd_fsid=None):

# 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("""
Expand Down Expand Up @@ -348,11 +254,6 @@ def main(self):
action='store_true',
help='force bluestore objectstore activation',
)
parser.add_argument(
'--filestore',
action='store_true',
help='force filestore objectstore activation',
)
parser.add_argument(
'--all',
dest='activate_all',
Expand Down
56 changes: 9 additions & 47 deletions src/ceph-volume/ceph_volume/devices/lvm/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -220,13 +219,6 @@ def __init__(self, argv):
default=[],
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',
Expand All @@ -246,11 +238,6 @@ def __init__(self, argv):
action='store_true',
help='bluestore objectstore (default)',
)
parser.add_argument(
'--filestore',
action='store_true',
help='filestore objectstore',
)
parser.add_argument(
'--report',
action='store_true',
Expand Down Expand Up @@ -323,25 +310,6 @@ def __init__(self, argv):
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',
Expand All @@ -356,7 +324,7 @@ def journal_size_in_mb_hack(size):
)
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):
Expand Down Expand Up @@ -395,7 +363,7 @@ def _sort_rotational_disks(self):
'''
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')
Expand All @@ -408,10 +376,7 @@ def _sort_rotational_disks(self):
# 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):
Expand All @@ -420,19 +385,18 @@ def main(self):

# 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)

Expand All @@ -453,7 +417,6 @@ def _execute(self, plan):
defaults = common.get_default_args()
global_args = [
'bluestore',
'filestore',
'dmcrypt',
'crush_device_class',
'no_systemd',
Expand All @@ -473,8 +436,6 @@ def get_plan(self, args):
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=[],
Expand All @@ -500,7 +461,8 @@ def get_deployment_layout(self, args, devices, fast_devices=[],
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,
Expand Down
27 changes: 1 addition & 26 deletions src/ceph-volume/ceph_volume/devices/lvm/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,12 @@ def rollback_osd(args, osd_id=None):
},
}

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

Expand All @@ -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():
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ceph-volume/ceph_volume/devices/lvm/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def main(self):
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)
Loading

0 comments on commit 8a94605

Please sign in to comment.