This patch copies all files from /etc/metadefs to
/etc/glance/metadefs and calls glance-manage db_load_metadefs
after successful database migration. This covers whole
process of initializing the metadata catalog.
Change-Id: I2ffd19bf543708b42229ef78dd17ee317f58e6ad
Implements: blueprint glance-metadata-definitions-support
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
| ... | ... |
@@ -34,6 +34,7 @@ GLANCE_IMAGE_DIR=${GLANCE_IMAGE_DIR:=$DATA_DIR/glance/images}
|
| 34 | 34 |
GLANCE_AUTH_CACHE_DIR=${GLANCE_AUTH_CACHE_DIR:-/var/cache/glance}
|
| 35 | 35 |
|
| 36 | 36 |
GLANCE_CONF_DIR=${GLANCE_CONF_DIR:-/etc/glance}
|
| 37 |
+GLANCE_METADEF_DIR=$GLANCE_CONF_DIR/metadefs |
|
| 37 | 38 |
GLANCE_REGISTRY_CONF=$GLANCE_CONF_DIR/glance-registry.conf |
| 38 | 39 |
GLANCE_API_CONF=$GLANCE_CONF_DIR/glance-api.conf |
| 39 | 40 |
GLANCE_REGISTRY_PASTE_INI=$GLANCE_CONF_DIR/glance-registry-paste.ini |
| ... | ... |
@@ -81,6 +82,11 @@ function configure_glance {
|
| 81 | 81 |
fi |
| 82 | 82 |
sudo chown $STACK_USER $GLANCE_CONF_DIR |
| 83 | 83 |
|
| 84 |
+ if [[ ! -d $GLANCE_METADEF_DIR ]]; then |
|
| 85 |
+ sudo mkdir -p $GLANCE_METADEF_DIR |
|
| 86 |
+ fi |
|
| 87 |
+ sudo chown $STACK_USER $GLANCE_METADEF_DIR |
|
| 88 |
+ |
|
| 84 | 89 |
# Copy over our glance configurations and update them |
| 85 | 90 |
cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF |
| 86 | 91 |
iniset $GLANCE_REGISTRY_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
| ... | ... |
@@ -177,6 +183,8 @@ function configure_glance {
|
| 177 | 177 |
|
| 178 | 178 |
cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON |
| 179 | 179 |
cp -p $GLANCE_DIR/etc/schema-image.json $GLANCE_SCHEMA_JSON |
| 180 |
+ |
|
| 181 |
+ cp -p $GLANCE_DIR/etc/metadefs/*.json $GLANCE_METADEF_DIR |
|
| 180 | 182 |
} |
| 181 | 183 |
|
| 182 | 184 |
# create_glance_accounts() - Set up common required glance accounts |
| ... | ... |
@@ -241,6 +249,9 @@ function init_glance {
|
| 241 | 241 |
# Migrate glance database |
| 242 | 242 |
$GLANCE_BIN_DIR/glance-manage db_sync |
| 243 | 243 |
|
| 244 |
+ # Load metadata definitions |
|
| 245 |
+ $GLANCE_BIN_DIR/glance-manage db_load_metadefs |
|
| 246 |
+ |
|
| 244 | 247 |
create_glance_cache_dir |
| 245 | 248 |
} |
| 246 | 249 |
|