Better handling for resuming leapfrog upgrade

Copies the openstack-release file to another location
so that the original version being upgraded can be referenced
in the event of a failure where openstack-setup-hosts has
replaced the openstack-release file.  That way the list
of versions to upgrade is correct upon re-running the
leapfrog upgrade script.

Change-Id: I63de16bf27813dd623e996a5ac5de7bb8f8668b6
This commit is contained in:
Antony Messerli 2018-12-11 11:32:23 -06:00
parent e436a483da
commit 6c101e313c

View File

@ -197,7 +197,12 @@ function discover_code_version {
get_openstack_release_file get_openstack_release_file
fi fi
if [[ ! -f "/etc/openstack-release" && ! -f "/etc/rpc-release" ]]; then if [[ -f "/opt/leap42/openstack-release.leap" ]]; then
# if openstack-release.leap is found, then it is the source
# of truth for the original release being upgraded from
source /opt/leap42/openstack-release.leap
determine_openstack_release
elif [[ ! -f "/etc/openstack-release" && ! -f "/etc/rpc-release" ]]; then
failure "No release file could be found." failure "No release file could be found."
exit 99 exit 99
elif [[ ! -f "/etc/openstack-release" && -f "/etc/rpc-release" ]]; then elif [[ ! -f "/etc/openstack-release" && -f "/etc/rpc-release" ]]; then
@ -205,6 +210,11 @@ function discover_code_version {
notice "You seem to be running Juno" notice "You seem to be running Juno"
else else
source /etc/openstack-release source /etc/openstack-release
determine_openstack_release
fi
}
function determine_openstack_release {
case "${DISTRIB_RELEASE%%.*}" in case "${DISTRIB_RELEASE%%.*}" in
*11|eol-kilo) *11|eol-kilo)
export CODE_UPGRADE_FROM="KILO" export CODE_UPGRADE_FROM="KILO"
@ -223,7 +233,6 @@ function discover_code_version {
notice "You seem to be running Newton" notice "You seem to be running Newton"
;; ;;
esac esac
fi
} }
function get_openstack_release_file { function get_openstack_release_file {
@ -339,6 +348,13 @@ function pre_flight {
mkdir -p /opt/leap42/venvs mkdir -p /opt/leap42/venvs
# Make a copy of the original origin release so that we know what the
# original version was in case it's overwritten later on so that we can
# resume from the proper release
if [[ ! -f "/opt/leap42/openstack-release.leap" ]]; then
cp /etc/openstack-release /opt/leap42/openstack-release.leap
fi
# If the lxc backend store was not set halt and instruct the user to set it. In Juno we did more to detect the backend storage # If the lxc backend store was not set halt and instruct the user to set it. In Juno we did more to detect the backend storage
# size than we do in later releases. While the auto-detection should still work it's best to have the deployer set the value # size than we do in later releases. While the auto-detection should still work it's best to have the deployer set the value
# desired before moving forward. # desired before moving forward.