Skip to content

Commit 3410e3e

Browse files
committed
Revert "Use uwsgi for glance-api"
This reverts commit e6217a9. Unfortunately it seems to break glance; for examples see some of the nodepool dib jobs which have all failed to upload images into glance. Note this has a revert for 4330484 as well, since that uses GLANCE_URL defined here. [1] http://logs.openstack.org/51/475051/2/gate/gate-dsvm-nodepool-redhat-src/e1bdb34/ [2] http://logs.openstack.org/51/475051/2/gate/gate-dsvm-nodepool-ubuntu-src/6a7665b/ [3] http://logs.openstack.org/51/475051/2/gate/gate-dsvm-nodepool-opensuse-src/b357de1/ Change-Id: I2aea120e733b05e806801121ec994f4e31a337d9
1 parent 4330484 commit 3410e3e

4 files changed

Lines changed: 15 additions & 87 deletions

File tree

lib/apache

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -275,64 +275,12 @@ function write_uwsgi_config {
275275
else
276276
local apache_conf=""
277277
apache_conf=$(apache_site_config_for $name)
278-
echo "SetEnv proxy-sendcl 1" | sudo tee $apache_conf
279-
echo "ProxyPass \"${url}\" \"unix:${socket}|uwsgi://uwsgi-uds-${name}/\" retry=0 " | sudo tee -a $apache_conf
278+
echo "ProxyPass \"${url}\" \"unix:${socket}|uwsgi://uwsgi-uds-${name}/\" retry=0 " | sudo tee $apache_conf
280279
enable_apache_site $name
281280
restart_apache_server
282281
fi
283282
}
284283

285-
# For services using chunked encoding, the only services known to use this
286-
# currently are Glance and Swift, we need to use an http proxy instead of
287-
# mod_proxy_uwsgi because the chunked encoding gets dropped. See:
288-
# https://github.com/unbit/uwsgi/issues/1540 You can workaround this on python2
289-
# but that involves having apache buffer the request before sending it to
290-
# uswgi.
291-
function write_local_uwsgi_http_config {
292-
local file=$1
293-
local wsgi=$2
294-
local url=$3
295-
name=$(basename $wsgi)
296-
297-
# create a home for the sockets; note don't use /tmp -- apache has
298-
# a private view of it on some platforms.
299-
300-
# always cleanup given that we are using iniset here
301-
rm -rf $file
302-
iniset "$file" uwsgi wsgi-file "$wsgi"
303-
port=$(get_random_port)
304-
iniset "$file" uwsgi http "127.0.0.1:$port"
305-
iniset "$file" uwsgi processes $API_WORKERS
306-
# This is running standalone
307-
iniset "$file" uwsgi master true
308-
# Set die-on-term & exit-on-reload so that uwsgi shuts down
309-
iniset "$file" uwsgi die-on-term true
310-
iniset "$file" uwsgi exit-on-reload true
311-
iniset "$file" uwsgi enable-threads true
312-
iniset "$file" uwsgi plugins python
313-
# uwsgi recommends this to prevent thundering herd on accept.
314-
iniset "$file" uwsgi thunder-lock true
315-
# Override the default size for headers from the 4k default.
316-
iniset "$file" uwsgi buffer-size 65535
317-
# Make sure the client doesn't try to re-use the connection.
318-
iniset "$file" uwsgi add-header "Connection: close"
319-
# This ensures that file descriptors aren't shared between processes.
320-
iniset "$file" uwsgi lazy-apps true
321-
iniset "$file" uwsgi chmod-socket 666
322-
iniset "$file" uwsgi http-raw-body true
323-
iniset "$file" uwsgi http-chunked-input true
324-
iniset "$file" uwsgi http-auto-chunked true
325-
326-
enable_apache_mod proxy
327-
enable_apache_mod proxy_http
328-
local apache_conf=""
329-
apache_conf=$(apache_site_config_for $name)
330-
echo "KeepAlive Off" | sudo tee $apache_conf
331-
echo "ProxyPass \"${url}\" \"http://127.0.0.1:$port\" retry=0 " | sudo tee -a $apache_conf
332-
enable_apache_site $name
333-
restart_apache_server
334-
}
335-
336284
function remove_uwsgi_config {
337285
local file=$1
338286
local wsgi=$2

lib/cinder

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function configure_cinder {
335335

336336
iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
337337

338-
iniset $CINDER_CONF DEFAULT glance_api_servers "$GLANCE_URL"
338+
iniset $CINDER_CONF DEFAULT glance_api_servers "${GLANCE_SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}"
339339
if is_service_enabled tls-proxy; then
340340
iniset $CINDER_CONF DEFAULT glance_protocol https
341341
iniset $CINDER_CONF DEFAULT glance_ca_certificates_file $SSL_BUNDLE_FILE

lib/glance

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$GLANCE_SERVICE_HOST:$GLANCE_SERVICE_PORT}
7171
GLANCE_SERVICE_PROTOCOL=${GLANCE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
7272
GLANCE_REGISTRY_PORT=${GLANCE_REGISTRY_PORT:-9191}
7373
GLANCE_REGISTRY_PORT_INT=${GLANCE_REGISTRY_PORT_INT:-19191}
74-
GLANCE_UWSGI=$GLANCE_BIN_DIR/glance-wsgi-api
75-
GLANCE_UWSGI_CONF=$GLANCE_CONF_DIR/glance-uswgi.ini
76-
# If wsgi mode is uwsgi run glance under uwsgi, else default to eventlet
77-
# TODO(mtreinish): Remove the eventlet path here and in all the similar
78-
# conditionals below after the Pike release
79-
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
80-
GLANCE_URL="$GLANCE_SERVICE_PROTOCOL://$GLANCE_SERVICE_HOST/image"
81-
else
82-
GLANCE_URL="$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT"
83-
fi
8474

8575
# Functions
8676
# ---------
@@ -114,13 +104,16 @@ function configure_glance {
114104
dburl=`database_connection_url glance`
115105
iniset $GLANCE_REGISTRY_CONF database connection $dburl
116106
iniset $GLANCE_REGISTRY_CONF DEFAULT use_syslog $SYSLOG
107+
iniset $GLANCE_REGISTRY_CONF DEFAULT workers "$API_WORKERS"
117108
iniset $GLANCE_REGISTRY_CONF paste_deploy flavor keystone
118109
configure_auth_token_middleware $GLANCE_REGISTRY_CONF glance $GLANCE_AUTH_CACHE_DIR/registry
119110
iniset $GLANCE_REGISTRY_CONF oslo_messaging_notifications driver messagingv2
120111
iniset_rpc_backend glance $GLANCE_REGISTRY_CONF
121112
iniset $GLANCE_REGISTRY_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
122113

114+
cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
123115
iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
116+
iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
124117
inicomment $GLANCE_API_CONF DEFAULT log_file
125118
iniset $GLANCE_API_CONF database connection $dburl
126119
iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
@@ -148,6 +141,8 @@ function configure_glance {
148141
iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
149142
iniset $GLANCE_API_CONF DEFAULT registry_host $GLANCE_SERVICE_HOST
150143

144+
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
145+
151146
# CORS feature support - to allow calls from Horizon by default
152147
if [ -n "$GLANCE_CORS_ALLOWED_ORIGIN" ]; then
153148
iniset $GLANCE_API_CONF cors allowed_origin "$GLANCE_CORS_ALLOWED_ORIGIN"
@@ -186,12 +181,9 @@ function configure_glance {
186181
inicomment $GLANCE_API_CONF glance_store swift_store_auth_address
187182
fi
188183

189-
# We need to tell glance what it's public endpoint is so that the version
190-
# discovery document will be correct
191-
iniset $GLANCE_API_CONF DEFAULT public_endpoint $GLANCE_URL
192-
193184
if is_service_enabled tls-proxy; then
194185
iniset $GLANCE_API_CONF DEFAULT bind_port $GLANCE_SERVICE_PORT_INT
186+
iniset $GLANCE_API_CONF DEFAULT public_endpoint $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT
195187
iniset $GLANCE_REGISTRY_CONF DEFAULT bind_port $GLANCE_REGISTRY_PORT_INT
196188

197189
iniset $GLANCE_API_CONF keystone_authtoken identity_uri $KEYSTONE_AUTH_URI
@@ -207,6 +199,7 @@ function configure_glance {
207199
setup_logging $GLANCE_REGISTRY_CONF
208200

209201
cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
202+
210203
cp -p $GLANCE_DIR/etc/glance-api-paste.ini $GLANCE_API_PASTE_INI
211204

212205
cp $GLANCE_DIR/etc/glance-cache.conf $GLANCE_CACHE_CONF
@@ -239,13 +232,6 @@ function configure_glance {
239232
iniset $GLANCE_API_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s"
240233
iniset $GLANCE_CACHE_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s"
241234
fi
242-
243-
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
244-
write_local_uwsgi_http_config "$GLANCE_UWSGI_CONF" "$GLANCE_UWSGI" "/image"
245-
else
246-
iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
247-
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
248-
fi
249235
}
250236

251237
# create_glance_accounts() - Set up common required glance accounts
@@ -270,7 +256,7 @@ function create_glance_accounts {
270256
get_or_create_endpoint \
271257
"image" \
272258
"$REGION_NAME" \
273-
"$GLANCE_URL"
259+
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT"
274260

275261
# Note(frickler): Crude workaround for https://bugs.launchpad.net/glance-store/+bug/1620999
276262
service_domain_id=$(get_or_create_domain $SERVICE_DOMAIN_NAME)
@@ -337,21 +323,15 @@ function install_glance {
337323
function start_glance {
338324
local service_protocol=$GLANCE_SERVICE_PROTOCOL
339325
if is_service_enabled tls-proxy; then
340-
if [[ "$WSGI_MODE" != "uwsgi" ]]; then
341-
start_tls_proxy glance-service '*' $GLANCE_SERVICE_PORT $GLANCE_SERVICE_HOST $GLANCE_SERVICE_PORT_INT
342-
fi
326+
start_tls_proxy glance-service '*' $GLANCE_SERVICE_PORT $GLANCE_SERVICE_HOST $GLANCE_SERVICE_PORT_INT
343327
start_tls_proxy glance-registry '*' $GLANCE_REGISTRY_PORT $GLANCE_SERVICE_HOST $GLANCE_REGISTRY_PORT_INT
344328
fi
345329

346330
run_process g-reg "$GLANCE_BIN_DIR/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
347-
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
348-
run_process g-api "$GLANCE_BIN_DIR/uwsgi --ini $GLANCE_UWSGI_CONF"
349-
else
350-
run_process g-api "$GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
351-
fi
331+
run_process g-api "$GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
352332

353-
echo "Waiting for g-api ($GLANCE_SERVICE_HOST) to start..."
354-
if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_URL; then
333+
echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
334+
if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT; then
355335
die $LINENO "g-api did not start"
356336
fi
357337
}

lib/nova

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ function create_nova_conf {
575575
# enable notifications, but it will allow them to function when enabled.
576576
iniset $NOVA_CONF oslo_messaging_notifications driver "messagingv2"
577577
iniset_rpc_backend nova $NOVA_CONF
578-
iniset $NOVA_CONF glance api_servers "$GLANCE_URL"
578+
iniset $NOVA_CONF glance api_servers "${GLANCE_SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}"
579579

580580
iniset $NOVA_CONF DEFAULT osapi_compute_workers "$API_WORKERS"
581581
iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"

0 commit comments

Comments
 (0)