1 # -*- coding: utf-8 -*-
5 from ceph_volume
import terminal
6 from ceph_volume
.devices
.lvm
.activate
import Activate
as LVMActivate
7 from ceph_volume
.devices
.raw
.activate
import Activate
as RAWActivate
8 from ceph_volume
.devices
.simple
.activate
import Activate
as SimpleActivate
11 class Activate(object):
13 help = "Activate an OSD"
15 def __init__(self
, argv
):
19 parser
= argparse
.ArgumentParser(
20 prog
='ceph-volume activate',
21 formatter_class
=argparse
.RawDescriptionHelpFormatter
,
22 description
=self
.help,
26 help='OSD ID to activate'
30 help='OSD UUID to active'
36 help='Skip creating and enabling systemd units and starting OSD services'
41 help='Do not use a tmpfs mount for OSD data dir'
43 self
.args
= parser
.parse_args(self
.argv
)
47 RAWActivate([]).activate(
49 start_osd_id
=self
.args
.osd_id
,
50 start_osd_uuid
=self
.args
.osd_uuid
,
51 tmpfs
=not self
.args
.no_tmpfs
,
52 systemd
=not self
.args
.no_systemd
,
57 except Exception as e
:
58 terminal
.info(f
'Failed to activate via raw: {e}')
62 LVMActivate([]).activate(
64 osd_id
=self
.args
.osd_id
,
65 osd_fsid
=self
.args
.osd_uuid
,
66 no_tmpfs
=self
.args
.no_tmpfs
,
67 no_systemd
=self
.args
.no_systemd
,
71 except Exception as e
:
72 terminal
.info(f
'Failed to activate via lvm: {e}')
76 SimpleActivate([]).activate(
78 osd_id
=self
.args
.osd_id
,
79 osd_fsid
=self
.args
.osd_uuid
,
80 no_systemd
=self
.args
.no_systemd
,
84 except Exception as e
:
85 terminal
.info(f
'Failed to activate via simple: {e}')
87 terminal
.error('Failed to activate any OSD(s)')