[packages/ceph] systemd files added from the upstream repo

jajcus jajcus at pld-linux.org
Tue May 12 15:21:31 CEST 2015


commit b6163d67e17953c9a020ff341441d045040c100a
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Tue May 5 10:42:52 2015 +0200

    systemd files added from the upstream repo

 ceph-mds at .service | 13 +++++++++++
 ceph-mon at .service | 20 +++++++++++++++++
 ceph-osd at .service | 15 +++++++++++++
 ceph.spec         | 27 ++++++++++++++++++++---
 ceph.sysconfig    |  1 +
 ceph.target       |  4 ++++
 ceph.tmpfiles     |  1 +
 cephctl           | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 144 insertions(+), 3 deletions(-)
---
diff --git a/ceph.spec b/ceph.spec
index 84b97fb..1893c73 100644
--- 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 at .service
+Source12:	ceph-mon at .service
+Source13:	ceph-osd at .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-mds at .service b/ceph-mds at .service
new file mode 100644
index 0000000..22a787d
--- /dev/null
+++ b/ceph-mds at .service
@@ -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 at .service b/ceph-mon at .service
new file mode 100644
index 0000000..c3d2609
--- /dev/null
+++ b/ceph-mon at .service
@@ -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 at .service b/ceph-osd at .service
new file mode 100644
index 0000000..c12b56c
--- /dev/null
+++ b/ceph-osd at .service
@@ -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
diff --git a/ceph.sysconfig b/ceph.sysconfig
new file mode 100644
index 0000000..fdada30
--- /dev/null
+++ b/ceph.sysconfig
@@ -0,0 +1 @@
+CLUSTER=ceph
diff --git a/ceph.target b/ceph.target
new file mode 100644
index 0000000..60734ba
--- /dev/null
+++ b/ceph.target
@@ -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
index 0000000..871de33
--- /dev/null
+++ b/ceph.tmpfiles
@@ -0,0 +1 @@
+d /var/run/ceph 0755 root root -
diff --git a/cephctl b/cephctl
new file mode 100644
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
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ceph.git/commitdiff/bef2a0adcd4524aa642815f98eacbec842270e2a



More information about the pld-cvs-commit mailing list