|
...
|
...
|
@@ -35,9 +35,10 @@ SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift}
|
|
35
|
35
|
# Default is the common DevStack data directory.
|
|
36
|
36
|
SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift}
|
|
37
|
37
|
|
|
38
|
|
-# Set ``SWIFT_CONFIG_DIR`` to the location of the configuration files.
|
|
|
38
|
+# Set ``SWIFT_CONF_DIR`` to the location of the configuration files.
|
|
39
|
39
|
# Default is ``/etc/swift``.
|
|
40
|
|
-SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
|
|
|
40
|
+# TODO(dtroyer): remove SWIFT_CONFIG_DIR after cutting stable/grizzly
|
|
|
41
|
+SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-${SWIFT_CONFIG_DIR:-/etc/swift}}
|
|
41
|
42
|
|
|
42
|
43
|
# DevStack will create a loop-back disk formatted as XFS to store the
|
|
43
|
44
|
# swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in
|
|
...
|
...
|
@@ -77,7 +78,7 @@ ACCOUNT_PORT_BASE=6012
|
|
77
|
77
|
|
|
78
|
78
|
# cleanup_swift() - Remove residual data files
|
|
79
|
79
|
function cleanup_swift() {
|
|
80
|
|
- rm -f ${SWIFT_CONFIG_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
|
|
80
|
+ rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
|
81
|
81
|
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
82
|
82
|
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
|
83
|
83
|
fi
|
|
...
|
...
|
@@ -144,13 +145,13 @@ function configure_swift() {
|
|
144
|
144
|
sudo chown -R $USER: ${node}
|
|
145
|
145
|
done
|
|
146
|
146
|
|
|
147
|
|
- sudo mkdir -p ${SWIFT_CONFIG_DIR}/{object,container,account}-server
|
|
148
|
|
- sudo chown -R $USER: ${SWIFT_CONFIG_DIR}
|
|
|
147
|
+ sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server
|
|
|
148
|
+ sudo chown -R $USER: ${SWIFT_CONF_DIR}
|
|
149
|
149
|
|
|
150
|
|
- if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then
|
|
|
150
|
+ if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then
|
|
151
|
151
|
# Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed.
|
|
152
|
152
|
# Create a symlink if the config dir is moved
|
|
153
|
|
- sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift
|
|
|
153
|
+ sudo ln -sf ${SWIFT_CONF_DIR} /etc/swift
|
|
154
|
154
|
fi
|
|
155
|
155
|
|
|
156
|
156
|
# Swift use rsync to synchronize between all the different
|
|
...
|
...
|
@@ -181,14 +182,14 @@ function configure_swift() {
|
|
181
|
181
|
swift_auth_server=tempauth
|
|
182
|
182
|
fi
|
|
183
|
183
|
|
|
184
|
|
- SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONFIG_DIR}/proxy-server.conf
|
|
|
184
|
+ SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONF_DIR}/proxy-server.conf
|
|
185
|
185
|
cp ${SWIFT_DIR}/etc/proxy-server.conf-sample ${SWIFT_CONFIG_PROXY_SERVER}
|
|
186
|
186
|
|
|
187
|
187
|
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user
|
|
188
|
188
|
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user ${USER}
|
|
189
|
189
|
|
|
190
|
190
|
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir
|
|
191
|
|
- iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
|
|
|
191
|
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONF_DIR}
|
|
192
|
192
|
|
|
193
|
193
|
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers
|
|
194
|
194
|
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers 1
|
|
...
|
...
|
@@ -238,8 +239,8 @@ use = egg:swift3#swift3
|
|
238
|
238
|
EOF
|
|
239
|
239
|
fi
|
|
240
|
240
|
|
|
241
|
|
- cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
|
|
242
|
|
- iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
|
|
|
241
|
+ cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
|
|
|
242
|
+ iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
|
|
243
|
243
|
|
|
244
|
244
|
# This function generates an object/account/proxy configuration
|
|
245
|
245
|
# emulating 4 nodes on different ports
|
|
...
|
...
|
@@ -258,7 +259,7 @@ EOF
|
|
258
|
258
|
iniset ${swift_node_config} DEFAULT bind_port ${bind_port}
|
|
259
|
259
|
|
|
260
|
260
|
iniuncomment ${swift_node_config} DEFAULT swift_dir
|
|
261
|
|
- iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
|
|
|
261
|
+ iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONF_DIR}
|
|
262
|
262
|
|
|
263
|
263
|
iniuncomment ${swift_node_config} DEFAULT devices
|
|
264
|
264
|
iniset ${swift_node_config} DEFAULT devices ${node_path}
|
|
...
|
...
|
@@ -274,7 +275,7 @@ EOF
|
|
274
|
274
|
}
|
|
275
|
275
|
|
|
276
|
276
|
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
|
277
|
|
- swift_node_config=${SWIFT_CONFIG_DIR}/object-server/${node_number}.conf
|
|
|
277
|
+ swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
|
|
278
|
278
|
cp ${SWIFT_DIR}/etc/object-server.conf-sample ${swift_node_config}
|
|
279
|
279
|
generate_swift_config ${swift_node_config} ${node_number} $[OBJECT_PORT_BASE + 10 * (node_number - 1)]
|
|
280
|
280
|
iniset ${swift_node_config} filter:recon recon_cache_path ${SWIFT_DATA_DIR}/cache
|
|
...
|
...
|
@@ -282,14 +283,14 @@ EOF
|
|
282
|
282
|
# modification and make sure it works for new sections.
|
|
283
|
283
|
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
|
284
|
284
|
|
|
285
|
|
- swift_node_config=${SWIFT_CONFIG_DIR}/container-server/${node_number}.conf
|
|
|
285
|
+ swift_node_config=${SWIFT_CONF_DIR}/container-server/${node_number}.conf
|
|
286
|
286
|
cp ${SWIFT_DIR}/etc/container-server.conf-sample ${swift_node_config}
|
|
287
|
287
|
generate_swift_config ${swift_node_config} ${node_number} $[CONTAINER_PORT_BASE + 10 * (node_number - 1)]
|
|
288
|
288
|
iniuncomment ${swift_node_config} app:container-server allow_versions
|
|
289
|
289
|
iniset ${swift_node_config} app:container-server allow_versions "true"
|
|
290
|
290
|
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
|
291
|
291
|
|
|
292
|
|
- swift_node_config=${SWIFT_CONFIG_DIR}/account-server/${node_number}.conf
|
|
|
292
|
+ swift_node_config=${SWIFT_CONF_DIR}/account-server/${node_number}.conf
|
|
293
|
293
|
cp ${SWIFT_DIR}/etc/account-server.conf-sample ${swift_node_config}
|
|
294
|
294
|
generate_swift_config ${swift_node_config} ${node_number} $[ACCOUNT_PORT_BASE + 10 * (node_number - 1)]
|
|
295
|
295
|
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
|
...
|
...
|
@@ -316,7 +317,7 @@ function init_swift() {
|
|
316
|
316
|
|
|
317
|
317
|
# This is where we create three different rings for swift with
|
|
318
|
318
|
# different object servers binding on different ports.
|
|
319
|
|
- pushd ${SWIFT_CONFIG_DIR} >/dev/null && {
|
|
|
319
|
+ pushd ${SWIFT_CONF_DIR} >/dev/null && {
|
|
320
|
320
|
|
|
321
|
321
|
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
|
|
322
|
322
|
|
|
...
|
...
|
@@ -371,16 +372,16 @@ function start_swift() {
|
|
371
|
371
|
# {stop|restart}`` exits with '1' if no servers are running, ignore it just
|
|
372
|
372
|
# in case
|
|
373
|
373
|
swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
|
|
374
|
|
- if [[ ${SWIFT_REPLICAS} == 1 ]];then
|
|
|
374
|
+ if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
|
375
|
375
|
todo="object container account"
|
|
376
|
376
|
fi
|
|
377
|
|
- for type in proxy ${todo};do
|
|
|
377
|
+ for type in proxy ${todo}; do
|
|
378
|
378
|
swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true
|
|
379
|
379
|
done
|
|
380
|
|
- screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
|
|
381
|
|
- if [[ ${SWIFT_REPLICAS} == 1 ]];then
|
|
|
380
|
+ screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF_DIR}/proxy-server.conf -v"
|
|
|
381
|
+ if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
|
382
|
382
|
for type in object container account;do
|
|
383
|
|
- screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONFIG_DIR}/${type}-server/1.conf -v"
|
|
|
383
|
+ screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v"
|
|
384
|
384
|
done
|
|
385
|
385
|
fi
|
|
386
|
386
|
}
|