]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume lvm.activate add --no-systemd flag to skip starting/enabling services
authorAlfredo Deza <adeza@redhat.com>
Wed, 18 Apr 2018 00:29:26 +0000 (20:29 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 18 Apr 2018 14:07:23 +0000 (10:07 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/activate.py

index 1c29962118803d9f0b119c11e8cd9d4f4ece94e7..897085bde3447425c24b49cad6f421ed340e581d 100644 (file)
@@ -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