Merge "Fix Swift config dir variable name"
This commit is contained in:
commit
6d843c513f
43
lib/swift
43
lib/swift
@ -35,9 +35,10 @@ SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift}
|
||||
# Default is the common DevStack data directory.
|
||||
SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift}
|
||||
|
||||
# Set ``SWIFT_CONFIG_DIR`` to the location of the configuration files.
|
||||
# Set ``SWIFT_CONF_DIR`` to the location of the configuration files.
|
||||
# Default is ``/etc/swift``.
|
||||
SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
|
||||
# TODO(dtroyer): remove SWIFT_CONFIG_DIR after cutting stable/grizzly
|
||||
SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-${SWIFT_CONFIG_DIR:-/etc/swift}}
|
||||
|
||||
# DevStack will create a loop-back disk formatted as XFS to store the
|
||||
# swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in
|
||||
@ -77,7 +78,7 @@ ACCOUNT_PORT_BASE=6012
|
||||
|
||||
# cleanup_swift() - Remove residual data files
|
||||
function cleanup_swift() {
|
||||
rm -f ${SWIFT_CONFIG_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
||||
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
||||
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
||||
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
||||
fi
|
||||
@ -144,13 +145,13 @@ function configure_swift() {
|
||||
sudo chown -R $USER: ${node}
|
||||
done
|
||||
|
||||
sudo mkdir -p ${SWIFT_CONFIG_DIR}/{object,container,account}-server
|
||||
sudo chown -R $USER: ${SWIFT_CONFIG_DIR}
|
||||
sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server
|
||||
sudo chown -R $USER: ${SWIFT_CONF_DIR}
|
||||
|
||||
if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then
|
||||
if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then
|
||||
# Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed.
|
||||
# Create a symlink if the config dir is moved
|
||||
sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift
|
||||
sudo ln -sf ${SWIFT_CONF_DIR} /etc/swift
|
||||
fi
|
||||
|
||||
# Swift use rsync to synchronize between all the different
|
||||
@ -181,14 +182,14 @@ function configure_swift() {
|
||||
swift_auth_server=tempauth
|
||||
fi
|
||||
|
||||
SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONFIG_DIR}/proxy-server.conf
|
||||
SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONF_DIR}/proxy-server.conf
|
||||
cp ${SWIFT_DIR}/etc/proxy-server.conf-sample ${SWIFT_CONFIG_PROXY_SERVER}
|
||||
|
||||
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user
|
||||
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user ${USER}
|
||||
|
||||
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir
|
||||
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
|
||||
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONF_DIR}
|
||||
|
||||
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers
|
||||
iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers 1
|
||||
@ -238,8 +239,8 @@ use = egg:swift3#swift3
|
||||
EOF
|
||||
fi
|
||||
|
||||
cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
|
||||
iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
|
||||
cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
|
||||
iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
|
||||
|
||||
# This function generates an object/account/proxy configuration
|
||||
# emulating 4 nodes on different ports
|
||||
@ -258,7 +259,7 @@ EOF
|
||||
iniset ${swift_node_config} DEFAULT bind_port ${bind_port}
|
||||
|
||||
iniuncomment ${swift_node_config} DEFAULT swift_dir
|
||||
iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
|
||||
iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONF_DIR}
|
||||
|
||||
iniuncomment ${swift_node_config} DEFAULT devices
|
||||
iniset ${swift_node_config} DEFAULT devices ${node_path}
|
||||
@ -274,7 +275,7 @@ EOF
|
||||
}
|
||||
|
||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||
swift_node_config=${SWIFT_CONFIG_DIR}/object-server/${node_number}.conf
|
||||
swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
|
||||
cp ${SWIFT_DIR}/etc/object-server.conf-sample ${swift_node_config}
|
||||
generate_swift_config ${swift_node_config} ${node_number} $[OBJECT_PORT_BASE + 10 * (node_number - 1)]
|
||||
iniset ${swift_node_config} filter:recon recon_cache_path ${SWIFT_DATA_DIR}/cache
|
||||
@ -282,14 +283,14 @@ EOF
|
||||
# modification and make sure it works for new sections.
|
||||
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
||||
|
||||
swift_node_config=${SWIFT_CONFIG_DIR}/container-server/${node_number}.conf
|
||||
swift_node_config=${SWIFT_CONF_DIR}/container-server/${node_number}.conf
|
||||
cp ${SWIFT_DIR}/etc/container-server.conf-sample ${swift_node_config}
|
||||
generate_swift_config ${swift_node_config} ${node_number} $[CONTAINER_PORT_BASE + 10 * (node_number - 1)]
|
||||
iniuncomment ${swift_node_config} app:container-server allow_versions
|
||||
iniset ${swift_node_config} app:container-server allow_versions "true"
|
||||
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
||||
|
||||
swift_node_config=${SWIFT_CONFIG_DIR}/account-server/${node_number}.conf
|
||||
swift_node_config=${SWIFT_CONF_DIR}/account-server/${node_number}.conf
|
||||
cp ${SWIFT_DIR}/etc/account-server.conf-sample ${swift_node_config}
|
||||
generate_swift_config ${swift_node_config} ${node_number} $[ACCOUNT_PORT_BASE + 10 * (node_number - 1)]
|
||||
sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
|
||||
@ -316,7 +317,7 @@ function init_swift() {
|
||||
|
||||
# This is where we create three different rings for swift with
|
||||
# different object servers binding on different ports.
|
||||
pushd ${SWIFT_CONFIG_DIR} >/dev/null && {
|
||||
pushd ${SWIFT_CONF_DIR} >/dev/null && {
|
||||
|
||||
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
|
||||
|
||||
@ -371,16 +372,16 @@ function start_swift() {
|
||||
# {stop|restart}`` exits with '1' if no servers are running, ignore it just
|
||||
# in case
|
||||
swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
|
||||
if [[ ${SWIFT_REPLICAS} == 1 ]];then
|
||||
if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
||||
todo="object container account"
|
||||
fi
|
||||
for type in proxy ${todo};do
|
||||
for type in proxy ${todo}; do
|
||||
swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true
|
||||
done
|
||||
screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
|
||||
if [[ ${SWIFT_REPLICAS} == 1 ]];then
|
||||
screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF_DIR}/proxy-server.conf -v"
|
||||
if [[ ${SWIFT_REPLICAS} == 1 ]]; then
|
||||
for type in object container account;do
|
||||
screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONFIG_DIR}/${type}-server/1.conf -v"
|
||||
screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user