From: Alfredo Deza Date: Thu, 8 Nov 2018 14:13:31 +0000 (-0500) Subject: ceph-volume simple.activate allow a --no-systemd flag to skip systemctl actions X-Git-Tag: v14.1.0~950^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4d9ad0d3d4bedd5efa95653fbb86607f0b469174;p=ceph-ci.git ceph-volume simple.activate allow a --no-systemd flag to skip systemctl actions Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/devices/simple/activate.py b/src/ceph-volume/ceph_volume/devices/simple/activate.py index a429018bfc0..b3e781f1653 100644 --- a/src/ceph-volume/ceph_volume/devices/simple/activate.py +++ b/src/ceph-volume/ceph_volume/devices/simple/activate.py @@ -19,9 +19,10 @@ class Activate(object): help = 'Enable systemd units to mount configured devices and start a Ceph OSD' - def __init__(self, argv, systemd=False): + def __init__(self, argv, from_trigger=False): self.argv = argv - self.systemd = systemd + self.from_trigger = from_trigger + self.skip_systemd = False def validate_devices(self, json_config): """ @@ -148,24 +149,33 @@ class Activate(object): # make sure that the journal has proper permissions system.chown(device) - if not self.systemd: + if not self.from_trigger and not self.skip_systemd: + # means it was scanned and now activated directly, so ensure that + # ceph-disk units are disabled, and that the `simple` systemd unit + # is created and enabled + # enable the ceph-volume unit for this OSD systemctl.enable_volume(osd_id, osd_fsid, 'simple') # disable any/all ceph-disk units systemctl.mask_ceph_disk() + terminal.warning( + ('All ceph-disk systemd units have been disabled to ' + 'prevent OSDs getting triggered by UDEV events') + ) - # enable the OSD - systemctl.enable_osd(osd_id) + if not self.skip_systemd: + # enable the OSD + systemctl.enable_osd(osd_id) - # start the OSD - systemctl.start_osd(osd_id) + # start the OSD + systemctl.start_osd(osd_id) + else: + terminal.info( + 'Skipping enabling and starting OSD simple systemd unit because --no-systemd was used' + ) terminal.success('Successfully activated OSD %s with FSID %s' % (osd_id, osd_fsid)) - terminal.warning( - ('All ceph-disk systemd units have been disabled to ' - 'prevent OSDs getting triggered by UDEV events') - ) def main(self): sub_command_help = dedent(""" @@ -211,6 +221,12 @@ class Activate(object): '--file', help='The path to a JSON file, from a scanned OSD' ) + parser.add_argument( + '--no-systemd', + dest='skip_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 @@ -232,4 +248,5 @@ class Activate(object): if not os.path.exists(json_config): raise RuntimeError('Expected JSON config path not found: %s' % json_config) args.json_config = json_config + self.skip_systemd = args.skip_systemd self.activate(args)