]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
systemd: cephfs-mirror systemd unit files 37876/head
authorVenky Shankar <vshankar@redhat.com>
Fri, 11 Dec 2020 06:47:48 +0000 (01:47 -0500)
committerVenky Shankar <vshankar@redhat.com>
Tue, 12 Jan 2021 10:57:32 +0000 (05:57 -0500)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
ceph.spec.in
systemd/50-ceph.preset
systemd/CMakeLists.txt
systemd/cephfs-mirror.target [new file with mode: 0644]
systemd/cephfs-mirror@.service.in [new file with mode: 0644]

index 08088888347287494620e6f1e18eb0abe730d18c..c11b1b76c27d13f727c8a1bc18a73312f8ac6477 100644 (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
index ca8f4d2c6f60b243b494becf0adcc615227e0296..a7fc5f129ba3c23c88f1ee047e78e0d83d6df885 100644 (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
index 43adf7be142c5f229c61dd04eb3b2fc6da4b2f80..499b5d190241bdab82a0aea8f9b6efebded68500 100644 (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})
diff --git a/systemd/cephfs-mirror.target b/systemd/cephfs-mirror.target
new file mode 100644 (file)
index 0000000..e2296dc
--- /dev/null
@@ -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 (file)
index 0000000..a97d6ad
--- /dev/null
@@ -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