From: Sage Weil Date: Sat, 20 Nov 2021 15:19:36 +0000 (-0500) Subject: ceph-volume: adjust arguments for 'ceph-volume raw activate' X-Git-Tag: v16.2.11~103^2~120^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=15c8c1fe39a2fab9161dfff50b3ecc75accdd283;p=ceph.git ceph-volume: adjust arguments for 'ceph-volume raw activate' Take a list of devices, so that we can selectively activate a raw osd with db/wal. Remove the argument type kludge introduced in 2c228a9a409176c0f1679f176443fd3ead219c7a since it is no longer needed. Note that we're making this change because (1) it allows db/wal and (2) because there are no known users of 'raw activate'. The only known user is via 'ceph-volume activate' and we've fixed that caller in this commit. Signed-off-by: Sage Weil (cherry picked from commit afd8be7eac5e996c3bd07656601a4534053e2516) Conflicts: src/ceph-volume/ceph_volume/devices/raw/list.py --- diff --git a/src/ceph-volume/ceph_volume/activate/main.py b/src/ceph-volume/ceph_volume/activate/main.py index 1f8144ab2c501..e1ab4fa2a298e 100644 --- a/src/ceph-volume/ceph_volume/activate/main.py +++ b/src/ceph-volume/ceph_volume/activate/main.py @@ -45,7 +45,7 @@ class Activate(object): # first try raw try: RAWActivate([]).activate( - device=None, + devs=None, start_osd_id=self.args.osd_id, start_osd_uuid=self.args.osd_uuid, tmpfs=not self.args.no_tmpfs, diff --git a/src/ceph-volume/ceph_volume/devices/raw/activate.py b/src/ceph-volume/ceph_volume/devices/raw/activate.py index 2265638509657..17be57dfeaa8e 100644 --- a/src/ceph-volume/ceph_volume/devices/raw/activate.py +++ b/src/ceph-volume/ceph_volume/devices/raw/activate.py @@ -11,7 +11,7 @@ from .list import direct_report logger = logging.getLogger(__name__) -def activate_bluestore(meta, tmpfs, systemd, block_wal=None, block_db=None): +def activate_bluestore(meta, tmpfs, systemd): # find the osd osd_id = meta['osd_id'] osd_uuid = meta['osd_uuid'] @@ -47,14 +47,10 @@ def activate_bluestore(meta, tmpfs, systemd, block_wal=None, block_db=None): # correctly every time prepare_utils.link_block(meta['device'], osd_id) - if block_db: - prepare_utils.link_db(block_db, osd_id, osd_uuid) - elif 'device_db' in meta: + if 'device_db' in meta: prepare_utils.link_db(meta['device_db'], osd_id, osd_uuid) - if block_wal: - prepare_utils.link_wal(block_wal, osd_id, osd_uuid) - elif 'device_wal' in meta: + if 'device_wal' in meta: prepare_utils.link_wal(meta['device_wal'], osd_id, osd_uuid) system.chown(osd_path) @@ -70,13 +66,13 @@ class Activate(object): self.args = None @decorators.needs_root - def activate(self, device, start_osd_id, start_osd_uuid, - tmpfs, systemd, block_wal, block_db): + def activate(self, devs, start_osd_id, start_osd_uuid, + tmpfs, systemd): """ :param args: The parsed arguments coming from the CLI """ - assert device or start_osd_id or start_osd_uuid - found = direct_report(device) + assert devs or start_osd_id or start_osd_uuid + found = direct_report(devs) activated_any = False for osd_uuid, meta in found.items(): @@ -89,9 +85,7 @@ class Activate(object): osd_id, osd_uuid, meta['ceph_fsid'])) activate_bluestore(meta, tmpfs=tmpfs, - systemd=systemd, - block_wal=block_wal, - block_db=block_db) + systemd=systemd) activated_any = True if not activated_any: @@ -99,12 +93,16 @@ class Activate(object): def main(self): sub_command_help = dedent(""" - Activate (BlueStore) OSD on a raw block device based on the + Activate (BlueStore) OSD on a raw block device(s) based on the device label (normally the first block of the device). - ceph-volume raw activate --device /dev/sdb + ceph-volume raw activate [/dev/sdb2 ...] - The device(s) associated with the OSD needs to have been prepared + or + + ceph-volume raw activate --osd-id NUM --osd-uuid UUID + + The device(s) associated with the OSD need to have been prepared previously, so that all needed tags and metadata exist. """) parser = argparse.ArgumentParser( @@ -154,10 +152,15 @@ class Activate(object): if not args.no_systemd: terminal.error('systemd support not yet implemented') raise SystemExit(1) - self.activate(device=args.device, + + devs = [args.device] + if args.block_wal: + devs.append(args.block_wal) + if args.block_db: + devs.append(args.block_db) + + self.activate(devs=devs, start_osd_id=args.osd_id, start_osd_uuid=args.osd_uuid, tmpfs=not args.no_tmpfs, - systemd=not self.args.no_systemd, - block_wal=self.args.block_wal, - block_db=self.args.block_db) + systemd=not self.args.no_systemd)