%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
enable ceph-rbd-mirror.target
enable ceph-radosgw.target
enable ceph-crash.service
+enable cephfs-mirror.target
ceph-radosgw@
ceph-rbd-mirror@
ceph-immutable-object-cache@
+ cephfs-mirror@
rbdmap)
configure_file(
${service}.service.in
ceph-rbd-mirror.target
ceph-immutable-object-cache.target
ceph-volume@.service
+ cephfs-mirror.target
DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
--- /dev/null
+[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
--- /dev/null
+[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