]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
hosts/fedora: systemd only for fc22 or later wip-systemd-fchack
authorSage Weil <sage@redhat.com>
Tue, 4 Aug 2015 17:30:50 +0000 (13:30 -0400)
committerSage Weil <sage@redhat.com>
Tue, 4 Aug 2015 17:30:50 +0000 (13:30 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
ceph_deploy/hosts/fedora/__init__.py
ceph_deploy/hosts/fedora/mon/create.py

index 05f219294214e35750a20d2cd35e9ac201762059..d3ac8d9904ceae199ca882228f159fb997b04cec 100644 (file)
@@ -18,7 +18,10 @@ def choose_init():
 
     Returns the name of a init system (upstart, sysvinit ...).
     """
-    return 'systemd'
+    if module.normalized_release.int_major >= 22:
+        return 'systemd'
+    else:
+        return 'sysvinit'
 
 
 def get_packager(module):
index 139e00e1c590cd2e3562b1ffcbf84fd86364e9d2..00eb7f987ec98effbb536ce4c763d637bddfa963 100644 (file)
@@ -6,33 +6,50 @@ def create(distro, args, monitor_keyring):
     hostname = distro.conn.remote_module.shortname()
     common.mon_create(distro, args, monitor_keyring, hostname)
 
-    # enable ceph target for this host (in case it isn't already enabled)
-    remoto.process.run(
-        distro.conn,
-        [
-            'systemctl',
-            'enable',
-            'ceph.target'
-        ],
-        timeout=7,
-    )
+    init = choose_init()
+    if init == 'systemd':
+        # enable ceph target for this host (in case it isn't already enabled)
+        remoto.process.run(
+            distro.conn,
+            [
+                'systemctl',
+                'enable',
+                'ceph.target'
+            ],
+            timeout=7,
+        )
 
-    # enable and start this mon instance
-    remoto.process.run(
-        distro.conn,
-        [
-            'systemctl',
-            'enable',
-            'ceph-mon@{hostname}'.format(hostname=hostname),
-        ],
-        timeout=7,
-    )
-    remoto.process.run(
-        distro.conn,
-        [
-            'systemctl',
-            'start',
-            'ceph-mon@{hostname}'.format(hostname=hostname),
-        ],
-        timeout=7,
-    )
+        # enable and start this mon instance
+        remoto.process.run(
+            distro.conn,
+            [
+                'systemctl',
+                'enable',
+                'ceph-mon@{hostname}'.format(hostname=hostname),
+            ],
+            timeout=7,
+        )
+        remoto.process.run(
+            distro.conn,
+            [
+                'systemctl',
+                'start',
+                'ceph-mon@{hostname}'.format(hostname=hostname),
+            ],
+            timeout=7,
+        )
+
+    elif init == 'sysvinit':
+        service = distro.conn.remote_module.which_service()
+        remoto.process.run(
+            distro.conn,
+            [
+                service,
+                'ceph',
+                '-c',
+                '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
+                'start',
+                'mon.{hostname}'.format(hostname=hostname)
+            ],
+            timeout=7,
+        )