1 |
commit: 361fb48dfdefd0b5442dd36e1b3d9a2cb47f8b07 |
2 |
Author: Yixun Lan <dlan <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 11 01:21:06 2016 +0000 |
4 |
Commit: Yixun Lan <dlan <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 11 01:21:47 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=361fb48d |
7 |
|
8 |
sys-cluster/ceph: restore 0.94.x (hammer) |
9 |
|
10 |
we decided to keep at least two LTS versions |
11 |
also, allow user upgrade from old versions (sidely) |
12 |
|
13 |
Gentoo-Bug: 587568 |
14 |
|
15 |
Package-Manager: portage-2.3.0_rc1 |
16 |
|
17 |
sys-cluster/ceph/Manifest | 1 + |
18 |
sys-cluster/ceph/ceph-0.94.7.ebuild | 177 +++++++++++++++++++++ |
19 |
.../ceph/files/ceph-0.94.7-monitor-security.patch | 109 +++++++++++++ |
20 |
3 files changed, 287 insertions(+) |
21 |
|
22 |
diff --git a/sys-cluster/ceph/Manifest b/sys-cluster/ceph/Manifest |
23 |
index 5317942..1a120d4 100644 |
24 |
--- a/sys-cluster/ceph/Manifest |
25 |
+++ b/sys-cluster/ceph/Manifest |
26 |
@@ -1,2 +1,3 @@ |
27 |
+DIST ceph-0.94.7.tar.gz 9164375 SHA256 aafe6cbab2f5db11376e5696a58d0711a90e93094a04eafe8d4d0910c8694d66 SHA512 e27631dceb01d59fab5fab22eaf7a8d0cbb474b44834a3b62bff4562e32723711431ee3ae66e2de26368b3b0e8f3619282a91c6934b88e722fcdfe6215bf8e68 WHIRLPOOL b2c0f5d26a1ffdfede29ec35cba6bf3c630cfcf0ea8d42542bcfc8ee36294d611c5316ff85e4ade9c8e1e66ad020cf5402bddcfa9557b29969ae6bb9a3870b60 |
28 |
DIST ceph-10.2.2.tar.gz 11541035 SHA256 7adaaeffb5a787108b5e1494df9165b6420069c0ab710e6e4aad185f423b0f6d SHA512 b47138528af3078646b52e9ea9a561eca4120473e7584c9076e949f0e9bbbdd15aa88e2287a90bd1ddb09d06c29c40181c18da58f5126a442101169ef3419b8a WHIRLPOOL f744444f2064832cba46065bd0fe64996c92bf8ed7888c075dffa9efe1d84393bd2204b38cefe11d0804ea862d0f2ff2d114ea205ff163d60e061e2e4a01db15 |
29 |
DIST ceph-9.2.1.tar.gz 9933444 SHA256 1918dfc3df80df5986c5b7ff6bc6c78064eef0f6c5e8269dba30e08c703a7c2f SHA512 1e84c1e2d64f4156a523658ed11552b045f75986922b7b7dbaf4719e73a0a6aadc71eb2b94ae363526f729534a592921a437468a41a3cea88c1b84e09de8505a WHIRLPOOL 3a0eb6712e5b0235707e86129e1d66f1184f50cd4980c30f6d8cc0e7dfd96d30b91177ed16dd7abf2ad4983c6a543eb91915f74f661f7d3e3c810b5b1d656aca |
30 |
|
31 |
diff --git a/sys-cluster/ceph/ceph-0.94.7.ebuild b/sys-cluster/ceph/ceph-0.94.7.ebuild |
32 |
new file mode 100644 |
33 |
index 0000000..eb31594 |
34 |
--- /dev/null |
35 |
+++ b/sys-cluster/ceph/ceph-0.94.7.ebuild |
36 |
@@ -0,0 +1,177 @@ |
37 |
+# Copyright 1999-2016 Gentoo Foundation |
38 |
+# Distributed under the terms of the GNU General Public License v2 |
39 |
+# $Id$ |
40 |
+ |
41 |
+EAPI=5 |
42 |
+PYTHON_COMPAT=( python2_7 ) |
43 |
+ |
44 |
+if [[ $PV = *9999* ]]; then |
45 |
+ scm_eclass=git-r3 |
46 |
+ EGIT_REPO_URI=" |
47 |
+ git://github.com/ceph/ceph.git |
48 |
+ https://github.com/ceph/ceph.git" |
49 |
+ SRC_URI="" |
50 |
+else |
51 |
+ [[ -n ${UPSTREAM_VER} ]] && \ |
52 |
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P}-upstream-patches-${UPSTREAM_VER}.tar.xz" |
53 |
+ |
54 |
+ SRC_URI="http://ceph.com/download/${P}.tar.gz |
55 |
+ ${UPSTREAM_PATCHSET_URI}" |
56 |
+fi |
57 |
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86" |
58 |
+ |
59 |
+inherit check-reqs autotools eutils multilib python-single-r1 udev readme.gentoo-r1 systemd ${scm_eclass} |
60 |
+ |
61 |
+DESCRIPTION="Ceph distributed filesystem" |
62 |
+HOMEPAGE="http://ceph.com/" |
63 |
+ |
64 |
+LICENSE="LGPL-2.1" |
65 |
+SLOT="0" |
66 |
+IUSE="babeltrace cryptopp debug fuse gtk libatomic +libaio lttng +nss radosgw static-libs jemalloc python tcmalloc xfs zfs" |
67 |
+ |
68 |
+COMMON_DEPEND=" |
69 |
+ app-arch/snappy |
70 |
+ dev-libs/boost:=[threads] |
71 |
+ dev-libs/fcgi |
72 |
+ dev-libs/libaio |
73 |
+ dev-libs/libedit |
74 |
+ dev-libs/leveldb[snappy] |
75 |
+ nss? ( dev-libs/nss ) |
76 |
+ cryptopp? ( dev-libs/crypto++ ) |
77 |
+ sys-apps/keyutils |
78 |
+ sys-apps/util-linux |
79 |
+ dev-libs/libxml2 |
80 |
+ babeltrace? ( dev-util/babeltrace ) |
81 |
+ fuse? ( sys-fs/fuse ) |
82 |
+ libatomic? ( dev-libs/libatomic_ops ) |
83 |
+ xfs? ( sys-fs/xfsprogs ) |
84 |
+ zfs? ( sys-fs/zfs ) |
85 |
+ gtk? ( |
86 |
+ x11-libs/gtk+:2 |
87 |
+ dev-cpp/gtkmm:2.4 |
88 |
+ gnome-base/librsvg |
89 |
+ ) |
90 |
+ radosgw? ( |
91 |
+ dev-libs/fcgi |
92 |
+ dev-libs/expat |
93 |
+ net-misc/curl |
94 |
+ ) |
95 |
+ jemalloc? ( dev-libs/jemalloc ) |
96 |
+ !jemalloc? ( dev-util/google-perftools ) |
97 |
+ lttng? ( dev-util/lttng-ust ) |
98 |
+ ${PYTHON_DEPS} |
99 |
+ " |
100 |
+DEPEND="${COMMON_DEPEND} |
101 |
+ virtual/pkgconfig" |
102 |
+RDEPEND="${COMMON_DEPEND} |
103 |
+ sys-apps/hdparm |
104 |
+ dev-python/flask[${PYTHON_USEDEP}] |
105 |
+ dev-python/requests[${PYTHON_USEDEP}] |
106 |
+ " |
107 |
+REQUIRED_USE=" |
108 |
+ ${PYTHON_REQUIRED_USE} |
109 |
+ ^^ ( nss cryptopp ) |
110 |
+ ?? ( jemalloc tcmalloc ) |
111 |
+ " |
112 |
+ |
113 |
+STRIP_MASK="/usr/lib*/rados-classes/*" |
114 |
+ |
115 |
+PATCHES=( |
116 |
+ "${FILESDIR}"/${PN}-0.79-libzfs.patch |
117 |
+ "${FILESDIR}"/${P}-monitor-security.patch |
118 |
+) |
119 |
+CHECKREQS_DISK_BUILD="1400M" |
120 |
+ |
121 |
+pkg_setup() { |
122 |
+ python_setup |
123 |
+} |
124 |
+ |
125 |
+src_prepare() { |
126 |
+ # Upstream's patchset |
127 |
+ if [[ -n ${UPSTREAM_VER} ]]; then |
128 |
+ einfo "Try to apply Ceph Upstream patch set" |
129 |
+ EPATCH_SUFFIX="patch" \ |
130 |
+ EPATCH_FORCE="yes" \ |
131 |
+ EPATCH_OPTS="-p1" \ |
132 |
+ epatch "${WORKDIR}"/patches-upstream |
133 |
+ fi |
134 |
+ |
135 |
+ [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" |
136 |
+ |
137 |
+ epatch_user |
138 |
+ eautoreconf |
139 |
+} |
140 |
+ |
141 |
+src_configure() { |
142 |
+ local myeconfargs=( |
143 |
+ --without-hadoop |
144 |
+ --docdir="${EPREFIX}/usr/share/doc/${PF}" |
145 |
+ --includedir=/usr/include |
146 |
+ $(use_with debug) |
147 |
+ $(use_with fuse) |
148 |
+ $(use_with libaio) |
149 |
+ $(use_with libatomic libatomic-ops) |
150 |
+ $(use_with nss) |
151 |
+ $(use_with cryptopp) |
152 |
+ $(use_with radosgw) |
153 |
+ $(use_with gtk gtk2) |
154 |
+ $(use_enable static-libs static) |
155 |
+ $(use_with jemalloc) |
156 |
+ $(use_with xfs libxfs) |
157 |
+ $(use_with zfs libzfs) |
158 |
+ $(use_with lttng ) |
159 |
+ $(use_with babeltrace) |
160 |
+ --without-kinetic |
161 |
+ --without-librocksdb |
162 |
+ ) |
163 |
+ |
164 |
+ use jemalloc || \ |
165 |
+ myeconfargs+=( $(usex tcmalloc " --with-tcmalloc" " --with-tcmalloc-minimal") ) |
166 |
+ |
167 |
+ PYTHON="${EPYTHON}" \ |
168 |
+ econf "${myeconfargs[@]}" |
169 |
+} |
170 |
+ |
171 |
+src_install() { |
172 |
+ default |
173 |
+ |
174 |
+ prune_libtool_files --all |
175 |
+ |
176 |
+ exeinto /usr/$(get_libdir)/ceph |
177 |
+ newexe src/init-ceph ceph_init.sh |
178 |
+ |
179 |
+ insinto /etc/logrotate.d/ |
180 |
+ newins "${FILESDIR}"/ceph.logrotate ${PN} |
181 |
+ |
182 |
+ chmod 644 "${ED}"/usr/share/doc/${PF}/sample.* |
183 |
+ |
184 |
+ keepdir /var/lib/${PN} |
185 |
+ keepdir /var/lib/${PN}/tmp |
186 |
+ keepdir /var/log/${PN}/stat |
187 |
+ |
188 |
+ newinitd "${FILESDIR}/rbdmap.initd" rbdmap |
189 |
+ newinitd "${FILESDIR}/${PN}.initd-r1.1" ${PN} |
190 |
+ newconfd "${FILESDIR}/${PN}.confd-r1" ${PN} |
191 |
+ |
192 |
+ systemd_dounit "${FILESDIR}/ceph.target" |
193 |
+ systemd_newunit "${FILESDIR}/ceph-mds_at.service" "ceph-mds@.service" |
194 |
+ systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service" |
195 |
+ systemd_newunit "${FILESDIR}/ceph-osd_at.service" "ceph-osd@.service" |
196 |
+ systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service" |
197 |
+ systemd_newunit "${FILESDIR}/ceph-mon_at.service" "ceph-mon@.service" |
198 |
+ systemd_install_serviced "${FILESDIR}/ceph-mon_at.service.conf" "ceph-mon@.service" |
199 |
+ |
200 |
+ python_fix_shebang \ |
201 |
+ "${ED}"/usr/sbin/{ceph-disk,ceph-create-keys} \ |
202 |
+ "${ED}"/usr/bin/{ceph,ceph-rest-api} |
203 |
+ |
204 |
+ #install udev rules |
205 |
+ udev_dorules udev/50-rbd.rules |
206 |
+ udev_dorules udev/95-ceph-osd.rules |
207 |
+ |
208 |
+ readme.gentoo_create_doc |
209 |
+} |
210 |
+ |
211 |
+pkg_postinst() { |
212 |
+ readme.gentoo_print_elog |
213 |
+} |
214 |
|
215 |
diff --git a/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch b/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch |
216 |
new file mode 100644 |
217 |
index 0000000..b225a6f |
218 |
--- /dev/null |
219 |
+++ b/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch |
220 |
@@ -0,0 +1,109 @@ |
221 |
+From b78a1be835706e7dabc505be343945d0ac05697d Mon Sep 17 00:00:00 2001 |
222 |
+From: Kefu Chai <kchai@××××××.com> |
223 |
+Date: Thu, 30 Jun 2016 13:24:22 +0800 |
224 |
+Subject: [PATCH] mon: Monitor: validate prefix on handle_command() |
225 |
+ |
226 |
+Fixes: http://tracker.ceph.com/issues/16297 |
227 |
+ |
228 |
+Signed-off-by: You Ji <youji@××××.com> |
229 |
+(cherry picked from commit 7cb3434fed03a5497abfd00bcec7276b70df0654) |
230 |
+ |
231 |
+Conflicts: |
232 |
+ src/mon/Monitor.cc (the signature of Monitor::reply_command() |
233 |
+ changed a little bit in master, so adapt the |
234 |
+ commit to work with the old method) |
235 |
+--- |
236 |
+ src/mon/Monitor.cc | 23 ++++++++++++++++++++++- |
237 |
+ src/test/librados/cmd.cc | 35 +++++++++++++++++++++++++++++++++++ |
238 |
+ 2 files changed, 57 insertions(+), 1 deletion(-) |
239 |
+ |
240 |
+diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc |
241 |
+index 48563ad..d499f0c 100644 |
242 |
+--- a/src/mon/Monitor.cc |
243 |
++++ b/src/mon/Monitor.cc |
244 |
+@@ -2565,7 +2565,19 @@ void Monitor::handle_command(MMonCommand *m) |
245 |
+ return; |
246 |
+ } |
247 |
+ |
248 |
+- cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); |
249 |
++ // check return value. If no prefix parameter provided, |
250 |
++ // return value will be false, then return error info. |
251 |
++ if(!cmd_getval(g_ceph_context, cmdmap, "prefix", prefix)) { |
252 |
++ reply_command(m, -EINVAL, "command prefix not found", 0); |
253 |
++ return; |
254 |
++ } |
255 |
++ |
256 |
++ // check prefix is empty |
257 |
++ if (prefix.empty()) { |
258 |
++ reply_command(m, -EINVAL, "command prefix must not be empty", 0); |
259 |
++ return; |
260 |
++ } |
261 |
++ |
262 |
+ if (prefix == "get_command_descriptions") { |
263 |
+ bufferlist rdata; |
264 |
+ Formatter *f = Formatter::create("json"); |
265 |
+@@ -2586,6 +2598,15 @@ void Monitor::handle_command(MMonCommand *m) |
266 |
+ boost::scoped_ptr<Formatter> f(Formatter::create(format)); |
267 |
+ |
268 |
+ get_str_vec(prefix, fullcmd); |
269 |
++ |
270 |
++ // make sure fullcmd is not empty. |
271 |
++ // invalid prefix will cause empty vector fullcmd. |
272 |
++ // such as, prefix=";,,;" |
273 |
++ if (fullcmd.empty()) { |
274 |
++ reply_command(m, -EINVAL, "command requires a prefix to be valid", 0); |
275 |
++ return; |
276 |
++ } |
277 |
++ |
278 |
+ module = fullcmd[0]; |
279 |
+ |
280 |
+ // validate command is in leader map |
281 |
+diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc |
282 |
+index 4f327a0..0a7ed16 100644 |
283 |
+--- a/src/test/librados/cmd.cc |
284 |
++++ b/src/test/librados/cmd.cc |
285 |
+@@ -49,6 +49,41 @@ TEST(LibRadosCmd, MonDescribe) { |
286 |
+ rados_buffer_free(buf); |
287 |
+ rados_buffer_free(st); |
288 |
+ |
289 |
++ cmd[0] = (char *)""; |
290 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "{}", 2, &buf, &buflen, &st, &stlen)); |
291 |
++ rados_buffer_free(buf); |
292 |
++ rados_buffer_free(st); |
293 |
++ |
294 |
++ cmd[0] = (char *)"{}"; |
295 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
296 |
++ rados_buffer_free(buf); |
297 |
++ rados_buffer_free(st); |
298 |
++ |
299 |
++ cmd[0] = (char *)"{\"abc\":\"something\"}"; |
300 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
301 |
++ rados_buffer_free(buf); |
302 |
++ rados_buffer_free(st); |
303 |
++ |
304 |
++ cmd[0] = (char *)"{\"prefix\":\"\"}"; |
305 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
306 |
++ rados_buffer_free(buf); |
307 |
++ rados_buffer_free(st); |
308 |
++ |
309 |
++ cmd[0] = (char *)"{\"prefix\":\" \"}"; |
310 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
311 |
++ rados_buffer_free(buf); |
312 |
++ rados_buffer_free(st); |
313 |
++ |
314 |
++ cmd[0] = (char *)"{\"prefix\":\";;;,,,;;,,\"}"; |
315 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
316 |
++ rados_buffer_free(buf); |
317 |
++ rados_buffer_free(st); |
318 |
++ |
319 |
++ cmd[0] = (char *)"{\"prefix\":\"extra command\"}"; |
320 |
++ ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
321 |
++ rados_buffer_free(buf); |
322 |
++ rados_buffer_free(st); |
323 |
++ |
324 |
+ cmd[0] = (char *)"{\"prefix\":\"mon_status\"}"; |
325 |
+ ASSERT_EQ(0, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); |
326 |
+ ASSERT_LT(0u, buflen); |
327 |
+-- |
328 |
+2.9.0 |
329 |
+ |