From: Alfredo Deza Date: Wed, 18 Apr 2018 00:29:26 +0000 (-0400) Subject: ceph-volume lvm.activate add --no-systemd flag to skip starting/enabling services X-Git-Tag: v12.2.5~4^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F21538%2Fhead;p=ceph.git ceph-volume lvm.activate add --no-systemd flag to skip starting/enabling services Signed-off-by: Alfredo Deza (cherry picked from commit 75685e33bfc192f3a3b16ad57b8cd40313bd8bc6) --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index be813f8319fb..37ec6fb7267a 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: @@ -70,11 +70,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) @@ -111,7 +112,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: @@ -166,11 +167,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) @@ -237,10 +239,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) - terminal.success("ceph-volume lvm activate successful for osd ID: %s" % args.osd_id) + activate_filestore(lvs, no_systemd=args.no_systemd) def main(self): sub_command_help = dedent(""" @@ -297,6 +298,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