[Pkg-ceph-commits] [ceph] 02/02: native systemd services (except "rbdmap")

Dmitry Smirnov onlyjob at moszumanska.debian.org
Mon Nov 10 10:42:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

onlyjob pushed a commit to branch experimental
in repository ceph.

commit 3c22e19 (experimental)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Tue Nov 4 15:34:29 2014

    native systemd services (except "rbdmap")
---
 debian/README.Debian                        | 23 +++++++++++++++++++++++
 debian/ceph-mds.install                     |  1 +
 debian/ceph.examples                        |  1 +
 debian/ceph.install                         |  4 +++-
 debian/ceph.service                         | 15 +++++++++++++++
 debian/control                              |  2 +-
 debian/etc/default/ceph                     |  9 +++++++++
 debian/lib-systemd/system/ceph-mds.service  | 17 +++++++++++++++++
 debian/lib-systemd/system/ceph-mon.service  | 16 ++++++++++++++++
 debian/lib-systemd/system/ceph-osd at .service | 25 +++++++++++++++++++++++++
 debian/rules                                |  8 +++++++-
 11 files changed, 118 insertions(+), 3 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 1c6a412..f4ba80a 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -4,6 +4,29 @@
 
 -------- -------- --------
 
+## "systemd" requires manual activation of services:
+
+    ## MON
+    # systemctl start ceph-mon
+    # systemctl enable ceph-mon
+
+    ## OSD.0 (set other OSDs like this)
+    # systemctl start ceph-osd at 0
+    # systemctl enable ceph-osd at 0
+
+    ## MDS
+    # systemctl start ceph-mds
+    # systemctl enable ceph-mds
+
+    ## "ceph" meta-service (starts/stops all the above like old init script)
+    # systemctl start ceph
+    # systemctl enable ceph
+
+ The ceph cluster can be set in the "/etc/default/ceph" file
+ by setting the CLUSTER environment variable.
+
+-------- -------- --------
+
 ## Upgrade procedure (0.72.2 to 0.80):
 
  * Read "Upgrade Sequencing" in release notes:
diff --git a/debian/ceph-mds.install b/debian/ceph-mds.install
index df3cbe4..4731b95 100644
--- a/debian/ceph-mds.install
+++ b/debian/ceph-mds.install
@@ -1,3 +1,4 @@
 usr/bin/ceph-mds
 usr/bin/cephfs-journal-tool
 usr/share/man/man8/ceph-mds.8
+debian/lib-systemd/system/ceph-mds.service    /lib/systemd/system/
diff --git a/debian/ceph.examples b/debian/ceph.examples
new file mode 100644
index 0000000..0bd85b6
--- /dev/null
+++ b/debian/ceph.examples
@@ -0,0 +1 @@
+debian/etc/default/ceph
diff --git a/debian/ceph.install b/debian/ceph.install
index 323e10c..a222a3c 100644
--- a/debian/ceph.install
+++ b/debian/ceph.install
@@ -1,5 +1,7 @@
 debian/etc/pm/sleep.d/*    /etc/pm/sleep.d/
 debian/lib-systemd/system-sleep/*    /lib/systemd/system-sleep/
+debian/lib-systemd/system/ceph-osd at .service   /lib/systemd/system/
+debian/lib-systemd/system/ceph-mon.service    /lib/systemd/system/
 etc/bash_completion.d/ceph
 usr/bin/ceph-clsinfo
 usr/bin/ceph-debugpack
@@ -11,7 +13,7 @@ usr/bin/crushtool
 usr/bin/monmaptool
 usr/bin/osdmaptool
 usr/lib/*/ceph/ceph_common.sh
-#usr/lib/*/ceph/ceph-osd-prestart.sh
+usr/lib/*/ceph/ceph-osd-prestart.sh    /usr/lib/ceph/
 usr/lib/*/ceph/erasure-code/libec_jerasure*.so
 usr/lib/*/ceph/erasure-code/libec_lrc.so*
 usr/lib/*/ceph/erasure-code/libec_isa.so*
diff --git a/debian/ceph.service b/debian/ceph.service
new file mode 100644
index 0000000..01c9fa1
--- /dev/null
+++ b/debian/ceph.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Ceph meta service
+After=network-online.target ceph-mon.service ceph-mds.service
+Wants=ceph-mon.service ceph-mds.service
+#PropagatesReloadTo=ceph-mon.service ceph-mds.service
+
+[Service]
+Type=idle
+RemainAfterExit=yes
+ExecStart=-/bin/true
+ExecStartPre=-/bin/systemctl start ceph-osd*
+## ExecStopPost is not needed because OSDs use "PartOf=ceph.service".
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/control b/debian/control
index 761d7cd..eb4aab4 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Uploaders: Laszlo Boszormenyi (GCS) <gcs at debian.org>,
 Homepage: http://ceph.com/
 Vcs-Git: git://anonscm.debian.org/pkg-ceph/ceph.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ceph/ceph.git
-Build-Depends: debhelper (>= 9~),
+Build-Depends: debhelper (>= 9~), dh-systemd (>= 1.5),
                default-jdk,
                dh-autoreconf,
                dpkg-dev (>= 1.16.1~),
diff --git a/debian/etc/default/ceph b/debian/etc/default/ceph
new file mode 100644
index 0000000..c32bdf4
--- /dev/null
+++ b/debian/etc/default/ceph
@@ -0,0 +1,9 @@
+## /etc/default/ceph -- sourced by ceph-osd at .service (systemd)
+
+#CLUSTER=ceph
+#CONFIG=/etc/ceph/ceph.conf
+
+## create journal (if not exist) on OSD start; flush journal after OSD stop.
+## (useful for journals on tmpfs).
+#osd_prestart_sh="[ -r \"/var/lib/ceph/osd/${CLUSTER}-$1/journal\" ] || /usr/bin/ceph-osd --id $1 --mkjournal"
+#osd_poststop_sh="/usr/bin/ceph-osd --id $1 --flush-journal"
diff --git a/debian/lib-systemd/system/ceph-mds.service b/debian/lib-systemd/system/ceph-mds.service
new file mode 100644
index 0000000..90a9614
--- /dev/null
+++ b/debian/lib-systemd/system/ceph-mds.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Ceph metadata server daemon (MDS)
+Documentation=man:ceph-mds
+After=network-online.target nss-lookup.target
+Wants=network-online.target nss-lookup.target
+PartOf=ceph.service
+#RequiresMountsFor=/var/lib/ceph/mds/ceph-%H
+
+[Service]
+Environment=CLUSTER=ceph
+Environment=CONFIG=/etc/ceph/ceph.conf
+EnvironmentFile=-/etc/default/ceph
+ExecStart=/usr/bin/ceph-mds --id %H --foreground --cluster ${CLUSTER} -c ${CONFIG}
+#Restart=on-abnormal
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/lib-systemd/system/ceph-mon.service b/debian/lib-systemd/system/ceph-mon.service
new file mode 100644
index 0000000..94b1707
--- /dev/null
+++ b/debian/lib-systemd/system/ceph-mon.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Ceph cluster monitor daemon (MON)
+Documentation=man:ceph-mon
+After=network-online.target
+Wants=network-online.target
+PartOf=ceph.service
+
+[Service]
+Environment=CLUSTER=ceph
+Environment=CONFIG=/etc/ceph/ceph.conf
+EnvironmentFile=-/etc/default/ceph
+ExecStart=/usr/bin/ceph-mon --id %H --foreground --cluster ${CLUSTER} -c ${CONFIG}
+#Restart=on-abnormal
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/lib-systemd/system/ceph-osd at .service b/debian/lib-systemd/system/ceph-osd at .service
new file mode 100644
index 0000000..933ed6c
--- /dev/null
+++ b/debian/lib-systemd/system/ceph-osd at .service
@@ -0,0 +1,25 @@
+[Unit]
+Description=Ceph object storage daemon (OSD)
+Documentation=man:ceph-osd
+After=network-online.target
+Wants=network-online.target
+PartOf=ceph.service
+RequiresMountsFor=/var/lib/ceph/osd/ceph-%i
+
+[Service]
+Environment=CLUSTER=ceph
+Environment=CONFIG=/etc/ceph/ceph.conf
+EnvironmentFile=-/etc/default/ceph
+ExecStartPre=-/bin/sh -c '${osd_prestart_sh}' -- %i
+ExecStartPre=/usr/lib/ceph/ceph-osd-prestart.sh --id %i --cluster ${CLUSTER}
+ExecStart=/usr/bin/ceph-osd --id %i --foreground --cluster ${CLUSTER} -c ${CONFIG}
+ExecStopPost=-/bin/sh -c '${osd_poststop_sh}' -- %i
+LimitNOFILE=32768
+## restart if failed; 1 min. delay after failure; max. 4 restarts per 5 min.:
+#Restart=on-abnormal
+#RestartSec=60
+#StartLimitInterval=300
+#StartLimitBurst=5
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index 9d21fcb..4000b97 100755
--- a/debian/rules
+++ b/debian/rules
@@ -45,7 +45,7 @@ extraopts += --with-system-libs3
 #extraopts += --with-cluster-tests
 
 %:
-	dh $@ --with javahelper,python2,autoreconf --parallel
+	dh $@ --with javahelper,python2,autoreconf,systemd --parallel
 
 # use --as-needed only if supported by dh-autoreconf (to simplify backporting)
 DH_AS_NEEDED=$(shell dpkg --compare-versions $$(dpkg --status dh-autoreconf | grep Version | cut -d' ' -f2) ge 6 && echo --as-needed)
@@ -92,6 +92,12 @@ override_dh_installinit:
         dh_installinit -pradosgw --no-start --name=$$name; \
     done
 
+override_dh_systemd_enable:
+	## Do not enable services to match `dh_installinit --no-start`
+	## behaviour.
+	## Users are expected to "systemctl enable" services once their
+	## configuration is correct.
+
 override_dh_strip:
 	dh_strip -pceph --dbg-package=ceph-dbg
 	dh_strip -pceph-mds --dbg-package=ceph-mds-dbg

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ceph/ceph.git



More information about the Pkg-ceph-commits mailing list