--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
-# 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
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
%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 \
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}
%{_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
--- /dev/null
+CLUSTER=ceph
--- /dev/null
+[Unit]
+Description=ceph target allowing to start/stop all ceph*@.service instances at once
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+d /var/run/ceph 0755 root root -
--- /dev/null
+#! /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
+