From d32d70b783e74ba56966c09ae0785cfb0dedf8c5 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 18 Oct 2016 20:20:34 -0400 Subject: [PATCH] systemd: add ceph-fuse service file Signed-off-by: Patrick Donnelly --- ceph.spec.in | 2 ++ debian/rules | 6 ++++++ doc/cephfs/fuse.rst | 15 ++++++++++++++- systemd/CMakeLists.txt | 2 ++ systemd/ceph-fuse.target | 5 +++++ systemd/ceph-fuse@.service | 18 ++++++++++++++++++ 6 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 systemd/ceph-fuse.target create mode 100644 systemd/ceph-fuse@.service diff --git a/ceph.spec.in b/ceph.spec.in index 03021690eded2..764f34af3ab7b 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -1156,6 +1156,8 @@ fi %{_bindir}/ceph-fuse %{_mandir}/man8/ceph-fuse.8* %{_sbindir}/mount.fuse.ceph +%{_unitdir}/ceph-fuse@.service +%{_unitdir}/ceph-fuse.target %files -n rbd-fuse %defattr(-,root,root,-) diff --git a/debian/rules b/debian/rules index a3d189353fa74..59991c500ea03 100755 --- a/debian/rules +++ b/debian/rules @@ -96,6 +96,11 @@ override_dh_installinit: sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mds/lib/systemd/system/ceph-mds@.service install -m0644 systemd/ceph-mds.target debian/ceph-mds/lib/systemd/system + install -d -m0755 debian/ceph-fuse/lib/systemd/system + install -m0644 systemd/ceph-fuse@.service debian/ceph-fuse/lib/systemd/system + sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-fuse/lib/systemd/system/ceph-fuse@.service + install -m0644 systemd/ceph-fuse.target debian/ceph-fuse/lib/systemd/system + install -d -m0755 debian/ceph-mgr/lib/systemd/system install -m0644 systemd/ceph-mgr@.service debian/ceph-mgr/lib/systemd/system sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mgr/lib/systemd/system/ceph-mgr@.service @@ -119,6 +124,7 @@ override_dh_systemd_start: override_dh_strip: dh_strip -pceph-mds --dbg-package=ceph-mds-dbg + dh_strip -pceph-fuse --dbg-package=ceph-fuse-dbg dh_strip -pceph-mgr --dbg-package=ceph-mgr-dbg dh_strip -pceph-mon --dbg-package=ceph-mon-dbg dh_strip -pceph-osd --dbg-package=ceph-osd-dbg diff --git a/doc/cephfs/fuse.rst b/doc/cephfs/fuse.rst index cd6d74edf65b7..ac6867481d23d 100644 --- a/doc/cephfs/fuse.rst +++ b/doc/cephfs/fuse.rst @@ -32,5 +32,18 @@ For example:: See `ceph-fuse`_ for additional details. +To automate mounting ceph-fuse, you may add an entry to the system fstab_. +Additionally, ``ceph-fuse@.service`` and ``ceph-fuse.target`` systemd units are +available. As usual, these unit files declare the default dependencies and +recommended execution context for ``ceph-fuse``. An example ceph-fuse mount on +``/mnt`` would be:: + + sudo systemctl start ceph-fuse@/mnt.service + +A persistent mount point can be setup via:: + + sudo systemctl enable ceph-fuse@/mnt.service + .. _ceph-fuse: ../../man/8/ceph-fuse/ -.. _CEPHX Config Reference: ../../rados/configuration/auth-config-ref \ No newline at end of file +.. _fstab: ./fstab +.. _CEPHX Config Reference: ../../rados/configuration/auth-config-ref diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index 8a1667f971635..240a565d09ecc 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -1,11 +1,13 @@ 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 diff --git a/systemd/ceph-fuse.target b/systemd/ceph-fuse.target new file mode 100644 index 0000000000000..7e37a9dc537d5 --- /dev/null +++ b/systemd/ceph-fuse.target @@ -0,0 +1,5 @@ +[Unit] +Description=ceph target allowing to start/stop all ceph-fuse@.service instances at once +PartOf=ceph.target +[Install] +WantedBy=remote-fs.target ceph.target diff --git a/systemd/ceph-fuse@.service b/systemd/ceph-fuse@.service new file mode 100644 index 0000000000000..98982441ebcd9 --- /dev/null +++ b/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 -- 2.39.5