From 75685e33bfc192f3a3b16ad57b8cd40313bd8bc6 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 17 Apr 2018 20:29:26 -0400 Subject: [PATCH] ceph-volume lvm.activate add --no-systemd flag to skip starting/enabling services Signed-off-by: Alfredo Deza --- .../ceph_volume/devices/lvm/activate.py | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 1c29962118803..897085bde3447 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -15,7 +15,7 @@ from .listing import direct_report logger = logging.getLogger(__name__) -def activate_filestore(lvs): +def activate_filestore(lvs, no_systemd=False): # find the osd osd_lv = lvs.get(lv_tags={'ceph.type': 'data'}) if not osd_lv: @@ -68,11 +68,12 @@ def activate_filestore(lvs): # make sure that the journal has proper permissions system.chown(osd_journal) - # enable the ceph-volume unit for this OSD - systemctl.enable_volume(osd_id, osd_fsid, 'lvm') + if no_systemd is False: + # enable the ceph-volume unit for this OSD + systemctl.enable_volume(osd_id, osd_fsid, 'lvm') - # start the OSD - systemctl.start_osd(osd_id) + # start the OSD + systemctl.start_osd(osd_id) terminal.success("ceph-volume lvm activate successful for osd ID: %s" % osd_id) @@ -109,7 +110,7 @@ def get_osd_device_path(osd_lv, lvs, device_type, dmcrypt_secret=None): return None -def activate_bluestore(lvs): +def activate_bluestore(lvs, no_systemd=False): # find the osd osd_lv = lvs.get(lv_tags={'ceph.type': 'block'}) if not osd_lv: @@ -164,11 +165,12 @@ def activate_bluestore(lvs): process.run(['ln', '-snf', wal_device_path, destination]) system.chown(wal_device_path) - # enable the ceph-volume unit for this OSD - systemctl.enable_volume(osd_id, osd_fsid, 'lvm') + if no_systemd is False: + # enable the ceph-volume unit for this OSD + systemctl.enable_volume(osd_id, osd_fsid, 'lvm') - # start the OSD - systemctl.start_osd(osd_id) + # start the OSD + systemctl.start_osd(osd_id) terminal.success("ceph-volume lvm activate successful for osd ID: %s" % osd_id) @@ -235,9 +237,9 @@ class Activate(object): logger.info('unable to find a journal associated with the OSD, assuming bluestore') return activate_bluestore(lvs) if args.bluestore: - activate_bluestore(lvs) + activate_bluestore(lvs, no_systemd=args.no_systemd) elif args.filestore: - activate_filestore(lvs) + activate_filestore(lvs, no_systemd=args.no_systemd) def main(self): sub_command_help = dedent(""" @@ -294,6 +296,12 @@ class Activate(object): action='store_true', help='Activate all OSDs found in the system', ) + parser.add_argument( + '--no-systemd', + dest='no_systemd', + action='store_true', + help='Skip creating and enabling systemd units and starting OSD services', + ) if len(self.argv) == 0: print(sub_command_help) return -- 2.39.5