systemd: cephfs-mirror systemd unit files

Signed-off-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
Venky Shankar 2020-12-11 01:47:48 -05:00
parent 42233bb5df
commit 1227752983
5 changed files with 80 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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})

View File

@ -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

View File

@ -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