blob: d94b1143d370bb2511628272103ef26a3ae5dd3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
DESCRIPTION = "Highly available, distributed, eventually consistent object/blob store."
HOMEPAGE = "https://launchpad.net/swift"
SECTION = "devel/python"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
PR = "r0"
SRCNAME = "swift"
SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/icehouse \
file://proxy-server.conf \
file://dispersion.conf \
file://test.conf \
file://swift.init \
file://swift_setup.sh \
file://cluster.conf \
"
SRCREV="6946240c757d2ecc2e66f5054c5172b110084c89"
PV="1.13.1+git${SRCPV}"
S = "${WORKDIR}/git"
inherit setuptools python-dir update-rc.d hosts identity
# The size of the backing file (in Gigabytes) of loopback devices
# which are used for setting up Swift storage devices. The value
# of "0G" is for disabling loopback devices and using local
# filesystem as Swift storage device. In this case, the local
# filesystem of must support xattrs. e.g ext4
SWIFT_BACKING_FILE_SIZE ?= "2G"
do_install_append() {
SWIFT_CONF_DIR=${D}${sysconfdir}/swift
install -d ${SWIFT_CONF_DIR}
install -d ${D}${sysconfdir}/init.d/
install -m 600 ${S}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
install -m 600 ${WORKDIR}/proxy-server.conf ${SWIFT_CONF_DIR}/proxy-server.conf
install -m 600 ${S}/etc/account-server.conf-sample ${SWIFT_CONF_DIR}/account-server.conf
install -m 600 ${S}/etc/container-server.conf-sample ${SWIFT_CONF_DIR}/container-server.conf
install -m 600 ${S}/etc/object-server.conf-sample ${SWIFT_CONF_DIR}/object-server.conf
install -m 600 ${WORKDIR}/dispersion.conf ${SWIFT_CONF_DIR}/dispersion.conf
install -m 600 ${WORKDIR}/test.conf ${SWIFT_CONF_DIR}/test.conf
install -m 755 ${WORKDIR}/swift.init ${D}${sysconfdir}/init.d/swift
install -m 700 ${WORKDIR}/swift_setup.sh ${SWIFT_CONF_DIR}/swift_setup.sh
install -m 600 ${WORKDIR}/cluster.conf ${SWIFT_CONF_DIR}/cluster.conf
sed 's/^# bind_port =.*/bind_port = 6002/' -i ${SWIFT_CONF_DIR}/account-server.conf
sed 's/^# user =.*/user = root/' -i ${SWIFT_CONF_DIR}/account-server.conf
sed 's/^# swift_dir =.*/swift_dir = \/etc\/swift/' -i ${SWIFT_CONF_DIR}/account-server.conf
sed 's/^# devices =.*/devices = \/etc\/swift\/node/' -i ${SWIFT_CONF_DIR}/account-server.conf
sed 's/^# mount_check =.*/mount_check = false/' -i ${SWIFT_CONF_DIR}/account-server.conf
sed 's/^# bind_port =.*/bind_port = 6001/' -i ${SWIFT_CONF_DIR}/container-server.conf
sed 's/^# user =.*/user = root/' -i ${SWIFT_CONF_DIR}/container-server.conf
sed 's/^# swift_dir =.*/swift_dir = \/etc\/swift/' -i ${SWIFT_CONF_DIR}/container-server.conf
sed 's/^# devices =.*/devices = \/etc\/swift\/node/' -i ${SWIFT_CONF_DIR}/container-server.conf
sed 's/^# mount_check =.*/mount_check = false/' -i ${SWIFT_CONF_DIR}/container-server.conf
sed 's/^# bind_port =.*/bind_port = 6000/' -i ${SWIFT_CONF_DIR}/object-server.conf
sed 's/^# user =.*/user = root/' -i ${SWIFT_CONF_DIR}/object-server.conf
sed 's/^# swift_dir =.*/swift_dir = \/etc\/swift/' -i ${SWIFT_CONF_DIR}/object-server.conf
sed 's/^# devices =.*/devices = \/etc\/swift\/node/' -i ${SWIFT_CONF_DIR}/object-server.conf
sed 's/^# mount_check =.*/mount_check = false/' -i ${SWIFT_CONF_DIR}/object-server.conf
sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf
sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf
sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf
sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf
sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf
sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf
sed "s/%ADMIN_TENANT_NAME%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%ADMIN_USER%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%DEMO_USER%/demo/g" -i ${SWIFT_CONF_DIR}/test.conf
sed "s/%DEMO_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf
cp -r test ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/
grep -rl '^from test' ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/test | xargs sed 's/^from test/from swift\.test/g' -i
}
pkg_postinst_${SRCNAME}-setup () {
if [ "x$D" != "x" ]; then
exit 1
fi
CLUSTER_CONF=/etc/swift/cluster.conf
SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh'
for i in `seq 1 3`; do
BACKING_FILE=/etc/swift/swift_backing_$i
if [ "x${SWIFT_BACKING_FILE_SIZE}" != "x0G" ]; then
truncate -s ${SWIFT_BACKING_FILE_SIZE} $BACKING_FILE
sed "s:%SWIFT_BACKING_FILE_${i}%:$BACKING_FILE:g" -i $CLUSTER_CONF
else
sed "s:%SWIFT_BACKING_FILE_${i}%::g" -i $CLUSTER_CONF
fi
done
$SWIFT_SETUP createrings
$SWIFT_SETUP formatdevs
$SWIFT_SETUP mountdevs
$SWIFT_SETUP -i "${CONTROLLER_IP}" adddevs
$SWIFT_SETUP unmountdevs
}
PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup"
FILES_${PN} = "${libdir}/*\
"
FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/test.conf \
"
FILES_${SRCNAME}-setup = "${sysconfdir}/init.d/swift \
${sysconfdir}/${SRCNAME}/swift_setup.sh \
${sysconfdir}/${SRCNAME}/cluster.conf \
"
FILES_${SRCNAME} = "${bindir}/* \
${sysconfdir}/${SRCNAME}/* \
"
DEPENDS += " \
python-pip \
python-pbr \
"
RDEPENDS_${PN} += " \
python-eventlet \
python-greenlet \
python-pastedeploy \
python-simplejson \
python-swiftclient \
python-netifaces \
python-xattr \
python-pbr \
python-dnspython \
"
RDEPENDS_${SRCNAME} = "${PN}"
RDEPENDS_${SRCNAME} = "${PN}"
RDEPENDS_${SRCNAME}-setup = "${SRCNAME}"
INITSCRIPT_PACKAGES = "${SRCNAME}-setup"
INITSCRIPT_NAME_${SRCNAME}-setup = "swift"
INITSCRIPT_PARAMS_${SRCNAME}-setup = "defaults"
|