summaryrefslogtreecommitdiffstats
path: root/src/ceph-volume/ceph_volume/activate/main.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/ceph-volume/ceph_volume/activate/main.py
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ceph-volume/ceph_volume/activate/main.py')
-rw-r--r--src/ceph-volume/ceph_volume/activate/main.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/ceph-volume/ceph_volume/activate/main.py b/src/ceph-volume/ceph_volume/activate/main.py
new file mode 100644
index 000000000..bcd468515
--- /dev/null
+++ b/src/ceph-volume/ceph_volume/activate/main.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+
+import argparse
+
+from ceph_volume import terminal
+from ceph_volume.devices.lvm.activate import Activate as LVMActivate
+from ceph_volume.devices.raw.activate import Activate as RAWActivate
+from ceph_volume.devices.simple.activate import Activate as SimpleActivate
+
+
+class Activate(object):
+
+ help = "Activate an OSD"
+
+ def __init__(self, argv):
+ self.argv = argv
+
+ def main(self):
+ parser = argparse.ArgumentParser(
+ prog='ceph-volume activate',
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ description=self.help,
+ )
+ parser.add_argument(
+ '--osd-id',
+ help='OSD ID to activate'
+ )
+ parser.add_argument(
+ '--osd-uuid',
+ help='OSD UUID to active'
+ )
+ parser.add_argument(
+ '--no-systemd',
+ dest='no_systemd',
+ action='store_true',
+ help='Skip creating and enabling systemd units and starting OSD services'
+ )
+ parser.add_argument(
+ '--no-tmpfs',
+ action='store_true',
+ help='Do not use a tmpfs mount for OSD data dir'
+ )
+ self.args = parser.parse_args(self.argv)
+
+ # first try raw
+ try:
+ RAWActivate([]).activate(
+ devs=None,
+ start_osd_id=self.args.osd_id,
+ start_osd_uuid=self.args.osd_uuid,
+ tmpfs=not self.args.no_tmpfs,
+ systemd=not self.args.no_systemd,
+ )
+ return
+ except Exception as e:
+ terminal.info(f'Failed to activate via raw: {e}')
+
+ # then try lvm
+ try:
+ LVMActivate([]).activate(
+ argparse.Namespace(
+ osd_id=self.args.osd_id,
+ osd_fsid=self.args.osd_uuid,
+ no_tmpfs=self.args.no_tmpfs,
+ no_systemd=self.args.no_systemd,
+ )
+ )
+ return
+ except Exception as e:
+ terminal.info(f'Failed to activate via lvm: {e}')
+
+ # then try simple
+ try:
+ SimpleActivate([]).activate(
+ argparse.Namespace(
+ osd_id=self.args.osd_id,
+ osd_fsid=self.args.osd_uuid,
+ no_systemd=self.args.no_systemd,
+ )
+ )
+ return
+ except Exception as e:
+ terminal.info(f'Failed to activate via simple: {e}')
+
+ terminal.error('Failed to activate any OSD(s)')