Make Glance standalone-ness a separate flag
Full Glance functionality requires Glance being run in a configuration where it can spawn long-running task threads. The default uwsgi mode does not allow this, and the current workaround is to set WSGI_MODE to something other than uwsgi to get the devstack code to deploy Glance as a standalone service. Since this affects the entire rest of the deployment, this patch separates out a flag to control this behavior specifically for Glance. When WSGI_MODE=uwsgi, control of the Glance deployment mechanism is allowed via GLANCE_STANDALONE=True|False. If WSGI_MODE!= uwsgi then we deploy standalone Glance anyway. Change-Id: I79068ce0bd7414bc48ff534ee22f0de5d7b091cb
This commit is contained in:
parent
73ad9760a3
commit
09eea0b20b
@ -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
|
||||
|
||||
|
19
lib/apache
19
lib/apache
@ -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
|
||||
|
12
lib/glance
12
lib/glance
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user