Enable swift by default.
- Set by default SWIFT_REPLICAS to 1 since this is the most common use
case when using it in devstack.
- If we have swift_replicas to 1 launch the object container account and
proxy servers in foreground in screen.
- Allow any s- services if we have just 'swift' in service enabled
instead of having to specify all s- services to enable swift. This will be
removed in the future.
Change-Id: I496f79e14f99bd7e9f2c7deee12a4b6e935c3a5b
diff --git a/lib/keystone b/lib/keystone
index a1a57f8..2e2471a 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -146,7 +146,7 @@
cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG
# Add swift endpoints to service catalog if swift is enabled
- if is_service_enabled swift; then
+ if is_service_enabled s-proxy; then
echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG
echo "catalog.RegionOne.object_store.adminURL = http://%SERVICE_HOST%:8080/" >> $KEYSTONE_CATALOG
echo "catalog.RegionOne.object_store.internalURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG
diff --git a/lib/swift b/lib/swift
index 5ba7e56..326c6f3 100644
--- a/lib/swift
+++ b/lib/swift
@@ -56,10 +56,11 @@
SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
# Set ``SWIFT_REPLICAS`` to configure how many replicas are to be
-# configured for your Swift cluster. By default the three replicas would need a
-# bit of IO and Memory on a VM you may want to lower that to 1 if you want to do
-# only some quick testing.
-SWIFT_REPLICAS=${SWIFT_REPLICAS:-3}
+# configured for your Swift cluster. By default we are configuring
+# only one replica since this is way less CPU and memory intensive. If
+# you are planning to test swift replication you may want to set this
+# up to 3.
+SWIFT_REPLICAS=${SWIFT_REPLICAS:-1}
SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS})
# Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE``
@@ -359,13 +360,26 @@
sudo systemctl start xinetd.service
fi
- # First spawn all the swift services then kill the
- # proxy service so we can run it in foreground in screen.
- # ``swift-init ... {stop|restart}`` exits with '1' if no servers are running,
- # ignore it just in case
+ # By default with only one replica we are launching the proxy,
+ # container, account and object server in screen in foreground and
+ # other services in background. If we have SWIFT_REPLICAS set to something
+ # greater than one we first spawn all the swift services then kill the proxy
+ # service so we can run it in foreground in screen. ``swift-init ...
+ # {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
- swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true
- screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
+ if [[ ${SWIFT_REPLICAS} == 1 ]];then
+ todo="object container account"
+ fi
+ 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
+ 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"
+ done
+ fi
}
# stop_swift() - Stop running processes (non-screen)