]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: adjust arguments for 'ceph-volume raw activate'
authorSage Weil <sage@newdream.net>
Sat, 20 Nov 2021 15:19:36 +0000 (10:19 -0500)
committerAdam King <adking@redhat.com>
Thu, 2 Jun 2022 21:58:01 +0000 (17:58 -0400)
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 <sage@newdream.net>
(cherry picked from commit afd8be7eac5e996c3bd07656601a4534053e2516)

Conflicts:
src/ceph-volume/ceph_volume/devices/raw/list.py

src/ceph-volume/ceph_volume/activate/main.py
src/ceph-volume/ceph_volume/devices/raw/activate.py

index 1f8144ab2c50176948eb67b1c50d0086a3209028..e1ab4fa2a298ef17feb951e62de333f034a96c47 100644 (file)
@@ -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,
index 226563850965736fd8decb0b718bc868477c0be9..17be57dfeaa8ee75f7cef51bd2c6907536ad35a3 100644 (file)
@@ -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)