kolla/docker/glance/glance-api/extend_start.sh
Duong Ha-Quang 0ac2bc0f71 Apply Glance database migration
Apply Glance database upgrade procedure:

https://docs.openstack.org/glance/latest/admin/zero-downtime-db-upgrade.html

Change-Id: Ife6974db538df8c1461714203974d47a5c577985
Implements: blueprint apply-service-upgrade-procedure
2018-04-05 07:53:32 +00:00

28 lines
830 B
Bash

#!/bin/bash
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
glance-manage db_sync
glance-manage db_load_metadefs
exit 0
fi
# Migrate database and exit if KOLLA_UPGRADE variable is set. This catches all cases
# of the KOLLA_UPGRADE variable being set, including empty.
if [[ "${!KOLLA_UPGRADE[@]}" ]]; then
if [[ "${!GLANCE_DB_EXPAND[@]}" ]]; then
echo "Expanding database"
glance-manage db expand
fi
if [[ "${!GLANCE_DB_MIGRATE[@]}" ]]; then
echo "Migrating database"
glance-manage db migrate
fi
if [[ "${!GLANCE_DB_CONTRACT[@]}" ]]; then
echo "Contracting database"
glance-manage db contract
fi
exit 0
fi