diff options
Diffstat (limited to 'src/ceph/systemd')
22 files changed, 345 insertions, 0 deletions
diff --git a/src/ceph/systemd/50-ceph.preset b/src/ceph/systemd/50-ceph.preset new file mode 100644 index 0000000..34c0801 --- /dev/null +++ b/src/ceph/systemd/50-ceph.preset @@ -0,0 +1,6 @@ +enable ceph.target +enable ceph-mds.target +enable ceph-mgr.target +enable ceph-mon.target +enable ceph-osd.target +enable ceph-radosgw.target diff --git a/src/ceph/systemd/CMakeLists.txt b/src/ceph/systemd/CMakeLists.txt new file mode 100644 index 0000000..3b03b6e --- /dev/null +++ b/src/ceph/systemd/CMakeLists.txt @@ -0,0 +1,20 @@ +install(FILES + ceph.target + ceph-fuse.target + ceph-osd.target + ceph-mgr.target + ceph-mon.target + ceph-mds.target + ceph-radosgw.target + ceph-rbd-mirror.target + ceph-fuse@.service + ceph-mds@.service + ceph-mgr@.service + ceph-mon@.service + ceph-osd@.service + ceph-radosgw@.service + ceph-rbd-mirror@.service + ceph-disk@.service + ceph-volume@.service + rbdmap.service + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/systemd/system) diff --git a/src/ceph/systemd/ceph b/src/ceph/systemd/ceph new file mode 100644 index 0000000..6a69271 --- /dev/null +++ b/src/ceph/systemd/ceph @@ -0,0 +1,65 @@ +#! /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 + +# default cluster name to "ceph" +cluster="ceph" + +# 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}-" + +case $action in start | stop | status | enable | disable | mask | unmask | 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 "${losd}" ; 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 + systemctl "${action}" ceph.target + rc_check +;; +*) + echo "Invalid parameter : $action" + echo "Valid parameters : start | stop | status | enable | disable | mask | unmask | restart | is-active | is-failed | show | kill | reset-failed" +;; +esac + +rc_exit + diff --git a/src/ceph/systemd/ceph-disk@.service b/src/ceph/systemd/ceph-disk@.service new file mode 100644 index 0000000..1fdf2af --- /dev/null +++ b/src/ceph/systemd/ceph-disk@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Ceph disk activation: %f +After=local-fs.target +Wants=local-fs.target + +[Service] +Type=oneshot +KillMode=none +Environment=CEPH_DISK_TIMEOUT=10000 +ExecStart=/bin/sh -c 'timeout $CEPH_DISK_TIMEOUT flock /var/lock/ceph-disk-$(basename %f) /usr/sbin/ceph-disk --verbose --log-stdout trigger --sync %f' +TimeoutSec=0 diff --git a/src/ceph/systemd/ceph-fuse.target b/src/ceph/systemd/ceph-fuse.target new file mode 100644 index 0000000..70f5cb6 --- /dev/null +++ b/src/ceph/systemd/ceph-fuse.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-fuse@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=remote-fs.target ceph.target diff --git a/src/ceph/systemd/ceph-fuse@.service b/src/ceph/systemd/ceph-fuse@.service new file mode 100644 index 0000000..9898244 --- /dev/null +++ b/src/ceph/systemd/ceph-fuse@.service @@ -0,0 +1,18 @@ +[Unit] +Description=Ceph FUSE client +After=network-online.target local-fs.target time-sync.target +Wants=network-online.target local-fs.target time-sync.target +Conflicts=umount.target +PartOf=ceph-fuse.target + +[Service] +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/ceph-fuse -f --cluster ${CLUSTER} %I +TasksMax=infinity +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=3 + +[Install] +WantedBy=ceph-fuse.target diff --git a/src/ceph/systemd/ceph-mds.target b/src/ceph/systemd/ceph-mds.target new file mode 100644 index 0000000..238f3ab --- /dev/null +++ b/src/ceph/systemd/ceph-mds.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-mds@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-mds@.service b/src/ceph/systemd/ceph-mds@.service new file mode 100644 index 0000000..d34bd05 --- /dev/null +++ b/src/ceph/systemd/ceph-mds@.service @@ -0,0 +1,24 @@ +[Unit] +Description=Ceph metadata server daemon +After=network-online.target local-fs.target time-sync.target +Wants=network-online.target local-fs.target time-sync.target +PartOf=ceph-mds.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph +ExecReload=/bin/kill -HUP $MAINPID +PrivateDevices=yes +ProtectHome=true +ProtectSystem=full +PrivateTmp=true +TasksMax=infinity +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=3 + +[Install] +WantedBy=ceph-mds.target diff --git a/src/ceph/systemd/ceph-mgr.target b/src/ceph/systemd/ceph-mgr.target new file mode 100644 index 0000000..f25e494 --- /dev/null +++ b/src/ceph/systemd/ceph-mgr.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-mgr@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-mgr@.service b/src/ceph/systemd/ceph-mgr@.service new file mode 100644 index 0000000..6614e54 --- /dev/null +++ b/src/ceph/systemd/ceph-mgr@.service @@ -0,0 +1,20 @@ +[Unit] +Description=Ceph cluster manager daemon +After=network-online.target local-fs.target time-sync.target +Wants=network-online.target local-fs.target time-sync.target +PartOf=ceph-mgr.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph + +ExecStart=/usr/bin/ceph-mgr -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=3 + +[Install] +WantedBy=ceph-mgr.target diff --git a/src/ceph/systemd/ceph-mon.target b/src/ceph/systemd/ceph-mon.target new file mode 100644 index 0000000..097c83b --- /dev/null +++ b/src/ceph/systemd/ceph-mon.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-mon@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-mon@.service b/src/ceph/systemd/ceph-mon@.service new file mode 100644 index 0000000..db4995f --- /dev/null +++ b/src/ceph/systemd/ceph-mon@.service @@ -0,0 +1,31 @@ +[Unit] +Description=Ceph cluster monitor daemon + +# 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 time-sync.target +Wants=network-online.target local-fs.target time-sync.target + +PartOf=ceph-mon.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph +ExecReload=/bin/kill -HUP $MAINPID +PrivateDevices=yes +ProtectHome=true +ProtectSystem=full +PrivateTmp=true +TasksMax=infinity +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=5 +RestartSec=10 + +[Install] +WantedBy=ceph-mon.target diff --git a/src/ceph/systemd/ceph-osd.target b/src/ceph/systemd/ceph-osd.target new file mode 100644 index 0000000..7f677f5 --- /dev/null +++ b/src/ceph/systemd/ceph-osd.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-osd@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-osd@.service b/src/ceph/systemd/ceph-osd@.service new file mode 100644 index 0000000..0a43ee1 --- /dev/null +++ b/src/ceph/systemd/ceph-osd@.service @@ -0,0 +1,25 @@ +[Unit] +Description=Ceph object storage daemon osd.%i +After=network-online.target local-fs.target time-sync.target ceph-mon.target +Wants=network-online.target local-fs.target time-sync.target +PartOf=ceph-osd.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph +ExecStartPre=/usr/lib/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i +ExecReload=/bin/kill -HUP $MAINPID +ProtectHome=true +ProtectSystem=full +PrivateTmp=true +TasksMax=infinity +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=30 +RestartSec=20s + +[Install] +WantedBy=ceph-osd.target diff --git a/src/ceph/systemd/ceph-radosgw.target b/src/ceph/systemd/ceph-radosgw.target new file mode 100644 index 0000000..1799e29 --- /dev/null +++ b/src/ceph/systemd/ceph-radosgw.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-radosgw@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-radosgw@.service b/src/ceph/systemd/ceph-radosgw@.service new file mode 100644 index 0000000..3f7fcac --- /dev/null +++ b/src/ceph/systemd/ceph-radosgw@.service @@ -0,0 +1,23 @@ +[Unit] +Description=Ceph rados gateway +After=network-online.target local-fs.target time-sync.target +Wants=network-online.target local-fs.target time-sync.target +PartOf=ceph-radosgw.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/radosgw -f --cluster ${CLUSTER} --name client.%i --setuser ceph --setgroup ceph +PrivateDevices=yes +ProtectHome=true +ProtectSystem=full +PrivateTmp=true +TasksMax=infinity +Restart=on-failure +StartLimitInterval=30s +StartLimitBurst=5 + +[Install] +WantedBy=ceph-radosgw.target diff --git a/src/ceph/systemd/ceph-rbd-mirror.target b/src/ceph/systemd/ceph-rbd-mirror.target new file mode 100644 index 0000000..43e9a4c --- /dev/null +++ b/src/ceph/systemd/ceph-rbd-mirror.target @@ -0,0 +1,6 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-rbd-mirror@.service instances at once +PartOf=ceph.target +Before=ceph.target +[Install] +WantedBy=multi-user.target ceph.target diff --git a/src/ceph/systemd/ceph-rbd-mirror@.service b/src/ceph/systemd/ceph-rbd-mirror@.service new file mode 100644 index 0000000..17fd738 --- /dev/null +++ b/src/ceph/systemd/ceph-rbd-mirror@.service @@ -0,0 +1,24 @@ +[Unit] +Description=Ceph rbd mirror daemon +After=network-online.target local-fs.target +Wants=network-online.target local-fs.target +PartOf=ceph-rbd-mirror.target + +[Service] +LimitNOFILE=1048576 +LimitNPROC=1048576 +EnvironmentFile=-/etc/sysconfig/ceph +Environment=CLUSTER=ceph +ExecStart=/usr/bin/rbd-mirror -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph +ExecReload=/bin/kill -HUP $MAINPID +PrivateDevices=yes +ProtectHome=true +ProtectSystem=full +PrivateTmp=true +Restart=on-failure +StartLimitInterval=30min +StartLimitBurst=3 +TasksMax=infinity + +[Install] +WantedBy=ceph-rbd-mirror.target diff --git a/src/ceph/systemd/ceph-volume@.service b/src/ceph/systemd/ceph-volume@.service new file mode 100644 index 0000000..c21002c --- /dev/null +++ b/src/ceph/systemd/ceph-volume@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Ceph Volume activation: %i +After=local-fs.target +Wants=local-fs.target + +[Service] +Type=oneshot +KillMode=none +Environment=CEPH_VOLUME_TIMEOUT=10000 +ExecStart=/bin/sh -c 'timeout $CEPH_VOLUME_TIMEOUT /usr/sbin/ceph-volume-systemd %i' +TimeoutSec=0 + +[Install] +WantedBy=multi-user.target diff --git a/src/ceph/systemd/ceph.target b/src/ceph/systemd/ceph.target new file mode 100644 index 0000000..60734ba --- /dev/null +++ b/src/ceph/systemd/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/src/ceph/systemd/ceph.tmpfiles.d b/src/ceph/systemd/ceph.tmpfiles.d new file mode 100644 index 0000000..2ded82f --- /dev/null +++ b/src/ceph/systemd/ceph.tmpfiles.d @@ -0,0 +1 @@ +d /run/ceph 0770 ceph ceph - diff --git a/src/ceph/systemd/rbdmap.service b/src/ceph/systemd/rbdmap.service new file mode 100644 index 0000000..15e64ab --- /dev/null +++ b/src/ceph/systemd/rbdmap.service @@ -0,0 +1,17 @@ +[Unit] +Description=Map RBD devices + +After=network-online.target local-fs.target +Wants=network-online.target local-fs.target + +[Service] +EnvironmentFile=-/etc/sysconfig/ceph +Environment=RBDMAPFILE=/etc/ceph/rbdmap +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/rbdmap map +ExecReload=/usr/bin/rbdmap map +ExecStop=/usr/bin/rbdmap unmap-all + +[Install] +WantedBy=multi-user.target |