Browse code

Support Glance CORS options in devstack configuration

To properly test the integration between Glance CORS feature and
Horizon Javascript environment uploading image files directly to Glance
(using this feature), we need to enable CORS support for Glance in
integration tests. Adding corresponding Devstack variable to configure
Glance in such a way that it accepts direct requests from Horizon
Javascript is the prerequisite step for the integration testing of this
feature.

By default Horizon and Glance are located on the same host, hence
default value cors.allowed_origin = http://$SERVICE_HOST should work.
If a more complicated setup is desired, where Horizon is located on a
different host, GLANCE_CORS_ALLOWED_ORIGIN environment variable should
be exported to Devstack.

Partially implements blueprint: horizon-glance-large-image-upload
Change-Id: I4881fb6631c2daa2ad8946210eff4bb021957374

Timur Sufiev authored on 2016/04/29 20:08:51
Showing 1 changed files
... ...
@@ -143,6 +143,13 @@ function configure_glance {
143 143
 
144 144
     iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
145 145
 
146
+    # CORS feature support - to allow calls from Horizon by default
147
+    if [ -n "$GLANCE_CORS_ALLOWED_ORIGIN" ]; then
148
+        iniset $GLANCE_API_CONF cors allowed_origin "$GLANCE_CORS_ALLOWED_ORIGIN"
149
+    else
150
+        iniset $GLANCE_API_CONF cors allowed_origin "http://$SERVICE_HOST"
151
+    fi
152
+
146 153
     # Store the images in swift if enabled.
147 154
     if is_service_enabled s-proxy; then
148 155
         iniset $GLANCE_API_CONF glance_store default_store swift