Since EXPERIMENTAL Glance v3 API has been removed in favor of
standalone API implementation was added we need to add some
changes in devstack to support it.
Implements blueprint: move-v3-to-glare
Depends-On: I5b7bd4cdcc5f2a40fc4a5f74bcc422fd700c4fb0
Change-Id: Iced3c68010eb6bcd2a6a1ec8f1c6883f84cbe77f
| ... | ... |
@@ -55,6 +55,8 @@ GLANCE_CACHE_CONF=$GLANCE_CONF_DIR/glance-cache.conf |
| 55 | 55 |
GLANCE_POLICY_JSON=$GLANCE_CONF_DIR/policy.json |
| 56 | 56 |
GLANCE_SCHEMA_JSON=$GLANCE_CONF_DIR/schema-image.json |
| 57 | 57 |
GLANCE_SWIFT_STORE_CONF=$GLANCE_CONF_DIR/glance-swift-store.conf |
| 58 |
+GLANCE_GLARE_CONF=$GLANCE_CONF_DIR/glance-glare.conf |
|
| 59 |
+GLANCE_GLARE_PASTE_INI=$GLANCE_CONF_DIR/glance-glare-paste.ini |
|
| 58 | 60 |
|
| 59 | 61 |
if is_ssl_enabled_service "glance" || is_service_enabled tls-proxy; then |
| 60 | 62 |
GLANCE_SERVICE_PROTOCOL="https" |
| ... | ... |
@@ -69,6 +71,8 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$GLANCE_SERVICE_HOST:$GLANCE_SERVICE_PORT}
|
| 69 | 69 |
GLANCE_SERVICE_PROTOCOL=${GLANCE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
| 70 | 70 |
GLANCE_REGISTRY_PORT=${GLANCE_REGISTRY_PORT:-9191}
|
| 71 | 71 |
GLANCE_REGISTRY_PORT_INT=${GLANCE_REGISTRY_PORT_INT:-19191}
|
| 72 |
+GLANCE_GLARE_PORT=${GLANCE_GLARE_PORT:-9494}
|
|
| 73 |
+GLANCE_GLARE_HOSTPORT=${GLANCE_GLARE_HOSTPORT:-$GLANCE_SERVICE_HOST:$GLANCE_GLARE_PORT}
|
|
| 72 | 74 |
|
| 73 | 75 |
# Functions |
| 74 | 76 |
# --------- |
| ... | ... |
@@ -93,6 +97,9 @@ function configure_glance {
|
| 93 | 93 |
sudo install -d -o $STACK_USER $GLANCE_CONF_DIR $GLANCE_METADEF_DIR |
| 94 | 94 |
|
| 95 | 95 |
# Copy over our glance configurations and update them |
| 96 |
+ if is_service_enabled g-glare; then |
|
| 97 |
+ cp $GLANCE_DIR/etc/glance-glare.conf $GLANCE_GLARE_CONF |
|
| 98 |
+ fi |
|
| 96 | 99 |
cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF |
| 97 | 100 |
iniset $GLANCE_REGISTRY_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
| 98 | 101 |
iniset $GLANCE_REGISTRY_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS |
| ... | ... |
@@ -129,6 +136,9 @@ function configure_glance {
|
| 129 | 129 |
|
| 130 | 130 |
# Store specific configs |
| 131 | 131 |
iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/ |
| 132 |
+ if is_service_enabled g-glare; then |
|
| 133 |
+ iniset $GLANCE_GLARE_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/ |
|
| 134 |
+ fi |
|
| 132 | 135 |
iniset $GLANCE_API_CONF DEFAULT registry_host $GLANCE_SERVICE_HOST |
| 133 | 136 |
|
| 134 | 137 |
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS" |
| ... | ... |
@@ -144,6 +154,23 @@ function configure_glance {
|
| 144 | 144 |
iniset $GLANCE_API_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT" |
| 145 | 145 |
|
| 146 | 146 |
iniset $GLANCE_SWIFT_STORE_CONF ref1 user $SERVICE_PROJECT_NAME:glance-swift |
| 147 |
+ |
|
| 148 |
+ # Store the glare in swift if enabled. |
|
| 149 |
+ if is_service_enabled g-glare; then |
|
| 150 |
+ iniset $GLANCE_GLARE_CONF glance_store default_store swift |
|
| 151 |
+ iniset $GLANCE_GLARE_CONF glance_store swift_store_create_container_on_put True |
|
| 152 |
+ |
|
| 153 |
+ iniset $GLANCE_GLARE_CONF glance_store swift_store_config_file $GLANCE_SWIFT_STORE_CONF |
|
| 154 |
+ iniset $GLANCE_GLARE_CONF glance_store default_swift_reference ref1 |
|
| 155 |
+ iniset $GLANCE_GLARE_CONF glance_store stores "file, http, swift" |
|
| 156 |
+ iniset $GLANCE_GLARE_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT" |
|
| 157 |
+ |
|
| 158 |
+ # commenting is not strictly necessary but it's confusing to have bad values in conf |
|
| 159 |
+ inicomment $GLANCE_GLARE_CONF glance_store swift_store_user |
|
| 160 |
+ inicomment $GLANCE_GLARE_CONF glance_store swift_store_key |
|
| 161 |
+ inicomment $GLANCE_GLARE_CONF glance_store swift_store_auth_address |
|
| 162 |
+ fi |
|
| 163 |
+ |
|
| 147 | 164 |
iniset $GLANCE_SWIFT_STORE_CONF ref1 key $SERVICE_PASSWORD |
| 148 | 165 |
iniset $GLANCE_SWIFT_STORE_CONF ref1 auth_address $KEYSTONE_SERVICE_URI/v3 |
| 149 | 166 |
iniset $GLANCE_SWIFT_STORE_CONF ref1 user_domain_id default |
| ... | ... |
@@ -220,6 +247,29 @@ function configure_glance {
|
| 220 | 220 |
iniset $GLANCE_API_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s" |
| 221 | 221 |
iniset $GLANCE_CACHE_CONF DEFAULT cinder_endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s" |
| 222 | 222 |
fi |
| 223 |
+ |
|
| 224 |
+ # Configure GLANCE_GLARE (Glance Glare) |
|
| 225 |
+ if is_service_enabled g-glare; then |
|
| 226 |
+ local dburl |
|
| 227 |
+ dburl=`database_connection_url glance` |
|
| 228 |
+ setup_colorized_logging $GLANCE_GLARE_CONF DEFAULT tenant user |
|
| 229 |
+ iniset $GLANCE_GLARE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
|
| 230 |
+ iniset $GLANCE_GLARE_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS |
|
| 231 |
+ iniset $GLANCE_GLARE_CONF DEFAULT bind_port $GLANCE_GLARE_PORT |
|
| 232 |
+ inicomment $GLANCE_GLARE_CONF DEFAULT log_file |
|
| 233 |
+ iniset $GLANCE_GLARE_CONF DEFAULT workers "$API_WORKERS" |
|
| 234 |
+ |
|
| 235 |
+ iniset $GLANCE_GLARE_CONF database connection $dburl |
|
| 236 |
+ iniset $GLANCE_GLARE_CONF paste_deploy flavor keystone |
|
| 237 |
+ configure_auth_token_middleware $GLANCE_GLARE_CONF glare $GLANCE_AUTH_CACHE_DIR/artifact |
|
| 238 |
+ # Register SSL certificates if provided |
|
| 239 |
+ if is_ssl_enabled_service glance; then |
|
| 240 |
+ ensure_certificates GLANCE |
|
| 241 |
+ iniset $GLANCE_GLARE_CONF DEFAULT cert_file "$GLANCE_SSL_CERT" |
|
| 242 |
+ iniset $GLANCE_GLARE_CONF DEFAULT key_file "$GLANCE_SSL_KEY" |
|
| 243 |
+ fi |
|
| 244 |
+ cp $GLANCE_DIR/etc/glance-glare-paste.ini $GLANCE_GLARE_PASTE_INI |
|
| 245 |
+ fi |
|
| 223 | 246 |
} |
| 224 | 247 |
|
| 225 | 248 |
# create_glance_accounts() - Set up common required glance accounts |
| ... | ... |
@@ -229,6 +279,7 @@ function configure_glance {
|
| 229 | 229 |
# SERVICE_PROJECT_NAME glance service |
| 230 | 230 |
# SERVICE_PROJECT_NAME glance-swift ResellerAdmin (if Swift is enabled) |
| 231 | 231 |
# SERVICE_PROJECT_NAME glance-search search (if Search is enabled) |
| 232 |
+# SERVICE_PROJECT_NAME glare service (if enabled) |
|
| 232 | 233 |
|
| 233 | 234 |
function create_glance_accounts {
|
| 234 | 235 |
if is_service_enabled g-api; then |
| ... | ... |
@@ -252,13 +303,25 @@ function create_glance_accounts {
|
| 252 | 252 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" \ |
| 253 | 253 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" |
| 254 | 254 |
fi |
| 255 |
+ |
|
| 256 |
+ # Add glance-glare service and endpoints |
|
| 257 |
+ if is_service_enabled g-glare; then |
|
| 258 |
+ create_service_user "glare" |
|
| 259 |
+ get_or_create_service "glare" "artifact" "Glance Artifact Service" |
|
| 260 |
+ |
|
| 261 |
+ get_or_create_endpoint "artifact" \ |
|
| 262 |
+ "$REGION_NAME" \ |
|
| 263 |
+ "$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \ |
|
| 264 |
+ "$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \ |
|
| 265 |
+ "$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" |
|
| 266 |
+ fi |
|
| 255 | 267 |
} |
| 256 | 268 |
|
| 257 | 269 |
# create_glance_cache_dir() - Part of the init_glance() process |
| 258 | 270 |
function create_glance_cache_dir {
|
| 259 | 271 |
# Create cache dir |
| 260 |
- sudo install -d -o $STACK_USER $GLANCE_AUTH_CACHE_DIR/api $GLANCE_AUTH_CACHE_DIR/registry $GLANCE_AUTH_CACHE_DIR/search |
|
| 261 |
- rm -f $GLANCE_AUTH_CACHE_DIR/api/* $GLANCE_AUTH_CACHE_DIR/registry/* $GLANCE_AUTH_CACHE_DIR/search/* |
|
| 272 |
+ sudo install -d -o $STACK_USER $GLANCE_AUTH_CACHE_DIR/api $GLANCE_AUTH_CACHE_DIR/registry $GLANCE_AUTH_CACHE_DIR/search $GLANCE_AUTH_CACHE_DIR/artifact |
|
| 273 |
+ rm -f $GLANCE_AUTH_CACHE_DIR/api/* $GLANCE_AUTH_CACHE_DIR/registry/* $GLANCE_AUTH_CACHE_DIR/search/* $GLANCE_AUTH_CACHE_DIR/artifact/* |
|
| 262 | 274 |
} |
| 263 | 275 |
|
| 264 | 276 |
# init_glance() - Initialize databases, etc. |
| ... | ... |
@@ -326,6 +389,15 @@ function start_glance {
|
| 326 | 326 |
if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT; then |
| 327 | 327 |
die $LINENO "g-api did not start" |
| 328 | 328 |
fi |
| 329 |
+ |
|
| 330 |
+ #Start g-glare after g-reg/g-api/g-search |
|
| 331 |
+ if is_service_enabled g-glare; then |
|
| 332 |
+ run_process g-glare "$GLANCE_BIN_DIR/glance-glare --config-file=$GLANCE_CONF_DIR/glance-glare.conf" |
|
| 333 |
+ echo "Waiting for Glare [g-glare] ($GLANCE_GLARE_HOSTPORT) to start..." |
|
| 334 |
+ if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT; then |
|
| 335 |
+ die $LINENO " Glare [g-glare] did not start" |
|
| 336 |
+ fi |
|
| 337 |
+ fi |
|
| 329 | 338 |
} |
| 330 | 339 |
|
| 331 | 340 |
# stop_glance() - Stop running processes |
| ... | ... |
@@ -333,6 +405,10 @@ function stop_glance {
|
| 333 | 333 |
# Kill the Glance screen windows |
| 334 | 334 |
stop_process g-api |
| 335 | 335 |
stop_process g-reg |
| 336 |
+ |
|
| 337 |
+ if is_service_enabled g-glare; then |
|
| 338 |
+ stop_process g-glare |
|
| 339 |
+ fi |
|
| 336 | 340 |
} |
| 337 | 341 |
|
| 338 | 342 |
# Restore xtrace |