diff options
author | Venky Shankar <vshankar@redhat.com> | 2020-12-11 07:47:48 +0100 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2021-01-12 11:57:32 +0100 |
commit | 1227752983fcb27d940dec2c335edb3b7375b696 (patch) | |
tree | b60d65abb1abae0f51b6a3d9cb16f1608ecdf8a3 | |
parent | doc, man: man page for `cephfs-mirror` tool (diff) | |
download | ceph-1227752983fcb27d940dec2c335edb3b7375b696.tar.xz ceph-1227752983fcb27d940dec2c335edb3b7375b696.zip |
systemd: cephfs-mirror systemd unit files
Signed-off-by: Venky Shankar <vshankar@redhat.com>
-rw-r--r-- | ceph.spec.in | 37 | ||||
-rw-r--r-- | systemd/50-ceph.preset | 1 | ||||
-rw-r--r-- | systemd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | systemd/cephfs-mirror.target | 7 | ||||
-rw-r--r-- | systemd/cephfs-mirror@.service.in | 33 |
5 files changed, 80 insertions, 0 deletions
diff --git a/ceph.spec.in b/ceph.spec.in index 08088888347..c11b1b76c27 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -1811,6 +1811,43 @@ fi %files -n cephfs-mirror %{_bindir}/cephfs-mirror %{_mandir}/man8/cephfs-mirror.8* +%{_unitdir}/cephfs-mirror@.service +%{_unitdir}/cephfs-mirror.target + +%post -n cephfs-mirror +%if 0%{?suse_version} +if [ $1 -eq 1 ] ; then + /usr/bin/systemctl preset cephfs-mirror@\*.service cephfs-mirror.target >/dev/null 2>&1 || : +fi +%endif +%if 0%{?fedora} || 0%{?rhel} +%systemd_post cephfs-mirror@\*.service cephfs-mirror.target +%endif +if [ $1 -eq 1 ] ; then +/usr/bin/systemctl start cephfs-mirror.target >/dev/null 2>&1 || : +fi + +%preun -n cephfs-mirror +%if 0%{?suse_version} +%service_del_preun cephfs-mirror@\*.service cephfs-mirror.target +%endif +%if 0%{?fedora} || 0%{?rhel} +%systemd_preun cephfs-mirror@\*.service cephfs-mirror.target +%endif + +%postun -n cephfs-mirror +%systemd_postun cephfs-mirror@\*.service cephfs-mirror.target +if [ $1 -ge 1 ] ; then + # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to + # "yes". In any case: if units are not running, do not touch them. + SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph + if [ -f $SYSCONF_CEPH -a -r $SYSCONF_CEPH ] ; then + source $SYSCONF_CEPH + fi + if [ "X$CEPH_AUTO_RESTART_ON_UPGRADE" = "Xyes" ] ; then + /usr/bin/systemctl try-restart cephfs-mirror@\*.service > /dev/null 2>&1 || : + fi +fi %files -n rbd-fuse %{_bindir}/rbd-fuse diff --git a/systemd/50-ceph.preset b/systemd/50-ceph.preset index ca8f4d2c6f6..a7fc5f129ba 100644 --- a/systemd/50-ceph.preset +++ b/systemd/50-ceph.preset @@ -6,3 +6,4 @@ enable ceph-osd.target enable ceph-rbd-mirror.target enable ceph-radosgw.target enable ceph-crash.service +enable cephfs-mirror.target diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index 43adf7be142..499b5d19024 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -13,6 +13,7 @@ foreach(service ceph-radosgw@ ceph-rbd-mirror@ ceph-immutable-object-cache@ + cephfs-mirror@ rbdmap) configure_file( ${service}.service.in @@ -34,4 +35,5 @@ install(FILES ceph-rbd-mirror.target ceph-immutable-object-cache.target ceph-volume@.service + cephfs-mirror.target DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}) diff --git a/systemd/cephfs-mirror.target b/systemd/cephfs-mirror.target new file mode 100644 index 00000000000..e2296dc5c32 --- /dev/null +++ b/systemd/cephfs-mirror.target @@ -0,0 +1,7 @@ +[Unit] +Description=Ceph target to start/stop all cephfs-mirror@.service instances +PartOf=ceph.target +Before=ceph.target + +[Install] +WantedBy=multi-user.target ceph.target
\ No newline at end of file diff --git a/systemd/cephfs-mirror@.service.in b/systemd/cephfs-mirror@.service.in new file mode 100644 index 00000000000..a97d6ad8b57 --- /dev/null +++ b/systemd/cephfs-mirror@.service.in @@ -0,0 +1,33 @@ +[Unit] +Description=CephFS Mirror Daemon +After=network-online.target local-fs.target +Wants=network-online.target local-fs.target +PartOf=cephfs-mirror.target + +[Service] +Environment=CLUSTER=ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ +ExecStart=/usr/bin/cephfs-mirror --id %i --cluster ${CLUSTER} -f --setuser ceph --setgroup ceph +LimitNOFILE=1048576 +LimitNPROC=1048576 +LockPersonality=true +MemoryDenyWriteExecute=true +NoNewPrivileges=true +PrivateDevices=yes +PrivateTmp=true +ProtectClock=true +ProtectControlGroups=true +ProtectHome=true +ProtectHostname=true +ProtectKernelLogs=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectSystem=full +Restart=on-failure +RestrictSUIDSGID=true +StartLimitBurst=3 +StartLimitInterval=30min +TasksMax=infinity + +[Install] +WantedBy=cephfs-mirror.target
\ No newline at end of file |