Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-extended / ceph / ceph_14.1.0.bbappend
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:${THISDIR}/files:"
17
18 inherit python3native python3-dir
19
20 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
21
22 SRC_URI += "\
23         file://0001-ceph-rebase-on-stx.3.0-and-warrior.patch \
24         file://ceph.conf \
25         file://ceph-init-wrapper.sh \
26         file://ceph-preshutdown.sh \
27         file://ceph.service \
28         file://mgr-restful-plugin.py \
29         file://starlingx-docker-override.conf \
30         file://ceph.conf.pmon \
31         file://ceph-manage-journal.py \
32         file://ceph-radosgw.service \
33         file://ceph.sh \
34         file://mgr-restful-plugin.service \
35         file://rados.runtime.decode.error.patch \
36         "
37 DEPENDS = "boost rdma-core bzip2 curl expat gperf-native \
38                 keyutils libaio lz4 \
39                 nspr nss oath openldap openssl \
40                 python3 python3-cython-native rocksdb snappy udev \
41                 python-cython-native valgrind xfsprogs zlib \
42                 rabbitmq-c \
43                 "
44 RDEPENDS_${PN} += " rdma-core python3-core python3 xfsprogs-mkfs python3-prettytable"
45
46
47 EXTRA_OECMAKE = "-DWITH_MANPAGE=OFF \
48                  -DWITH_FUSE=OFF \
49                  -DWITH_SPDK=OFF \
50                  -DWITH_LEVELDB=OFF \
51                  -DWITH_LTTNG=OFF \
52                  -DWITH_BABELTRACE=OFF \
53                  -DWITH_TESTS=OFF \
54                  -DWITH_MGR=ON \
55                  -DWITH_PYTHON2=OFF \
56                  -DWITH_PYTHON3=ON \
57                  -DMGR_PYTHON_VERSION=3 \
58                  -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
59                  -DWITH_SYSTEM_BOOST=ON \
60                  -DWITH_SYSTEM_ROCKSDB=ON \
61                  -DWITH_RDMA=OFF \
62                  -DWITH_RADOSGW_AMQP_ENDPOINT=OFF \
63                  "
64
65 # TODO: Should be fixed in either boost package or CMake files. 
66 #do_configure_prepend() {
67 #       ln -f -s ${WORKDIR}/recipe-sysroot/usr/lib/libboost_python35.so \
68 #               ${WORKDIR}/recipe-sysroot/usr/lib/libboost_python.so
69 #}
70
71 do_install_append () {
72     install -d ${D}${sysconfdir}/ceph
73     install -m 0644 ${WORKDIR}/ceph.conf ${D}${sysconfdir}/ceph/
74     install -m 0644 ${WORKDIR}/ceph-radosgw.service ${D}${systemd_system_unitdir}/ceph-radosgw@.service
75     install -m 0644 ${WORKDIR}/ceph.service ${D}${systemd_system_unitdir}
76     install -m 0644 ${WORKDIR}/mgr-restful-plugin.service ${D}${systemd_system_unitdir}
77
78     install -m 0700 ${WORKDIR}/ceph-manage-journal.py ${D}${sbindir}/ceph-manage-journal
79     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/rc.d/init.d/mgr-restful-plugin
80     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/init.d/mgr-restful-plugin
81     install -m 0750 ${WORKDIR}/ceph.conf.pmon ${D}${sysconfdir}/ceph/
82
83     install -d -m 0750 ${D}${sysconfdir}/services.d/controller
84     install -d -m 0750 ${D}${sysconfdir}/services.d/storage
85     install -d -m 0750 ${D}${sysconfdir}/services.d/worker
86
87     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/controller
88     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/storage
89     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/worker
90
91     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper
92     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/init.d/ceph-init-wrapper
93     sed -i -e 's|/usr/lib64|${libdir}|' ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper ${D}${sysconfdir}/init.d/ceph-init-wrapper
94
95     install -m 0700 ${WORKDIR}/ceph-preshutdown.sh ${D}${sbindir}/ceph-preshutdown.sh
96     
97     install -Dm 0644 ${WORKDIR}/starlingx-docker-override.conf ${D}${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf
98
99     install -m 0644 -D ${S}/src/etc-rbdmap ${D}${sysconfdir}/ceph/rbdmap 
100     install -m 0644 -D ${S}/etc/sysconfig/ceph ${D}${sysconfdir}/sysconfig/ceph
101     install -m 0644 -D ${S}/src/logrotate.conf ${D}${sysconfdir}/logrotate.d/ceph
102
103     install -m 0644 -D ${S}/COPYING ${D}${docdir}/ceph/COPYING    
104     install -m 0644 -D ${S}/etc/sysctl/90-ceph-osd.conf ${D}${libdir}/sysctl.d/90-ceph-osd.conf
105     install -m 0644 -D ${S}/udev/50-rbd.rules ${D}${libdir}/udev/rules.d/50-rbd.rules
106     # install -m 0644 -D ${S}/udev/60-ceph-by-parttypeuuid.rules ${D}${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules
107
108     mkdir -p ${D}${localstatedir}/ceph
109     mkdir -p ${D}${localstatedir}/log/ceph
110     mkdir -p ${D}${localstatedir}/lib/ceph/tmp
111     mkdir -p ${D}${localstatedir}/lib/ceph/mon
112     mkdir -p ${D}${localstatedir}/lib/ceph/osd
113     mkdir -p ${D}${localstatedir}/lib/ceph/mds
114     mkdir -p ${D}${localstatedir}/lib/ceph/mgr
115     mkdir -p ${D}${localstatedir}/lib/ceph/radosgw
116     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-osd
117     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mds
118     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rgw
119     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mgr
120     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rbd
121     mkdir -p ${D}${localstatedir}/lib/ceph/crash/posted
122
123     install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
124     echo "d ${localstatedir}/run/ceph 0755 ceph ceph -" >> ${D}/${sysconfdir}/tmpfiles.d/ceph.conf
125
126     install -m 0755 ${D}${libdir}/ceph/ceph_common.sh ${D}${libexecdir}/ceph
127
128     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
129     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/init.d/ceph-radosgw
130     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
131     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/init.d/ceph-radosgw
132     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/rc.d/init.d/rbdmap
133     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/init.d/rbdmap
134     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/rc.d/init.d/ceph
135     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/init.d/ceph
136     install -d -m 0750 ${D}${localstatedir}/log/radosgw 
137
138     sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph
139     # sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph-disk
140     # sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph-detect-init
141
142     sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph-crash
143     sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph-volume
144     sed -i -e 's:${WORKDIR}.*python3:${bindir}/python3:' ${D}${bindir}/ceph-volume-systemd
145     #sed -i -e '1s:python$:python3:' ${D}${bindir}/ceph-volume
146     #sed -i -e '1s:python$:python3:' ${D}${bindir}/ceph-volume-systemd
147     sed -i -e 's:/sbin/:/bin/:' ${D}${systemd_system_unitdir}/ceph-volume@.service
148 }
149
150 TARGET_CC_ARCH += "${LDFLAGS}"
151 RDEPENDS_${PN} += "\
152         bash \
153 "
154
155 FILES_${PN} += "\
156         ${localstatedir} \
157         ${docdir}/ceph/COPYING \
158         ${libdir}/sysctl.d/90-ceph-osd.conf \
159         ${libdir}/udev/rules.d/50-rbd.rules \
160         ${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules \
161         ${systemd_system_unitdir}/mgr-restful-plugin.service \
162         ${systemd_system_unitdir}/ceph-radosgw@.service \
163         ${systemd_system_unitdir}/ceph.service \
164         ${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf \
165         home/root/cluster/ceph-mon_config.sh \
166         home/root/cluster/ceph-mgr_manual.sh \
167         home/root/cluster/ceph-volume_manual.sh \
168 "
169 # /run/ceph