Skip to content

Commit 08fd641

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Enable swift by default."
2 parents 4f62018 + 0c3a558 commit 08fd641

11 files changed

+64
-35
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,21 @@ Example (Qpid):
8585

8686
# Swift
8787

88-
Swift is not installed by default, you can enable easily by adding this to your `localrc`:
88+
Swift is enabled by default configured with only one replica to avoid being IO/memory intensive on a small vm. When running with only one replica the account, container and object services will run directly in screen. The others services like replicator, updaters or auditor runs in background.
8989

90-
enable_service swift
90+
If you would like to disable Swift you can add this to your `localrc` :
91+
92+
disable_service s-proxy s-object s-container s-account
9193

9294
If you want a minimal Swift install with only Swift and Keystone you can have this instead in your `localrc`:
9395

9496
disable_all_services
95-
enable_service key mysql swift
97+
enable_service key mysql s-proxy s-object s-container s-account
98+
99+
If you only want to do some testing of a real normal swift cluster with multiple replicas you can do so by customizing the variable `SWIFT_REPLICAS` in your `localrc` (usually to 3).
96100

97-
If you use Swift with Keystone, Swift will authenticate against it. You will need to make sure to use the Keystone URL to auth against.
101+
# Swift S3
98102

99103
If you are enabling `swift3` in `ENABLED_SERVICES` devstack will install the swift3 middleware emulation. Swift will be configured to act as a S3 endpoint for Keystone so effectively replacing the `nova-objectstore`.
100104

101105
Only Swift proxy server is launched in the screen session all other services are started in background and managed by `swift-init` tool.
102-
103-
By default Swift will configure 3 replicas (and one spare) which could be IO intensive on a small vm, if you only want to do some quick testing of the API you can choose to only have one replica by customizing the variable `SWIFT_REPLICAS` in your `localrc`.

exercises/client-args.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fi
136136
# Swift client
137137
# ------------
138138

139-
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
139+
if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
140140
if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then
141141
STATUS_SWIFT="Skipped"
142142
else

exercises/client-env.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ fi
144144
# Swift client
145145
# ------------
146146

147-
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
147+
148+
if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
148149
if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then
149150
STATUS_SWIFT="Skipped"
150151
else

exercises/swift.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ source $TOP_DIR/exerciserc
3535

3636
# If swift is not enabled we exit with exitcode 55 which mean
3737
# exercise is skipped.
38-
is_service_enabled swift || exit 55
38+
is_service_enabled s-proxy || exit 55
3939

4040
# Container name
4141
CONTAINER=ex-swift

files/keystone_data.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ RESELLER_ROLE=$(get_id keystone role-create --name=ResellerAdmin)
5252
# Services
5353
# --------
5454

55-
if [[ "$ENABLED_SERVICES" =~ "n-api" ]] && [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
55+
if [[ "$ENABLED_SERVICES" =~ "n-api" ]] && [[ "$ENABLED_SERVICES" =~ "s-proxy" || "$ENABLED_SERVICES" =~ "swift" ]]; then
5656
NOVA_USER=$(keystone user-list | awk "/ nova / { print \$2 }")
5757
# Nova needs ResellerAdmin role to download images when accessing
5858
# swift through the s3 api.
@@ -123,7 +123,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
123123
fi
124124

125125
# Swift
126-
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
126+
127+
if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
127128
SWIFT_USER=$(get_id keystone user-create \
128129
--name=swift \
129130
--pass="$SERVICE_PASSWORD" \
@@ -190,7 +191,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
190191
fi
191192

192193
# S3
193-
if [[ "$ENABLED_SERVICES" =~ "n-obj" || "$ENABLED_SERVICES" =~ "swift" ]]; then
194+
if [[ "$ENABLED_SERVICES" =~ "n-obj" || "$ENABLED_SERVICES" =~ "swift3" ]]; then
194195
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
195196
S3_SERVICE=$(get_id keystone service-create \
196197
--name=s3 \

functions

+9
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ function get_packages() {
212212
if [[ ! $file_to_parse =~ ceilometer ]]; then
213213
file_to_parse="${file_to_parse} ceilometer"
214214
fi
215+
elif [[ $service == s-* ]]; then
216+
if [[ ! $file_to_parse =~ swift ]]; then
217+
file_to_parse="${file_to_parse} swift"
218+
fi
215219
elif [[ $service == n-* ]]; then
216220
if [[ ! $file_to_parse =~ nova ]]; then
217221
file_to_parse="${file_to_parse} nova"
@@ -649,6 +653,9 @@ function iniadd() {
649653
# **ceilometer** returns true if any service enabled start with **ceilometer**
650654
# **glance** returns true if any service enabled start with **g-**
651655
# **quantum** returns true if any service enabled start with **q-**
656+
# **swift** returns true if any service enabled start with **s-**
657+
# For backward compatibility if we have **swift** in ENABLED_SERVICES all the
658+
# **s-** services will be enabled. This will be deprecated in the future.
652659
#
653660
# Uses global ``ENABLED_SERVICES``
654661
# is_service_enabled service [service ...]
@@ -661,6 +668,8 @@ function is_service_enabled() {
661668
[[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0
662669
[[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
663670
[[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
671+
[[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && return 0
672+
[[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && return 0
664673
done
665674
return 1
666675
}

lib/keystone

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function configure_keystone() {
148148
cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG
149149

150150
# Add swift endpoints to service catalog if swift is enabled
151-
if is_service_enabled swift; then
151+
if is_service_enabled s-proxy; then
152152
echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG
153153
echo "catalog.RegionOne.object_store.adminURL = http://%SERVICE_HOST%:8080/" >> $KEYSTONE_CATALOG
154154
echo "catalog.RegionOne.object_store.internalURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG

lib/swift

+28-12
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
5656
SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
5757

5858
# Set ``SWIFT_REPLICAS`` to configure how many replicas are to be
59-
# configured for your Swift cluster. By default the three replicas would need a
60-
# bit of IO and Memory on a VM you may want to lower that to 1 if you want to do
61-
# only some quick testing.
62-
SWIFT_REPLICAS=${SWIFT_REPLICAS:-3}
59+
# configured for your Swift cluster. By default we are configuring
60+
# only one replica since this is way less CPU and memory intensive. If
61+
# you are planning to test swift replication you may want to set this
62+
# up to 3.
63+
SWIFT_REPLICAS=${SWIFT_REPLICAS:-1}
6364
SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS})
6465

6566
# Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE``
6667
# Port bases used in port number calclution for the service "nodes"
6768
# The specified port number will be used, the additinal ports calculated by
6869
# base_port + node_num * 10
69-
OBJECT_PORT_BASE=6010
70+
OBJECT_PORT_BASE=6013
7071
CONTAINER_PORT_BASE=6011
7172
ACCOUNT_PORT_BASE=6012
7273

@@ -362,19 +363,34 @@ function start_swift() {
362363
sudo systemctl start xinetd.service
363364
fi
364365

365-
# First spawn all the swift services then kill the
366-
# proxy service so we can run it in foreground in screen.
367-
# ``swift-init ... {stop|restart}`` exits with '1' if no servers are running,
368-
# ignore it just in case
366+
# By default with only one replica we are launching the proxy,
367+
# container, account and object server in screen in foreground and
368+
# other services in background. If we have SWIFT_REPLICAS set to something
369+
# greater than one we first spawn all the swift services then kill the proxy
370+
# service so we can run it in foreground in screen. ``swift-init ...
371+
# {stop|restart}`` exits with '1' if no servers are running, ignore it just
372+
# in case
369373
swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
370-
swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true
371-
screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
374+
if [[ ${SWIFT_REPLICAS} == 1 ]];then
375+
todo="object container account"
376+
fi
377+
for type in proxy ${todo};do
378+
swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true
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
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"
384+
done
385+
fi
372386
}
373387

374388
# stop_swift() - Stop running processes (non-screen)
375389
function stop_swift() {
376390
# screen normally killed by unstack.sh
377-
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
391+
if type -p swift-init >/dev/null;then
392+
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
393+
fi
378394
}
379395

380396
# Restore xtrace

stack.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ if is_service_enabled rabbit; then
407407
read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
408408
fi
409409

410-
if is_service_enabled swift; then
410+
if is_service_enabled s-proxy; then
411411
# If we are using swift3, we can default the s3 port to swift instead
412412
# of nova-objectstore
413413
if is_service_enabled swift3;then
@@ -644,12 +644,12 @@ install_novaclient
644644
git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
645645

646646
# glance, swift middleware and nova api needs keystone middleware
647-
if is_service_enabled key g-api n-api swift; then
647+
if is_service_enabled key g-api n-api s-proxy; then
648648
# unified auth system (manages accounts/tokens)
649649
install_keystone
650650
fi
651651

652-
if is_service_enabled swift; then
652+
if is_service_enabled s-proxy; then
653653
install_swiftclient
654654
install_swift
655655
if is_service_enabled swift3; then
@@ -706,10 +706,10 @@ echo_summary "Configuring OpenStack projects"
706706
configure_keystoneclient
707707
configure_novaclient
708708
setup_develop $OPENSTACKCLIENT_DIR
709-
if is_service_enabled key g-api n-api swift; then
709+
if is_service_enabled key g-api n-api s-proxy; then
710710
configure_keystone
711711
fi
712-
if is_service_enabled swift; then
712+
if is_service_enabled s-proxy; then
713713
configure_swift
714714
configure_swiftclient
715715
if is_service_enabled swift3; then
@@ -893,7 +893,7 @@ if is_service_enabled g-reg; then
893893
init_glance
894894

895895
# Store the images in swift if enabled.
896-
if is_service_enabled swift; then
896+
if is_service_enabled s-proxy; then
897897
iniset $GLANCE_API_CONF DEFAULT default_store swift
898898
iniset $GLANCE_API_CONF DEFAULT swift_store_auth_address $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/
899899
iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance
@@ -952,7 +952,7 @@ fi
952952
# Storage Service
953953
# ---------------
954954

955-
if is_service_enabled swift; then
955+
if is_service_enabled s-proxy; then
956956
echo_summary "Configuring Swift"
957957
init_swift
958958
fi
@@ -1098,7 +1098,7 @@ fi
10981098
# Only run the services specified in ``ENABLED_SERVICES``
10991099

11001100
# Launch Swift Services
1101-
if is_service_enabled swift; then
1101+
if is_service_enabled s-proxy; then
11021102
echo_summary "Starting Swift"
11031103
start_swift
11041104
fi

stackrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fi
2121
# ``disable_service`` functions in ``localrc``.
2222
# For example, to enable Swift add this to ``localrc``:
2323
# enable_service swift
24-
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql
24+
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,s-proxy,s-account,s-object,s-container,horizon,rabbit,tempest,mysql
2525

2626
# Set the default Nova APIs to enable
2727
NOVA_ENABLED_APIS=ec2,osapi_compute,metadata

unstack.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ if [[ -n "$SCREEN" ]]; then
6363
fi
6464

6565
# Swift runs daemons
66-
if is_service_enabled swift; then
66+
if is_service_enabled s-proxy; then
6767
stop_swift
6868
cleanup_swift
6969
fi

0 commit comments

Comments
 (0)