diff --git a/debian/rules b/debian/rules index 50495ffb6da..5f8923b48fa 100755 --- a/debian/rules +++ b/debian/rules @@ -6,7 +6,8 @@ export DESTDIR=$(CURDIR)/debian/tmp export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) extraopts += -DUSE_CRYPTOPP=OFF -DWITH_OCF=ON -DWITH_LTTNG=ON -DWITH_PYTHON3=ON -DWITH_EMBEDDED=OFF -extraopts += -DWITH_CEPHFS_JAVA=ON -DWITH_SYSTEMD=ON +extraopts += -DWITH_CEPHFS_JAVA=ON +extraopts += -DWITH_SYSTEMD=ON -DCEPH_SYSTEMD_ENV_DIR=/etc/default # assumes that ceph is exmpt from multiarch support, so we override the libdir. extraopts += -DCMAKE_INSTALL_LIBDIR=/usr/lib extraopts += -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib @@ -83,17 +84,6 @@ override_dh_installinit: install -d -m0755 debian/ceph-common/usr/lib/tmpfiles.d install -m 0644 -D systemd/ceph.tmpfiles.d debian/ceph-common/usr/lib/tmpfiles.d/ceph.conf - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mon/lib/systemd/system/ceph-mon@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-osd@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-disk@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-volume@.service - - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mds/lib/systemd/system/ceph-mds@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-fuse/lib/systemd/system/ceph-fuse@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mgr/lib/systemd/system/ceph-mgr@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/radosgw/lib/systemd/system/ceph-radosgw@.service - sed -i s./etc/sysconfig/./etc/default/.g debian/rbd-mirror/lib/systemd/system/ceph-rbd-mirror@.service - dh_installinit -p ceph-base --name ceph --no-start dh_installinit -p radosgw --no-start diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index cd88f328926..86ea87cde4e 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -1,5 +1,26 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_LIBEXECDIR}/systemd/system" CACHE PATH "Location for systemd service files") +set(CEPH_SYSTEMD_ENV_DIR "/etc/sysconf" + CACHE PATH "Location for systemd service environmental variable settings files") +set(SYSTEMD_ENV_FILE "${CEPH_SYSTEMD_ENV_DIR}/ceph") +foreach(service + ceph-fuse@ + ceph-mds@ + ceph-mgr@ + ceph-mon@ + ceph-osd@ + ceph-radosgw@ + ceph-rbd-mirror@ + rbdmap) + configure_file( + ${service}.service.in + ${service}.service + @ONLY) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${service}.service + DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}) +endforeach() + install(FILES ceph.target ceph-fuse.target @@ -9,14 +30,6 @@ install(FILES ceph-mds.target ceph-radosgw.target ceph-rbd-mirror.target - ceph-fuse@.service - ceph-mds@.service - ceph-mgr@.service - ceph-mon@.service - ceph-osd@.service - ceph-radosgw@.service - ceph-rbd-mirror@.service ceph-disk@.service ceph-volume@.service - rbdmap.service DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}) diff --git a/systemd/ceph-fuse@.service b/systemd/ceph-fuse@.service.in similarity index 91% rename from systemd/ceph-fuse@.service rename to systemd/ceph-fuse@.service.in index 98982441ebc..11eb7e760d7 100644 --- a/systemd/ceph-fuse@.service +++ b/systemd/ceph-fuse@.service.in @@ -6,7 +6,7 @@ Conflicts=umount.target PartOf=ceph-fuse.target [Service] -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-fuse -f --cluster ${CLUSTER} %I TasksMax=infinity diff --git a/systemd/ceph-mds@.service b/systemd/ceph-mds@.service.in similarity index 94% rename from systemd/ceph-mds@.service rename to systemd/ceph-mds@.service.in index d34bd057b76..bd472f66b22 100644 --- a/systemd/ceph-mds@.service +++ b/systemd/ceph-mds@.service.in @@ -7,7 +7,7 @@ PartOf=ceph-mds.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph ExecReload=/bin/kill -HUP $MAINPID diff --git a/systemd/ceph-mgr@.service b/systemd/ceph-mgr@.service.in similarity index 93% rename from systemd/ceph-mgr@.service rename to systemd/ceph-mgr@.service.in index 8272ad09c29..fab1b9e8e5d 100644 --- a/systemd/ceph-mgr@.service +++ b/systemd/ceph-mgr@.service.in @@ -7,7 +7,7 @@ PartOf=ceph-mgr.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-mgr -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph diff --git a/systemd/ceph-mon@.service b/systemd/ceph-mon@.service.in similarity index 95% rename from systemd/ceph-mon@.service rename to systemd/ceph-mon@.service.in index db4995fb9ca..c2566f37b95 100644 --- a/systemd/ceph-mon@.service +++ b/systemd/ceph-mon@.service.in @@ -13,7 +13,7 @@ PartOf=ceph-mon.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph ExecReload=/bin/kill -HUP $MAINPID diff --git a/systemd/ceph-osd@.service b/systemd/ceph-osd@.service.in similarity index 94% rename from systemd/ceph-osd@.service rename to systemd/ceph-osd@.service.in index 0a43ee166ba..672a10b1f14 100644 --- a/systemd/ceph-osd@.service +++ b/systemd/ceph-osd@.service.in @@ -7,7 +7,7 @@ PartOf=ceph-osd.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph ExecStartPre=/usr/lib/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i diff --git a/systemd/ceph-radosgw@.service b/systemd/ceph-radosgw@.service.in similarity index 93% rename from systemd/ceph-radosgw@.service rename to systemd/ceph-radosgw@.service.in index 3f7fcaca351..e2dac0bf3f0 100644 --- a/systemd/ceph-radosgw@.service +++ b/systemd/ceph-radosgw@.service.in @@ -7,7 +7,7 @@ PartOf=ceph-radosgw.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/radosgw -f --cluster ${CLUSTER} --name client.%i --setuser ceph --setgroup ceph PrivateDevices=yes diff --git a/systemd/ceph-rbd-mirror@.service b/systemd/ceph-rbd-mirror@.service.in similarity index 93% rename from systemd/ceph-rbd-mirror@.service rename to systemd/ceph-rbd-mirror@.service.in index 17fd7381f88..f8b15dcd401 100644 --- a/systemd/ceph-rbd-mirror@.service +++ b/systemd/ceph-rbd-mirror@.service.in @@ -7,7 +7,7 @@ PartOf=ceph-rbd-mirror.target [Service] LimitNOFILE=1048576 LimitNPROC=1048576 -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=CLUSTER=ceph ExecStart=/usr/bin/rbd-mirror -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph ExecReload=/bin/kill -HUP $MAINPID diff --git a/systemd/rbdmap.service b/systemd/rbdmap.service.in similarity index 90% rename from systemd/rbdmap.service rename to systemd/rbdmap.service.in index 15e64abb4b0..45aa2afea0f 100644 --- a/systemd/rbdmap.service +++ b/systemd/rbdmap.service.in @@ -5,7 +5,7 @@ After=network-online.target local-fs.target Wants=network-online.target local-fs.target [Service] -EnvironmentFile=-/etc/sysconfig/ceph +EnvironmentFile=-@SYSTEMD_ENV_FILE@ Environment=RBDMAPFILE=/etc/ceph/rbdmap Type=oneshot RemainAfterExit=yes