Skip to content

Commit f884c6c

Browse files
authored
Merge pull request #127 from cybozu-go/update-ceph-v19.2.1.2
ceph: update to v19.2.1
2 parents 95247cf + c1ca76e commit f884c6c

7 files changed

+172
-149
lines changed

ceph/Dockerfile

+6-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ghcr.io/cybozu/ubuntu:22.04 AS build-ceph
22

33
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
44
ENV DEBIAN_FRONTEND=noninteractive
5-
ENV CEPH_TAG=v18.2.4
5+
ENV CEPH_TAG=v19.2.1
66
ENV WORKSPACE=/workspace
77

88
RUN apt-get update && \
@@ -22,30 +22,22 @@ RUN git clone -b ${CEPH_TAG} --depth=1 --recurse-submodules --shallow-submodules
2222
COPY *.patch ./
2323
WORKDIR ${WORKSPACE}/ceph
2424

25-
# Ceph v18.2.4 has a bug that causes the ceph-volume command to fail on the OSD prepare pod.
26-
# This bug was caused by the wrong way of installing the Python package.
27-
# As a workaround, the following patch is applied ahead of upstream.
28-
# https://github.com/ceph/ceph/commit/729fd8e25ff2bfbcf99790d6cd08489d1c4e2ede
29-
# Apply the packing-1.patch(Commit 80edcd4) simply because the changes depend on it.
30-
RUN patch -p1 < ${WORKSPACE}/packing-1.patch && \
31-
patch -p1 < ${WORKSPACE}/packing-2.patch
32-
3325
RUN ./install-deps.sh && \
3426
apt install --no-install-recommends -y python3-routes
3527

28+
# Addition of debian pkg in ceph exporter was omitted in squid.
29+
# https://github.com/ceph/ceph/pull/56541
30+
RUN patch -p1 < ${WORKSPACE}/exporter.patch
31+
3632
# This patch customizes the ceph rbd export-diff command.
37-
RUN patch -p1 < ${WORKSPACE}/export-diff.patch
33+
RUN patch -p1 < ${WORKSPACE}/export-diff.patch
3834

3935
# Prebuild ceph source to generate files in `src/pybind/mgr/dashboard/frontend/dist` needed by CMake
4036
RUN ./make-dist
4137

4238
# Build Ceph packages
4339
RUN sed -i -e 's/WITH_CEPHFS_JAVA=ON/WITH_CEPHFS_JAVA=OFF/' debian/rules && \
4440
sed -i -e 's@usr/share/java/libcephfs-test.jar@@' debian/ceph-test.install
45-
# CMake in the self-build environment did not allow space-separated URLs.
46-
# As a workaround, the following patch is applied ahead of upstream.
47-
# https://github.com/ceph/ceph/commit/35435420781f84e9b71f72b10e6842a89c06de7f
48-
RUN patch -p1 < ${WORKSPACE}/boost-url.patch
4941
RUN rm debian/libcephfs-java.jlibs debian/libcephfs-jni.install debian/ceph-mgr-dashboard*
5042
RUN dpkg-buildpackage --build=binary -uc -us -j10
5143
RUN rm ${WORKSPACE}/*-dbg_*.deb ${WORKSPACE}/ceph-test_*.deb

ceph/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ git push origin --all
2727
git push origin --tags
2828
```
2929

30+
### Update Dockerfile
31+
32+
1. Update `CEPH_TAG` to the desired version.
33+
2. If [`neco-containers/ceph/Dockerfile`](https://github.com/cybozu/neco-containers/blob/main/ceph/Dockerfile) or [`neco-containers/ceph/build.sh`](https://github.com/cybozu/neco-containers/blob/main/ceph/build.sh) is updated, update the Dockerfile in the same way.
34+
3035
### Update the patch
3136
**In the `cybozu/ceph` repository,** you checkout the target branch (`rbd-export-vx.y.z`). If it doesn't exist yet, it's necessary to create it and apply the newest patch as follows.
3237

ceph/boost-url.patch

-26
This file was deleted.

ceph/export-diff.patch

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
diff --git a/src/tools/rbd/ArgumentTypes.h b/src/tools/rbd/ArgumentTypes.h
2+
index cc7c4813636..ac3e040e22a 100644
13
--- a/src/tools/rbd/ArgumentTypes.h
24
+++ b/src/tools/rbd/ArgumentTypes.h
35
@@ -55,6 +55,9 @@ static const std::string DEST_SNAPSHOT_NAME("dest-snap");
@@ -11,7 +13,7 @@
1113
// encryption arguments
1214
static const std::string ENCRYPTION_FORMAT("encryption-format");
1315
diff --git a/src/tools/rbd/action/Export.cc b/src/tools/rbd/action/Export.cc
14-
index ddcf0f2c30c..1b72db2bde8 100644
16+
index ddcf0f2c30c..7ba5a4939fe 100644
1517
--- a/src/tools/rbd/action/Export.cc
1618
+++ b/src/tools/rbd/action/Export.cc
1719
@@ -123,16 +123,27 @@ private:
@@ -131,13 +133,13 @@ index ddcf0f2c30c..1b72db2bde8 100644
131133
+ r = image.stat(info, sizeof(info));
132134
+ if (r < 0)
133135
+ return r;
134-
+
136+
+
135137
+ if (*offset >= info.size) {
136138
+ std::cerr << "rbd: offset " << *offset << " exceeds image size "
137139
+ << info.size << std::endl;
138140
+ return -EINVAL;
139141
+ }
140-
+
142+
+
141143
+ if (*offset > 0) {
142144
+ *from_snap_name = mid_snap_prefix + "-offset-" + std::to_string(*offset);
143145
+ }

ceph/exporter.patch

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
From 0479bc612ac630b0cc5d57b7d1b7f8439152d437 Mon Sep 17 00:00:00 2001
2+
From: Shinya Hayashi <[email protected]>
3+
Date: Tue, 30 Jan 2024 10:32:50 +0000
4+
Subject: [PATCH 1/2] debian: add ceph-exporter package
5+
6+
It is hard for Debian/Ubuntu users to use ceph-exporter
7+
because it is not included in any deb packages.
8+
9+
This commit adds a new deb package for ceph-exporter.
10+
11+
Fixes: https://tracker.ceph.com/issues/64095
12+
Signed-off-by: Shinya Hayashi <[email protected]>
13+
(cherry picked from commit a53c0651fbd8991e258ce7d0e3a80865dabfea88)
14+
---
15+
debian/ceph-exporter.install | 1 +
16+
debian/control | 24 ++++++++++++++++++++++++
17+
debian/rules | 1 +
18+
3 files changed, 26 insertions(+)
19+
create mode 100644 debian/ceph-exporter.install
20+
21+
diff --git a/debian/ceph-exporter.install b/debian/ceph-exporter.install
22+
new file mode 100644
23+
index 0000000000000..618cf9eadcc1e
24+
--- /dev/null
25+
+++ b/debian/ceph-exporter.install
26+
@@ -0,0 +1 @@
27+
+usr/bin/ceph-exporter
28+
diff --git a/debian/control b/debian/control
29+
index cb6ff92cba2c2..ddba52be7bb00 100644
30+
--- a/debian/control
31+
+++ b/debian/control
32+
@@ -352,6 +352,30 @@ Description: debugging symbols for ceph-mgr
33+
.
34+
This package contains the debugging symbols for ceph-mgr.
35+
36+
+Package: ceph-exporter
37+
+Architecture: linux-any
38+
+Depends: ceph-base (= ${binary:Version}),
39+
+Description: metrics exporter for the ceph distributed storage system
40+
+ Ceph is a massively scalable, open-source, distributed
41+
+ storage system that runs on commodity hardware and delivers object,
42+
+ block and file system storage.
43+
+ .
44+
+ This package contains the metrics exporter daemon, which is used to expose
45+
+ the performance metrics.
46+
+
47+
+Package: ceph-exporter-dbg
48+
+Architecture: linux-any
49+
+Section: debug
50+
+Priority: extra
51+
+Depends: ceph-exporter (= ${binary:Version}),
52+
+ ${misc:Depends},
53+
+Description: debugging symbols for ceph-exporter
54+
+ Ceph is a massively scalable, open-source, distributed
55+
+ storage system that runs on commodity hardware and delivers object,
56+
+ block and file system storage.
57+
+ .
58+
+ This package contains the debugging symbols for ceph-exporter.
59+
+
60+
Package: ceph-mon
61+
Architecture: linux-any
62+
Depends: ceph-base (= ${binary:Version}),
63+
diff --git a/debian/rules b/debian/rules
64+
index ed7f4a255ed4b..68c69e0447499 100755
65+
--- a/debian/rules
66+
+++ b/debian/rules
67+
@@ -105,6 +105,7 @@ override_dh_strip:
68+
dh_strip -pceph-mds --dbg-package=ceph-mds-dbg
69+
dh_strip -pceph-fuse --dbg-package=ceph-fuse-dbg
70+
dh_strip -pceph-mgr --dbg-package=ceph-mgr-dbg
71+
+ dh_strip -pceph-exporter --dbg-package=ceph-exporter-dbg
72+
dh_strip -pceph-mon --dbg-package=ceph-mon-dbg
73+
dh_strip -pceph-osd --dbg-package=ceph-osd-dbg
74+
dh_strip -pceph-base --dbg-package=ceph-base-dbg
75+
76+
From 5f7da9d127c6179b7db0b62e82cae46f137129bc Mon Sep 17 00:00:00 2001
77+
From: Shinya Hayashi <[email protected]>
78+
Date: Mon, 5 Feb 2024 04:16:26 +0000
79+
Subject: [PATCH 2/2] systemd: add systemd unit file for ceph-exporter
80+
81+
Signed-off-by: Shinya Hayashi <[email protected]>
82+
(cherry picked from commit 32cbe079c60031f67ee91e2f74f39244a027eba6)
83+
---
84+
ceph.spec.in | 1 +
85+
debian/ceph-exporter.install | 1 +
86+
systemd/CMakeLists.txt | 1 +
87+
systemd/ceph-exporter.service.in | 29 +++++++++++++++++++++++++++++
88+
4 files changed, 32 insertions(+)
89+
create mode 100644 systemd/ceph-exporter.service.in
90+
91+
diff --git a/ceph.spec.in b/ceph.spec.in
92+
index c4281abc5bfbb..cbbeec602e4de 100644
93+
--- a/ceph.spec.in
94+
+++ b/ceph.spec.in
95+
@@ -2039,6 +2039,7 @@ fi
96+
97+
%files -n ceph-exporter
98+
%{_bindir}/ceph-exporter
99+
+%{_unitdir}/ceph-exporter.service
100+
101+
%files -n rbd-fuse
102+
%{_bindir}/rbd-fuse
103+
diff --git a/debian/ceph-exporter.install b/debian/ceph-exporter.install
104+
index 618cf9eadcc1e..1ac0edcd2a18c 100644
105+
--- a/debian/ceph-exporter.install
106+
+++ b/debian/ceph-exporter.install
107+
@@ -1 +1,2 @@
108+
+lib/systemd/system/ceph-exporter*
109+
usr/bin/ceph-exporter
110+
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
111+
index ad75ce61cd8d9..366bab4195df8 100644
112+
--- a/systemd/CMakeLists.txt
113+
+++ b/systemd/CMakeLists.txt
114+
@@ -14,6 +14,7 @@ set(CEPH_SYSTEMD_ENV_DIR "/etc/sysconfig"
115+
set(SYSTEMD_ENV_FILE "${CEPH_SYSTEMD_ENV_DIR}/ceph")
116+
foreach(service
117+
ceph-crash
118+
+ ceph-exporter
119+
ceph-fuse@
120+
ceph-mds@
121+
ceph-mgr@
122+
diff --git a/systemd/ceph-exporter.service.in b/systemd/ceph-exporter.service.in
123+
new file mode 100644
124+
index 0000000000000..f4f6d05c4b4d4
125+
--- /dev/null
126+
+++ b/systemd/ceph-exporter.service.in
127+
@@ -0,0 +1,29 @@
128+
+[Unit]
129+
+Description=Ceph cluster exporter daemon
130+
+PartOf=ceph.target
131+
+After=network-online.target local-fs.target
132+
+Before=ceph.target
133+
+Wants=network-online.target local-fs.target ceph.target ceph-mon.target
134+
+
135+
+[Service]
136+
+ExecReload=/bin/kill -HUP $MAINPID
137+
+ExecStart=/usr/bin/ceph-exporter -f --id %i --setuser ceph --setgroup ceph
138+
+LockPersonality=true
139+
+NoNewPrivileges=true
140+
+PrivateDevices=yes
141+
+PrivateTmp=true
142+
+ProtectControlGroups=true
143+
+ProtectHome=true
144+
+ProtectHostname=true
145+
+ProtectKernelLogs=true
146+
+ProtectKernelModules=true
147+
+ProtectKernelTunables=true
148+
+ProtectSystem=full
149+
+Restart=on-failure
150+
+RestartSec=10
151+
+RestrictSUIDSGID=true
152+
+StartLimitBurst=3
153+
+StartLimitInterval=30min
154+
+
155+
+[Install]
156+
+WantedBy=multi-user.target ceph.target

ceph/packing-1.patch

-33
This file was deleted.

ceph/packing-2.patch

-73
This file was deleted.

0 commit comments

Comments
 (0)