|
...
|
...
|
@@ -41,9 +41,29 @@ else
|
|
41
|
41
|
GLANCE_BIN_DIR=$(get_python_exec_prefix)
|
|
42
|
42
|
fi
|
|
43
|
43
|
|
|
|
44
|
+# Glance multi-store configuration
|
|
|
45
|
+# Boolean flag to enable multiple store configuration for glance
|
|
|
46
|
+GLANCE_ENABLE_MULTIPLE_STORES=$(trueorfalse False GLANCE_ENABLE_MULTIPLE_STORES)
|
|
|
47
|
+
|
|
|
48
|
+# Comma separated list for configuring multiple file stores of glance,
|
|
|
49
|
+# for example; GLANCE_MULTIPLE_FILE_STORES = fast,cheap,slow
|
|
|
50
|
+GLANCE_MULTIPLE_FILE_STORES=${GLANCE_MULTIPLE_FILE_STORES:-fast}
|
|
|
51
|
+
|
|
|
52
|
+# Default store/backend for glance, must be one of the store specified
|
|
|
53
|
+# in GLANCE_MULTIPLE_FILE_STORES option.
|
|
|
54
|
+GLANCE_DEFAULT_BACKEND=${GLANCE_DEFAULT_BACKEND:-fast}
|
|
|
55
|
+
|
|
44
|
56
|
GLANCE_CACHE_DIR=${GLANCE_CACHE_DIR:=$DATA_DIR/glance/cache}
|
|
|
57
|
+
|
|
|
58
|
+# File path for each store specified in GLANCE_MULTIPLE_FILE_STORES, the store
|
|
|
59
|
+# identifier will be appended to this path at runtime. If GLANCE_MULTIPLE_FILE_STORES
|
|
|
60
|
+# has fast,cheap specified then filepath will be generated like $DATA_DIR/glance/fast
|
|
|
61
|
+# and $DATA_DIR/glance/cheap.
|
|
|
62
|
+GLANCE_MULTISTORE_FILE_IMAGE_DIR=${GLANCE_MULTISTORE_FILE_IMAGE_DIR:=$DATA_DIR/glance}
|
|
45
|
63
|
GLANCE_IMAGE_DIR=${GLANCE_IMAGE_DIR:=$DATA_DIR/glance/images}
|
|
46
|
64
|
GLANCE_LOCK_DIR=${GLANCE_LOCK_DIR:=$DATA_DIR/glance/locks}
|
|
|
65
|
+GLANCE_STAGING_DIR=${GLANCE_MULTISTORE_FILE_IMAGE_DIR:=$DATA_DIR/os_glance_staging_store}
|
|
|
66
|
+GLANCE_TASKS_DIR=${GLANCE_MULTISTORE_FILE_IMAGE_DIR:=$DATA_DIR/os_glance_tasks_store}
|
|
47
|
67
|
|
|
48
|
68
|
GLANCE_CONF_DIR=${GLANCE_CONF_DIR:-/etc/glance}
|
|
49
|
69
|
GLANCE_METADEF_DIR=$GLANCE_CONF_DIR/metadefs
|
|
...
|
...
|
@@ -97,6 +117,18 @@ function is_glance_enabled {
|
|
97
|
97
|
function cleanup_glance {
|
|
98
|
98
|
# delete image files (glance)
|
|
99
|
99
|
sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR
|
|
|
100
|
+
|
|
|
101
|
+ # Cleanup multiple stores directories
|
|
|
102
|
+ if [[ "$GLANCE_ENABLE_MULTIPLE_STORES" == "True" ]]; then
|
|
|
103
|
+ local store file_dir
|
|
|
104
|
+ for store in $(echo $GLANCE_MULTIPLE_FILE_STORES | tr "," "\n"); do
|
|
|
105
|
+ file_dir="${GLANCE_MULTISTORE_FILE_IMAGE_DIR}/${store}/"
|
|
|
106
|
+ sudo rm -rf $file_dir
|
|
|
107
|
+ done
|
|
|
108
|
+
|
|
|
109
|
+ # Cleanup reserved stores directories
|
|
|
110
|
+ sudo rm -rf $GLANCE_STAGING_DIR $GLANCE_TASKS_DIR
|
|
|
111
|
+ fi
|
|
100
|
112
|
}
|
|
101
|
113
|
|
|
102
|
114
|
# configure_glance() - Set config files, create data dirs, etc
|
|
...
|
...
|
@@ -117,6 +149,16 @@ function configure_glance {
|
|
117
|
117
|
iniset_rpc_backend glance $GLANCE_REGISTRY_CONF
|
|
118
|
118
|
iniset $GLANCE_REGISTRY_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
|
|
119
|
119
|
|
|
|
120
|
+ # Configure multiple stores
|
|
|
121
|
+ if [[ "$GLANCE_ENABLE_MULTIPLE_STORES" == "True" ]]; then
|
|
|
122
|
+ local store enabled_backends
|
|
|
123
|
+ enabled_backends=""
|
|
|
124
|
+ for store in $(echo $GLANCE_MULTIPLE_FILE_STORES | tr "," "\n"); do
|
|
|
125
|
+ enabled_backends+="${store}:file,"
|
|
|
126
|
+ done
|
|
|
127
|
+ iniset $GLANCE_API_CONF DEFAULT enabled_backends ${enabled_backends::-1}
|
|
|
128
|
+ fi
|
|
|
129
|
+
|
|
120
|
130
|
# Set non-default configuration options for the API server
|
|
121
|
131
|
iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
|
|
122
|
132
|
iniset $GLANCE_API_CONF database connection $dburl
|
|
...
|
...
|
@@ -141,8 +183,21 @@ function configure_glance {
|
|
141
|
141
|
iniset $GLANCE_API_CONF DEFAULT enable_v1_api False
|
|
142
|
142
|
fi
|
|
143
|
143
|
|
|
144
|
|
- # Store specific configs
|
|
145
|
|
- iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
|
|
|
144
|
+ # Glance multiple store Store specific configs
|
|
|
145
|
+ if [[ "$GLANCE_ENABLE_MULTIPLE_STORES" == "True" ]]; then
|
|
|
146
|
+ iniset $GLANCE_API_CONF glance_store default_backend $GLANCE_DEFAULT_BACKEND
|
|
|
147
|
+ local store
|
|
|
148
|
+ for store in $(echo $GLANCE_MULTIPLE_FILE_STORES | tr "," "\n"); do
|
|
|
149
|
+ iniset $GLANCE_API_CONF $store filesystem_store_datadir "${GLANCE_MULTISTORE_FILE_IMAGE_DIR}/${store}/"
|
|
|
150
|
+ done
|
|
|
151
|
+
|
|
|
152
|
+ # Glance configure reserved stores
|
|
|
153
|
+ iniset $GLANCE_API_CONF os_glance_staging_store filesystem_store_datadir "${GLANCE_MULTISTORE_FILE_IMAGE_DIR}/os_glance_staging_store/"
|
|
|
154
|
+ iniset $GLANCE_API_CONF os_glance_tasks_store filesystem_store_datadir "${GLANCE_MULTISTORE_FILE_IMAGE_DIR}/os_glance_tasks_store/"
|
|
|
155
|
+ else
|
|
|
156
|
+ # Store specific configs
|
|
|
157
|
+ iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
|
|
|
158
|
+ fi
|
|
146
|
159
|
iniset $GLANCE_API_CONF DEFAULT registry_host $(ipv6_unquote $GLANCE_SERVICE_HOST)
|
|
147
|
160
|
|
|
148
|
161
|
# CORS feature support - to allow calls from Horizon by default
|
|
...
|
...
|
@@ -152,6 +207,7 @@ function configure_glance {
|
|
152
|
152
|
iniset $GLANCE_API_CONF cors allowed_origin "http://$SERVICE_HOST"
|
|
153
|
153
|
fi
|
|
154
|
154
|
|
|
|
155
|
+ # No multiple stores for swift yet
|
|
155
|
156
|
# Store the images in swift if enabled.
|
|
156
|
157
|
if is_service_enabled s-proxy; then
|
|
157
|
158
|
iniset $GLANCE_API_CONF glance_store default_store swift
|