Merge "Make Glance standalone-ness a separate flag"

This commit is contained in:
Zuul 2020-07-15 15:02:30 +00:00 committed by Gerrit Code Review
commit 12a88cfb76
3 changed files with 31 additions and 4 deletions

View File

@ -103,10 +103,10 @@ function _upload_image {
done
if [[ "$GLANCE_USE_IMPORT_WORKFLOW" == "True" ]]; then
if [[ "$WSGI_MODE" != "uwsgi" ]]; then
if [[ "$GLANCE_STANDALONE" == "True" ]]; then
useimport="--import"
else
echo "*** Unable to use glance import workflow because WSGI_MODE=uwsgi! ***"
echo "*** Unable to use glance import workflow because glance is not standalone! ***"
fi
fi

View File

@ -372,6 +372,25 @@ function write_local_uwsgi_http_config {
restart_apache_server
}
# Write a straight-through proxy for a service that runs locally and just needs
# to be reachable via the main http proxy at $loc
function write_local_proxy_http_config {
local name=$1
local url=$2
local loc=$3
local apache_conf
apache_conf=$(apache_site_config_for $name)
enable_apache_mod proxy
enable_apache_mod proxy_http
echo "KeepAlive Off" | sudo tee $apache_conf
echo "SetEnv proxy-sendchunked 1" | sudo tee -a $apache_conf
echo "ProxyPass \"${loc}\" \"$url\" retry=0 " | sudo tee -a $apache_conf
enable_apache_site $name
restart_apache_server
}
function remove_uwsgi_config {
local file=$1
local wsgi=$2

View File

@ -55,6 +55,13 @@ GLANCE_DEFAULT_BACKEND=${GLANCE_DEFAULT_BACKEND:-fast}
GLANCE_CACHE_DIR=${GLANCE_CACHE_DIR:=$DATA_DIR/glance/cache}
# Full Glance functionality requires running in standalone mode. If we are
# not in uwsgi mode, then we are standalone, otherwise allow separate control.
if [[ "$WSGI_MODE" != "uwsgi" ]]; then
GLANCE_STANDALONE=True
fi
GLANCE_STANDALONE=${GLANCE_STANDALONE:-False}
# File path for each store specified in GLANCE_MULTIPLE_FILE_STORES, the store
# identifier will be appended to this path at runtime. If GLANCE_MULTIPLE_FILE_STORES
# has fast,cheap specified then filepath will be generated like $DATA_DIR/glance/fast
@ -240,9 +247,10 @@ function configure_glance {
iniset $GLANCE_CACHE_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/%(project_id)s"
fi
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
if [[ "$GLANCE_STANDALONE" == False ]]; then
write_local_uwsgi_http_config "$GLANCE_UWSGI_CONF" "$GLANCE_UWSGI" "/image"
else
write_local_proxy_http_config glance "http://$GLANCE_SERVICE_HOST:$GLANCE_SERVICE_PORT_INT" "/image"
iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
fi
@ -342,7 +350,7 @@ function start_glance {
fi
fi
if [[ "$WSGI_MODE" == "uwsgi" ]]; then
if [[ "$GLANCE_STANDALONE" == False ]]; then
run_process g-api "$(which uwsgi) --procname-prefix glance-api --ini $GLANCE_UWSGI_CONF"
else
run_process g-api "$GLANCE_BIN_DIR/glance-api --config-dir=$GLANCE_CONF_DIR"