Revert "Use uwsgi for glance-api"
This reverts commite6217a9719
. 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 for43304849cf
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
This commit is contained in:
parent
43304849cf
commit
3410e3e01b
54
lib/apache
54
lib/apache
@ -275,64 +275,12 @@ function write_uwsgi_config {
|
||||
else
|
||||
local apache_conf=""
|
||||
apache_conf=$(apache_site_config_for $name)
|
||||
echo "SetEnv proxy-sendcl 1" | sudo tee $apache_conf
|
||||
echo "ProxyPass \"${url}\" \"unix:${socket}|uwsgi://uwsgi-uds-${name}/\" retry=0 " | sudo tee -a $apache_conf
|
||||
echo "ProxyPass \"${url}\" \"unix:${socket}|uwsgi://uwsgi-uds-${name}/\" retry=0 " | sudo tee $apache_conf
|
||||
enable_apache_site $name
|
||||
restart_apache_server
|
||||
fi
|
||||
}
|
||||
|
||||
# For services using chunked encoding, the only services known to use this
|
||||
# currently are Glance and Swift, we need to use an http proxy instead of
|
||||
# mod_proxy_uwsgi because the chunked encoding gets dropped. See:
|
||||
# https://github.com/unbit/uwsgi/issues/1540 You can workaround this on python2
|
||||
# but that involves having apache buffer the request before sending it to
|
||||
# uswgi.
|
||||
function write_local_uwsgi_http_config {
|
||||
local file=$1
|
||||
local wsgi=$2
|
||||
local url=$3
|
||||
name=$(basename $wsgi)
|
||||
|
||||
# create a home for the sockets; note don't use /tmp -- apache has
|
||||
# a private view of it on some platforms.
|
||||
|
||||
# always cleanup given that we are using iniset here
|
||||
rm -rf $file
|
||||
iniset "$file" uwsgi wsgi-file "$wsgi"
|
||||
port=$(get_random_port)
|
||||
iniset "$file" uwsgi http "127.0.0.1:$port"
|
||||
iniset "$file" uwsgi processes $API_WORKERS
|
||||
# This is running standalone
|
||||
iniset "$file" uwsgi master true
|
||||
# Set die-on-term & exit-on-reload so that uwsgi shuts down
|
||||
iniset "$file" uwsgi die-on-term true
|
||||
iniset "$file" uwsgi exit-on-reload true
|
||||
iniset "$file" uwsgi enable-threads true
|
||||
iniset "$file" uwsgi plugins python
|
||||
# uwsgi recommends this to prevent thundering herd on accept.
|
||||
iniset "$file" uwsgi thunder-lock true
|
||||
# Override the default size for headers from the 4k default.
|
||||
iniset "$file" uwsgi buffer-size 65535
|
||||
# Make sure the client doesn't try to re-use the connection.
|
||||
iniset "$file" uwsgi add-header "Connection: close"
|
||||
# This ensures that file descriptors aren't shared between processes.
|
||||
iniset "$file" uwsgi lazy-apps true
|
||||
iniset "$file" uwsgi chmod-socket 666
|
||||
iniset "$file" uwsgi http-raw-body true
|
||||
iniset "$file" uwsgi http-chunked-input true
|
||||
iniset "$file" uwsgi http-auto-chunked true
|
||||
|
||||
enable_apache_mod proxy
|
||||
enable_apache_mod proxy_http
|
||||
local apache_conf=""
|
||||
apache_conf=$(apache_site_config_for $name)
|
||||
echo "KeepAlive Off" | sudo tee $apache_conf
|
||||
echo "ProxyPass \"${url}\" \"http://127.0.0.1:$port\" retry=0 " | sudo tee -a $apache_conf
|
||||
enable_apache_site $name
|
||||
restart_apache_server
|
||||
}
|
||||
|
||||
function remove_uwsgi_config {
|
||||
local file=$1
|
||||
local wsgi=$2
|
||||
|
@ -335,7 +335,7 @@ function configure_cinder {
|
||||
|
||||
iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
|
||||
|
||||
iniset $CINDER_CONF DEFAULT glance_api_servers "$GLANCE_URL"
|
||||
iniset $CINDER_CONF DEFAULT glance_api_servers "${GLANCE_SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}"
|
||||
if is_service_enabled tls-proxy; then
|
||||
iniset $CINDER_CONF DEFAULT glance_protocol https
|
||||
iniset $CINDER_CONF DEFAULT glance_ca_certificates_file $SSL_BUNDLE_FILE
|
||||
|
44
lib/glance
44
lib/glance
@ -71,16 +71,6 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$GLANCE_SERVICE_HOST:$GLANCE_SERVICE_PORT}
|
||||
GLANCE_SERVICE_PROTOCOL=${GLANCE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||
GLANCE_REGISTRY_PORT=${GLANCE_REGISTRY_PORT:-9191}
|
||||
GLANCE_REGISTRY_PORT_INT=${GLANCE_REGISTRY_PORT_INT:-19191}
|
||||
GLANCE_UWSGI=$GLANCE_BIN_DIR/glance-wsgi-api
|
||||
GLANCE_UWSGI_CONF=$GLANCE_CONF_DIR/glance-uswgi.ini
|
||||
# If wsgi mode is uwsgi run glance under uwsgi, else default to eventlet
|
||||
# TODO(mtreinish): Remove the eventlet path here and in all the similar
|
||||
# conditionals below after the Pike release
|
||||
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
|
||||
GLANCE_URL="$GLANCE_SERVICE_PROTOCOL://$GLANCE_SERVICE_HOST/image"
|
||||
else
|
||||
GLANCE_URL="$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT"
|
||||
fi
|
||||
|
||||
# Functions
|
||||
# ---------
|
||||
@ -114,13 +104,16 @@ function configure_glance {
|
||||
dburl=`database_connection_url glance`
|
||||
iniset $GLANCE_REGISTRY_CONF database connection $dburl
|
||||
iniset $GLANCE_REGISTRY_CONF DEFAULT use_syslog $SYSLOG
|
||||
iniset $GLANCE_REGISTRY_CONF DEFAULT workers "$API_WORKERS"
|
||||
iniset $GLANCE_REGISTRY_CONF paste_deploy flavor keystone
|
||||
configure_auth_token_middleware $GLANCE_REGISTRY_CONF glance $GLANCE_AUTH_CACHE_DIR/registry
|
||||
iniset $GLANCE_REGISTRY_CONF oslo_messaging_notifications driver messagingv2
|
||||
iniset_rpc_backend glance $GLANCE_REGISTRY_CONF
|
||||
iniset $GLANCE_REGISTRY_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
|
||||
|
||||
cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
|
||||
iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
|
||||
iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
|
||||
inicomment $GLANCE_API_CONF DEFAULT log_file
|
||||
iniset $GLANCE_API_CONF database connection $dburl
|
||||
iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
|
||||
@ -148,6 +141,8 @@ function configure_glance {
|
||||
iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
|
||||
iniset $GLANCE_API_CONF DEFAULT registry_host $GLANCE_SERVICE_HOST
|
||||
|
||||
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
|
||||
|
||||
# CORS feature support - to allow calls from Horizon by default
|
||||
if [ -n "$GLANCE_CORS_ALLOWED_ORIGIN" ]; then
|
||||
iniset $GLANCE_API_CONF cors allowed_origin "$GLANCE_CORS_ALLOWED_ORIGIN"
|
||||
@ -186,12 +181,9 @@ function configure_glance {
|
||||
inicomment $GLANCE_API_CONF glance_store swift_store_auth_address
|
||||
fi
|
||||
|
||||
# We need to tell glance what it's public endpoint is so that the version
|
||||
# discovery document will be correct
|
||||
iniset $GLANCE_API_CONF DEFAULT public_endpoint $GLANCE_URL
|
||||
|
||||
if is_service_enabled tls-proxy; then
|
||||
iniset $GLANCE_API_CONF DEFAULT bind_port $GLANCE_SERVICE_PORT_INT
|
||||
iniset $GLANCE_API_CONF DEFAULT public_endpoint $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT
|
||||
iniset $GLANCE_REGISTRY_CONF DEFAULT bind_port $GLANCE_REGISTRY_PORT_INT
|
||||
|
||||
iniset $GLANCE_API_CONF keystone_authtoken identity_uri $KEYSTONE_AUTH_URI
|
||||
@ -207,6 +199,7 @@ function configure_glance {
|
||||
setup_logging $GLANCE_REGISTRY_CONF
|
||||
|
||||
cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
|
||||
|
||||
cp -p $GLANCE_DIR/etc/glance-api-paste.ini $GLANCE_API_PASTE_INI
|
||||
|
||||
cp $GLANCE_DIR/etc/glance-cache.conf $GLANCE_CACHE_CONF
|
||||
@ -239,13 +232,6 @@ function configure_glance {
|
||||
iniset $GLANCE_API_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s"
|
||||
iniset $GLANCE_CACHE_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s"
|
||||
fi
|
||||
|
||||
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
|
||||
write_local_uwsgi_http_config "$GLANCE_UWSGI_CONF" "$GLANCE_UWSGI" "/image"
|
||||
else
|
||||
iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
|
||||
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
|
||||
fi
|
||||
}
|
||||
|
||||
# create_glance_accounts() - Set up common required glance accounts
|
||||
@ -270,7 +256,7 @@ function create_glance_accounts {
|
||||
get_or_create_endpoint \
|
||||
"image" \
|
||||
"$REGION_NAME" \
|
||||
"$GLANCE_URL"
|
||||
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT"
|
||||
|
||||
# Note(frickler): Crude workaround for https://bugs.launchpad.net/glance-store/+bug/1620999
|
||||
service_domain_id=$(get_or_create_domain $SERVICE_DOMAIN_NAME)
|
||||
@ -337,21 +323,15 @@ function install_glance {
|
||||
function start_glance {
|
||||
local service_protocol=$GLANCE_SERVICE_PROTOCOL
|
||||
if is_service_enabled tls-proxy; then
|
||||
if [[ "$WSGI_MODE" != "uwsgi" ]]; then
|
||||
start_tls_proxy glance-service '*' $GLANCE_SERVICE_PORT $GLANCE_SERVICE_HOST $GLANCE_SERVICE_PORT_INT
|
||||
fi
|
||||
start_tls_proxy glance-service '*' $GLANCE_SERVICE_PORT $GLANCE_SERVICE_HOST $GLANCE_SERVICE_PORT_INT
|
||||
start_tls_proxy glance-registry '*' $GLANCE_REGISTRY_PORT $GLANCE_SERVICE_HOST $GLANCE_REGISTRY_PORT_INT
|
||||
fi
|
||||
|
||||
run_process g-reg "$GLANCE_BIN_DIR/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
|
||||
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
|
||||
run_process g-api "$GLANCE_BIN_DIR/uwsgi --ini $GLANCE_UWSGI_CONF"
|
||||
else
|
||||
run_process g-api "$GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
|
||||
fi
|
||||
run_process g-api "$GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
|
||||
|
||||
echo "Waiting for g-api ($GLANCE_SERVICE_HOST) to start..."
|
||||
if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_URL; then
|
||||
echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
|
||||
if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT; then
|
||||
die $LINENO "g-api did not start"
|
||||
fi
|
||||
}
|
||||
|
2
lib/nova
2
lib/nova
@ -575,7 +575,7 @@ function create_nova_conf {
|
||||
# enable notifications, but it will allow them to function when enabled.
|
||||
iniset $NOVA_CONF oslo_messaging_notifications driver "messagingv2"
|
||||
iniset_rpc_backend nova $NOVA_CONF
|
||||
iniset $NOVA_CONF glance api_servers "$GLANCE_URL"
|
||||
iniset $NOVA_CONF glance api_servers "${GLANCE_SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}"
|
||||
|
||||
iniset $NOVA_CONF DEFAULT osapi_compute_workers "$API_WORKERS"
|
||||
iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
|
||||
|
Loading…
Reference in New Issue
Block a user