- 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.
- Set object server starting at 6013 instead of 6010 to not conflict
with remote ssh x11 forwarding.
Change-Id: I890b6953b70283bfa0927fff0cf5e92f3c08455b
... | ... |
@@ -85,19 +85,21 @@ Example (Qpid): |
85 | 85 |
|
86 | 86 |
# Swift |
87 | 87 |
|
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. |
|
89 | 89 |
|
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 |
|
91 | 93 |
|
92 | 94 |
If you want a minimal Swift install with only Swift and Keystone you can have this instead in your `localrc`: |
93 | 95 |
|
94 | 96 |
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). |
|
96 | 100 |
|
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 |
|
98 | 102 |
|
99 | 103 |
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`. |
100 | 104 |
|
101 | 105 |
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`. |
... | ... |
@@ -136,7 +136,7 @@ fi |
136 | 136 |
# Swift client |
137 | 137 |
# ------------ |
138 | 138 |
|
139 |
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
139 |
+if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then |
|
140 | 140 |
if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then |
141 | 141 |
STATUS_SWIFT="Skipped" |
142 | 142 |
else |
... | ... |
@@ -144,7 +144,8 @@ fi |
144 | 144 |
# Swift client |
145 | 145 |
# ------------ |
146 | 146 |
|
147 |
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
147 |
+ |
|
148 |
+if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then |
|
148 | 149 |
if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then |
149 | 150 |
STATUS_SWIFT="Skipped" |
150 | 151 |
else |
... | ... |
@@ -52,7 +52,7 @@ RESELLER_ROLE=$(get_id keystone role-create --name=ResellerAdmin) |
52 | 52 |
# Services |
53 | 53 |
# -------- |
54 | 54 |
|
55 |
-if [[ "$ENABLED_SERVICES" =~ "n-api" ]] && [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
55 |
+if [[ "$ENABLED_SERVICES" =~ "n-api" ]] && [[ "$ENABLED_SERVICES" =~ "s-proxy" || "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
56 | 56 |
NOVA_USER=$(keystone user-list | awk "/ nova / { print \$2 }") |
57 | 57 |
# Nova needs ResellerAdmin role to download images when accessing |
58 | 58 |
# swift through the s3 api. |
... | ... |
@@ -123,7 +123,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then |
123 | 123 |
fi |
124 | 124 |
|
125 | 125 |
# Swift |
126 |
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
126 |
+ |
|
127 |
+if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then |
|
127 | 128 |
SWIFT_USER=$(get_id keystone user-create \ |
128 | 129 |
--name=swift \ |
129 | 130 |
--pass="$SERVICE_PASSWORD" \ |
... | ... |
@@ -190,7 +191,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then |
190 | 190 |
fi |
191 | 191 |
|
192 | 192 |
# S3 |
193 |
-if [[ "$ENABLED_SERVICES" =~ "n-obj" || "$ENABLED_SERVICES" =~ "swift" ]]; then |
|
193 |
+if [[ "$ENABLED_SERVICES" =~ "n-obj" || "$ENABLED_SERVICES" =~ "swift3" ]]; then |
|
194 | 194 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
195 | 195 |
S3_SERVICE=$(get_id keystone service-create \ |
196 | 196 |
--name=s3 \ |
... | ... |
@@ -181,6 +181,10 @@ function get_packages() { |
181 | 181 |
if [[ ! $file_to_parse =~ ceilometer ]]; then |
182 | 182 |
file_to_parse="${file_to_parse} ceilometer" |
183 | 183 |
fi |
184 |
+ elif [[ $service == s-* ]]; then |
|
185 |
+ if [[ ! $file_to_parse =~ swift ]]; then |
|
186 |
+ file_to_parse="${file_to_parse} swift" |
|
187 |
+ fi |
|
184 | 188 |
elif [[ $service == n-* ]]; then |
185 | 189 |
if [[ ! $file_to_parse =~ nova ]]; then |
186 | 190 |
file_to_parse="${file_to_parse} nova" |
... | ... |
@@ -566,6 +570,9 @@ $option = $value |
566 | 566 |
# **ceilometer** returns true if any service enabled start with **ceilometer** |
567 | 567 |
# **glance** returns true if any service enabled start with **g-** |
568 | 568 |
# **quantum** returns true if any service enabled start with **q-** |
569 |
+# **swift** returns true if any service enabled start with **s-** |
|
570 |
+# For backward compatibility if we have **swift** in ENABLED_SERVICES all the |
|
571 |
+# **s-** services will be enabled. This will be deprecated in the future. |
|
569 | 572 |
# |
570 | 573 |
# Uses global ``ENABLED_SERVICES`` |
571 | 574 |
# is_service_enabled service [service ...] |
... | ... |
@@ -578,6 +585,8 @@ function is_service_enabled() { |
578 | 578 |
[[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0 |
579 | 579 |
[[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0 |
580 | 580 |
[[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0 |
581 |
+ [[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && return 0 |
|
582 |
+ [[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && return 0 |
|
581 | 583 |
done |
582 | 584 |
return 1 |
583 | 585 |
} |
... | ... |
@@ -146,7 +146,7 @@ function configure_keystone() { |
146 | 146 |
cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG |
147 | 147 |
|
148 | 148 |
# Add swift endpoints to service catalog if swift is enabled |
149 |
- if is_service_enabled swift; then |
|
149 |
+ if is_service_enabled s-proxy; then |
|
150 | 150 |
echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG |
151 | 151 |
echo "catalog.RegionOne.object_store.adminURL = http://%SERVICE_HOST%:8080/" >> $KEYSTONE_CATALOG |
152 | 152 |
echo "catalog.RegionOne.object_store.internalURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG |
... | ... |
@@ -56,17 +56,18 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000} |
56 | 56 |
SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9} |
57 | 57 |
|
58 | 58 |
# 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} |
|
63 | 64 |
SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS}) |
64 | 65 |
|
65 | 66 |
# Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE`` |
66 | 67 |
# Port bases used in port number calclution for the service "nodes" |
67 | 68 |
# The specified port number will be used, the additinal ports calculated by |
68 | 69 |
# base_port + node_num * 10 |
69 |
-OBJECT_PORT_BASE=6010 |
|
70 |
+OBJECT_PORT_BASE=6013 |
|
70 | 71 |
CONTAINER_PORT_BASE=6011 |
71 | 72 |
ACCOUNT_PORT_BASE=6012 |
72 | 73 |
|
... | ... |
@@ -359,19 +360,34 @@ function start_swift() { |
359 | 359 |
sudo systemctl start xinetd.service |
360 | 360 |
fi |
361 | 361 |
|
362 |
- # First spawn all the swift services then kill the |
|
363 |
- # proxy service so we can run it in foreground in screen. |
|
364 |
- # ``swift-init ... {stop|restart}`` exits with '1' if no servers are running, |
|
365 |
- # ignore it just in case |
|
362 |
+ # By default with only one replica we are launching the proxy, |
|
363 |
+ # container, account and object server in screen in foreground and |
|
364 |
+ # other services in background. If we have SWIFT_REPLICAS set to something |
|
365 |
+ # greater than one we first spawn all the swift services then kill the proxy |
|
366 |
+ # service so we can run it in foreground in screen. ``swift-init ... |
|
367 |
+ # {stop|restart}`` exits with '1' if no servers are running, ignore it just |
|
368 |
+ # in case |
|
366 | 369 |
swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true |
367 |
- swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true |
|
368 |
- screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v" |
|
370 |
+ if [[ ${SWIFT_REPLICAS} == 1 ]];then |
|
371 |
+ todo="object container account" |
|
372 |
+ fi |
|
373 |
+ for type in proxy ${todo};do |
|
374 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true |
|
375 |
+ done |
|
376 |
+ screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v" |
|
377 |
+ if [[ ${SWIFT_REPLICAS} == 1 ]];then |
|
378 |
+ for type in object container account;do |
|
379 |
+ screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONFIG_DIR}/${type}-server/1.conf -v" |
|
380 |
+ done |
|
381 |
+ fi |
|
369 | 382 |
} |
370 | 383 |
|
371 | 384 |
# stop_swift() - Stop running processes (non-screen) |
372 | 385 |
function stop_swift() { |
373 | 386 |
# screen normally killed by unstack.sh |
374 |
- swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true |
|
387 |
+ if type -p swift-init >/dev/null;then |
|
388 |
+ swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true |
|
389 |
+ fi |
|
375 | 390 |
} |
376 | 391 |
|
377 | 392 |
# Restore xtrace |
... | ... |
@@ -425,7 +425,7 @@ if is_service_enabled rabbit; then |
425 | 425 |
read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT." |
426 | 426 |
fi |
427 | 427 |
|
428 |
-if is_service_enabled swift; then |
|
428 |
+if is_service_enabled s-proxy; then |
|
429 | 429 |
# If we are using swift3, we can default the s3 port to swift instead |
430 | 430 |
# of nova-objectstore |
431 | 431 |
if is_service_enabled swift3;then |
... | ... |
@@ -662,12 +662,12 @@ install_novaclient |
662 | 662 |
git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH |
663 | 663 |
|
664 | 664 |
# glance, swift middleware and nova api needs keystone middleware |
665 |
-if is_service_enabled key g-api n-api swift; then |
|
665 |
+if is_service_enabled key g-api n-api s-proxy; then |
|
666 | 666 |
# unified auth system (manages accounts/tokens) |
667 | 667 |
install_keystone |
668 | 668 |
fi |
669 | 669 |
|
670 |
-if is_service_enabled swift; then |
|
670 |
+if is_service_enabled s-proxy; then |
|
671 | 671 |
install_swiftclient |
672 | 672 |
install_swift |
673 | 673 |
if is_service_enabled swift3; then |
... | ... |
@@ -724,10 +724,10 @@ echo_summary "Configuring OpenStack projects" |
724 | 724 |
configure_keystoneclient |
725 | 725 |
configure_novaclient |
726 | 726 |
setup_develop $OPENSTACKCLIENT_DIR |
727 |
-if is_service_enabled key g-api n-api swift; then |
|
727 |
+if is_service_enabled key g-api n-api s-proxy; then |
|
728 | 728 |
configure_keystone |
729 | 729 |
fi |
730 |
-if is_service_enabled swift; then |
|
730 |
+if is_service_enabled s-proxy; then |
|
731 | 731 |
configure_swift |
732 | 732 |
configure_swiftclient |
733 | 733 |
if is_service_enabled swift3; then |
... | ... |
@@ -911,7 +911,7 @@ if is_service_enabled g-reg; then |
911 | 911 |
init_glance |
912 | 912 |
|
913 | 913 |
# Store the images in swift if enabled. |
914 |
- if is_service_enabled swift; then |
|
914 |
+ if is_service_enabled s-proxy; then |
|
915 | 915 |
iniset $GLANCE_API_CONF DEFAULT default_store swift |
916 | 916 |
iniset $GLANCE_API_CONF DEFAULT swift_store_auth_address $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ |
917 | 917 |
iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance |
... | ... |
@@ -970,7 +970,7 @@ fi |
970 | 970 |
# Storage Service |
971 | 971 |
# --------------- |
972 | 972 |
|
973 |
-if is_service_enabled swift; then |
|
973 |
+if is_service_enabled s-proxy; then |
|
974 | 974 |
echo_summary "Configuring Swift" |
975 | 975 |
init_swift |
976 | 976 |
fi |
... | ... |
@@ -1117,7 +1117,7 @@ fi |
1117 | 1117 |
# Only run the services specified in ``ENABLED_SERVICES`` |
1118 | 1118 |
|
1119 | 1119 |
# Launch Swift Services |
1120 |
-if is_service_enabled swift; then |
|
1120 |
+if is_service_enabled s-proxy; then |
|
1121 | 1121 |
echo_summary "Starting Swift" |
1122 | 1122 |
start_swift |
1123 | 1123 |
fi |
... | ... |
@@ -21,7 +21,7 @@ fi |
21 | 21 |
# ``disable_service`` functions in ``localrc``. |
22 | 22 |
# For example, to enable Swift add this to ``localrc``: |
23 | 23 |
# 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 |
|
25 | 25 |
|
26 | 26 |
# Set the default Nova APIs to enable |
27 | 27 |
NOVA_ENABLED_APIS=ec2,osapi_compute,metadata |