Merge pull request #20618 from tchaikov/wip-systemd-deb-env

cmake,deb: install system units using cmake

Reviewed-by: Nathan Cutler <ncutler@suse.com>
This commit is contained in:
Kefu Chai 2018-02-28 14:42:34 +08:00 committed by GitHub
commit bf5cb2e10e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 46 additions and 60 deletions

View File

@ -4,6 +4,8 @@ etc/bash_completion.d/ceph
etc/bash_completion.d/rados
etc/bash_completion.d/radosgw-admin
etc/bash_completion.d/rbd
lib/systemd/system/ceph.target
lib/systemd/system/rbdmap.service
usr/bin/ceph
usr/bin/ceph-authtool
usr/bin/ceph-conf

View File

@ -1,3 +1,4 @@
lib/systemd/system/ceph-fuse*
usr/bin/ceph-fuse
usr/sbin/mount.fuse.ceph sbin
usr/share/man/man8/ceph-fuse.8

View File

@ -1,2 +1,3 @@
lib/systemd/system/ceph-mds*
usr/bin/ceph-mds
usr/share/man/man8/ceph-mds.8

View File

@ -1,2 +1,3 @@
lib/systemd/system/ceph-mgr*
usr/bin/ceph-mgr
usr/lib/ceph/mgr

View File

@ -1,3 +1,4 @@
lib/systemd/system/ceph-mon*
usr/bin/ceph-mon
usr/bin/ceph-monstore-tool
usr/bin/ceph-rest-api

View File

@ -1,5 +1,8 @@
lib/udev/rules.d/60-ceph-by-parttypeuuid.rules
lib/udev/rules.d/95-ceph-osd.rules
lib/systemd/system/ceph-disk@.service
lib/systemd/system/ceph-osd*
lib/systemd/system/ceph-volume@.service
usr/bin/ceph-bluestore-tool
usr/bin/ceph-clsinfo
usr/bin/ceph-objectstore-tool

View File

@ -1,3 +1,4 @@
lib/systemd/system/ceph-radosgw*
usr/bin/radosgw
usr/bin/radosgw-es
usr/bin/radosgw-object-expirer

View File

@ -1,2 +1,3 @@
lib/systemd/system/ceph-rbd-mirror*
usr/bin/rbd-mirror
usr/share/man/man8/rbd-mirror.8

46
debian/rules vendored
View File

@ -6,11 +6,13 @@ 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=OFF
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
extraopts += -DCMAKE_INSTALL_SYSCONFDIR=/etc
extraopts += -DCMAKE_INSTALL_SYSTEMD_SERVICEDIR=/lib/systemd/system
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
extraopts += -DBOOST_J=$(NUMJOBS)
@ -77,53 +79,11 @@ override_dh_installinit:
install -d -m0755 debian/rbd-mirror/etc/init
install -m0644 src/upstart/ceph-rbd-mirror*.conf debian/rbd-mirror/etc/init
# install the systemd stuff manually since we have funny service names
install -d -m0755 debian/ceph-common/lib/systemd/system
install -m0644 systemd/ceph.target debian/ceph-common/lib/systemd/system
install -d -m0755 debian/ceph-common/etc/default
install -m0644 etc/default/ceph debian/ceph-common/etc/default/
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
install -d -m0755 debian/ceph-base/lib/systemd/system
install -d -m0755 debian/ceph-mon/lib/systemd/system
install -d -m0755 debian/ceph-osd/lib/systemd/system
install -m0644 systemd/ceph-mon@.service debian/ceph-mon/lib/systemd/system
install -m0644 systemd/ceph-osd@.service debian/ceph-osd/lib/systemd/system
install -m0644 systemd/ceph-disk@.service debian/ceph-osd/lib/systemd/system
install -m0644 systemd/ceph-volume@.service debian/ceph-osd/lib/systemd/system
install -m0644 systemd/rbdmap.service debian/ceph-common/lib/systemd/system
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
install -m0644 systemd/ceph-mon.target debian/ceph-mon/lib/systemd/system
install -m0644 systemd/ceph-osd.target debian/ceph-osd/lib/systemd/system
install -d -m0755 debian/ceph-mds/lib/systemd/system
install -m0644 systemd/ceph-mds@.service debian/ceph-mds/lib/systemd/system
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
install -m0644 systemd/ceph-mgr.target debian/ceph-mgr/lib/systemd/system
install -d -m0755 debian/radosgw/lib/systemd/system
install -m0644 systemd/ceph-radosgw@.service debian/radosgw/lib/systemd/system
sed -i s./etc/sysconfig/./etc/default/.g debian/radosgw/lib/systemd/system/ceph-radosgw@.service
install -m0644 systemd/ceph-radosgw.target debian/radosgw/lib/systemd/system
install -d -m0755 debian/rbd-mirror/lib/systemd/system
install -m0644 systemd/ceph-rbd-mirror@.service debian/rbd-mirror/lib/systemd/system
sed -i s./etc/sysconfig/./etc/default/.g debian/rbd-mirror/lib/systemd/system/ceph-rbd-mirror@.service
install -m0644 systemd/ceph-rbd-mirror.target debian/rbd-mirror/lib/systemd/system
dh_installinit -p ceph-base --name ceph --no-start
dh_installinit -p radosgw --no-start

View File

@ -1,3 +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
@ -7,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_LIBEXECDIR}/systemd/system)
DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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