From 6682d07addb9063a231199b3219bdcf6c932d218 Mon Sep 17 00:00:00 2001 From: Duong Ha-Quang Date: Wed, 19 Oct 2016 14:42:10 +0700 Subject: [PATCH] Implement Keystone zero-downtime upgrade - Introduce database upgrade into keystone extend_start.sh script. [1] [1] http://docs.openstack.org/developer/keystone/upgrading.html#upgrading-without-downtime Change-Id: Ic615026df2ce8fa79a3efe969d0dda9797c9e79f Closes-Bug: #1634016 --- docker/keystone/keystone/extend_start.sh | 19 +++++++++++++++++++ ...ero-downtime-upgrade-2a082ad24b26751d.yaml | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 releasenotes/notes/implement-keystone-zero-downtime-upgrade-2a082ad24b26751d.yaml diff --git a/docker/keystone/keystone/extend_start.sh b/docker/keystone/keystone/extend_start.sh index b509c7065b..b29bf02a32 100644 --- a/docker/keystone/keystone/extend_start.sh +++ b/docker/keystone/keystone/extend_start.sh @@ -41,6 +41,25 @@ if [[ $(stat -c %a ${KEYSTONE_LOG_DIR}) != "755" ]]; then chmod 755 ${KEYSTONE_LOG_DIR} fi +# Upgrade 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 + # TODO(duonghq): check doctor result here + # TODO: find reason why doctor failed in gate + # sudo -H -u keystone keystone-manage doctor + sudo -H -u keystone keystone-manage db_sync --expand + sudo -H -u keystone keystone-manage db_sync --migrate + exit 0 +fi + +# Contract database and exit if KOLLA_FINISH_UPGRADE variable is set. +# This catches all cases of the KOLLA_FINISH_UPGRADE variable being set, +# including empty. +if [[ "${!KOLLA_FINISH_UPGRADE[@]}" ]]; then + sudo -H -u keystone keystone-manage db_sync --contract + exit 0 +fi + # 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 diff --git a/releasenotes/notes/implement-keystone-zero-downtime-upgrade-2a082ad24b26751d.yaml b/releasenotes/notes/implement-keystone-zero-downtime-upgrade-2a082ad24b26751d.yaml new file mode 100644 index 0000000000..92f270df75 --- /dev/null +++ b/releasenotes/notes/implement-keystone-zero-downtime-upgrade-2a082ad24b26751d.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add supporting script for Keystone zero-downtime upgrade.