Browse code

Use default swift pipeline and add extras.

- By default use the default pipeline as shipped with swift.
- Add option SWIFT_EXTRAS_MIDDLEWARE which by default include tempurl
formpost staticweb bulk to enable extra featuress.
- Clean pids in cleanup_swift Fix bug 1140364.

Rebased

Change-Id: Ida537ae8d3e319a5b84546f82ebf00615f070be1

Chmouel Boudjnah authored on 2013/02/23 12:00:51
Showing 1 changed files
... ...
@@ -46,6 +46,10 @@ SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-${SWIFT_CONFIG_DIR:-/etc/swift}}
46 46
 # Default is 1 gigabyte.
47 47
 SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
48 48
 
49
+# Set ``SWIFT_EXTRAS_MIDDLEWARE`` to extras middlewares.
50
+# Default is ``staticweb, tempurl, bulk, formpost``
51
+SWIFT_EXTRAS_MIDDLEWARE=${SWIFT_EXTRAS_MIDDLEWARE:-tempurl formpost staticweb bulk}
52
+
49 53
 # The ring uses a configurable number of bits from a path’s MD5 hash as
50 54
 # a partition index that designates a device. The number of bits kept
51 55
 # from the hash is known as the partition power, and 2 to the partition
... ...
@@ -85,11 +89,12 @@ function cleanup_swift() {
85 85
    if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
86 86
       rm ${SWIFT_DATA_DIR}/drives/images/swift.img
87 87
    fi
88
+   rm -rf ${SWIFT_DATA_DIR}/run/
88 89
 }
89 90
 
90 91
 # configure_swift() - Set config files, create data dirs and loop image
91 92
 function configure_swift() {
92
-    local swift_auth_server
93
+    local swift_pipeline=" "
93 94
     local node_number
94 95
     local swift_node_config
95 96
     local swift_log_dir
... ...
@@ -200,10 +205,21 @@ function configure_swift() {
200 200
     iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port
201 201
     iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080}
202 202
 
203
-    # Only enable Swift3 if we have it enabled in ENABLED_SERVICES
204
-    is_service_enabled swift3 && swift3=swift3 || swift3=""
205
-
206
-    iniset ${SWIFT_CONFIG_PROXY_SERVER} pipeline:main pipeline "catch_errors healthcheck cache ratelimit ${swift3} ${swift_auth_server} proxy-logging proxy-server"
203
+    # By default Swift will be installed with the tempauth middleware
204
+    # which has some default username and password if you have
205
+    # configured keystone it will configure swift with it.
206
+    if is_service_enabled key;then
207
+        if is_service_enabled swift3;then
208
+            swift_pipeline=" s3token swift3 "
209
+        fi
210
+        swift_pipeline+=" authtoken keystoneauth "
211
+    else
212
+        if is_service_enabled swift3;then
213
+            swift_pipeline=" swift3 "
214
+        fi
215
+        swift_pipeline+=" tempauth "
216
+    fi
217
+    sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER}
207 218
 
208 219
     iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true
209 220