]> git.pld-linux.org Git - packages/ceph.git/commitdiff
systemd files added from the upstream repo
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Tue, 5 May 2015 08:42:52 +0000 (10:42 +0200)
committerJacek Konieczny <j.konieczny@eggsoft.pl>
Tue, 5 May 2015 13:29:40 +0000 (15:29 +0200)
ceph-mds@.service [new file with mode: 0644]
ceph-mon@.service [new file with mode: 0644]
ceph-osd@.service [new file with mode: 0644]
ceph.spec
ceph.sysconfig [new file with mode: 0644]
ceph.target [new file with mode: 0644]
ceph.tmpfiles [new file with mode: 0644]
cephctl [new file with mode: 0644]

diff --git a/ceph-mds@.service b/ceph-mds@.service
new file mode 100644 (file)
index 0000000..22a787d
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Ceph metadata server daemon
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/ceph
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i
+
+[Install]
+WantedBy=ceph.target
diff --git a/ceph-mon@.service b/ceph-mon@.service
new file mode 100644 (file)
index 0000000..c3d2609
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=Ceph cluster monitor daemon
+After=network-online.target
+Wants=network-online.target
+
+# According to:
+#   http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+# these can be removed once ceph-mon will dynamically change network
+# configuration.
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/ceph
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i
+
+[Install]
+WantedBy=ceph.target
diff --git a/ceph-osd@.service b/ceph-osd@.service
new file mode 100644 (file)
index 0000000..c12b56c
--- /dev/null
@@ -0,0 +1,15 @@
+[Unit]
+Description=Ceph object storage daemon
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/ceph
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i
+ExecStartPre=/usr/libexec/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i
+LimitNOFILE=131072
+
+[Install]
+WantedBy=ceph.target
index 84b97fbefc8761170c69b5f16fe504957b94761f..1893c73268ee1be194d95b69f66880f19440d43b 100644 (file)
--- a/ceph.spec
+++ b/ceph.spec
@@ -1,4 +1,8 @@
-# TODO: accelio libxio (BR: accelio libibverbs-devel librdmacm-devel
+# TODO:
+#      - accelio libxio (BR: accelio libibverbs-devel librdmacm-devel
+#      - proper init scripts if non-systemd boot is too be supported
+#         (upstream scripts seem overcomplicated and hardly useful)
+#
 #
 # Conditional build:
 %bcond_without java            # Java binding
@@ -22,6 +26,14 @@ License:     LGPL v2.1 (libraries), GPL v2 (some programs)
 Group:         Base
 Source0:       http://ceph.com/download/%{name}-%{version}.tar.bz2
 # Source0-md5: e4a625aa2c91fe5d3f0c62faa4716ca2
+Source1:       ceph.sysconfig
+# based on files from https://github.com/ceph/ceph/tree/master/systemd
+Source10:      cephctl
+Source11:      ceph-mds@.service
+Source12:      ceph-mon@.service
+Source13:      ceph-osd@.service
+Source14:      ceph.target
+Source15:      ceph.tmpfiles
 Patch0:                %{name}-init-fix.patch
 Patch1:                %{name}.logrotate.patch
 Patch2:                %{name}-link.patch
@@ -232,8 +244,9 @@ Agenci OCF do monitorowania procesów Cepha.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_localstatedir}/{lib/ceph/tmp,log/ceph/stat} \
-       $RPM_BUILD_ROOT%{_sysconfdir}/{ceph,bash_completion.d,logrotate.d,rc.d/init.d}
+install -d $RPM_BUILD_ROOT%{_localstatedir}/{lib/ceph/{tmp,mon,osd,mds},log/ceph/stat} \
+       $RPM_BUILD_ROOT%{_sysconfdir}/{ceph,bash_completion.d,logrotate.d,rc.d/init.d} \
+       $RPM_BUILD_ROOT{%{systemdunitdir},%{systemdtmpfilesdir}}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT \
@@ -242,6 +255,11 @@ install -d $RPM_BUILD_ROOT%{_localstatedir}/{lib/ceph/tmp,log/ceph/stat} \
 install -p src/init-ceph $RPM_BUILD_ROOT/etc/rc.d/init.d/ceph
 install -p src/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ceph
 
+install %{SOURCE10} $RPM_BUILD_ROOT%{_bindir}
+install %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} $RPM_BUILD_ROOT%{systemdunitdir}
+ln -sf /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/ceph.service
+install %{SOURCE15} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/ceph.conf
+
 # loadable modules
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/ceph/erasure-code/*.{a,la}
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/rados-classes/*.{a,la}
@@ -396,6 +414,9 @@ fi
 %{_mandir}/man8/rbd-replay-prep.8*
 
 %dir %{_localstatedir}/lib/ceph
+%dir %{_localstatedir}/lib/ceph/mds
+%dir %{_localstatedir}/lib/ceph/mon
+%dir %{_localstatedir}/lib/ceph/osd
 %dir %{_localstatedir}/lib/ceph/tmp
 %dir %{_localstatedir}/log/ceph
 
diff --git a/ceph.sysconfig b/ceph.sysconfig
new file mode 100644 (file)
index 0000000..fdada30
--- /dev/null
@@ -0,0 +1 @@
+CLUSTER=ceph
diff --git a/ceph.target b/ceph.target
new file mode 100644 (file)
index 0000000..60734ba
--- /dev/null
@@ -0,0 +1,4 @@
+[Unit]
+Description=ceph target allowing to start/stop all ceph*@.service instances at once
+[Install]
+WantedBy=multi-user.target
diff --git a/ceph.tmpfiles b/ceph.tmpfiles
new file mode 100644 (file)
index 0000000..871de33
--- /dev/null
@@ -0,0 +1 @@
+d /var/run/ceph 0755 root root -
diff --git a/cephctl b/cephctl
new file mode 100644 (file)
index 0000000..e60dec6
--- /dev/null
+++ b/cephctl
@@ -0,0 +1,66 @@
+#! /bin/bash
+
+### BEGIN INIT INFO
+# Provides:       ceph ceph-mon ceph-osd
+# Required-Start: $network $remote_fs
+# Required-Stop:  $network $remote_fs
+# Should-Start: network-remotefs
+# Should-Stop: network-remotefs
+# Default-Start:  3 5
+# Default-Stop:   0 1 2 6
+# Short-Description: Ceph is a distributed object, and block, storage platform
+# Description:    Ceph is a distributed object, block, and file storage platform
+### END INIT INFO
+
+SYSTEMD_NO_WRAP=1 . /etc/rc.status
+rc_reset
+
+action=$1 ; shift
+cluster="ceph"
+config=$1 ; shift
+
+# Shared variables by many actions
+dir_mon="/var/lib/ceph/mon/"
+dir_osd="/var/lib/ceph/osd/"
+if test -d ${dir_mon} ; then
+lmon=`ls ${dir_mon} | grep ${cluster}`
+fi
+if test -d ${dir_osd} ; then
+losd=`ls ${dir_osd} | grep ${cluster}`
+fi
+prefix="${cluster}-"
+
+if test -n "$config" ; then
+       systemctl "${action}" "ceph-mon@${config}.service"
+else
+       case $action in
+    start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed  )
+        n=0
+        if test -n ${lmon} ; then
+            for s in ${lmon#=${prefix}} ; do
+                systemctl "${action}" ceph-mon@${s#$prefix}.service
+                rc_check
+                ((++n))
+            done
+        fi
+        if test -n ${lmon} ; then
+            for s in ${losd#=${prefix}} ; do
+                systemctl "${action}" ceph-osd@${s#$prefix}.service
+                rc_check
+                ((++n))
+            done
+        fi
+        if test $n -gt 0 ; then
+                       rc_status
+               else
+                       rc_status -u
+               fi
+    ;;
+       *)
+               echo "Invalid paramter : $action"
+        echo "Valid paramters  : start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed"
+       ;;
+       esac
+fi
+rc_exit
+
This page took 0.163005 seconds and 4 git commands to generate.