Merge "Allow for Leapfrogs from other Releases"

This commit is contained in:
Jenkins 2017-10-04 15:47:52 +00:00 committed by Gerrit Code Review
commit 37ff5563ec
5 changed files with 64 additions and 76 deletions

View File

@ -39,6 +39,19 @@ function tag_leap_success {
debug "LEAP ${1} marked as success"
}
function check_for_todolist {
if [[ -v UPGRADES_TO_TODOLIST ]]; then
notice "UPGRADES_TO_TODOLIST is set, continuing..."
else
notice "Please export UPGRADES_TO_TODOLIST variable before continuing"
notice "This variable is set via the prep.sh script and details the"
notice "incremental RELEASES that need to run for the leap."
notice ""
notice "example: export UPGRADES_TO_TODOLIST=\"MITAKA NEWTON\""
exit 99
fi
}
function run_lock {
set +e
@ -291,6 +304,12 @@ function pre_flight {
discover_code_version
# set config directory here since we need to check if existing redeploy
# has been kicked off before prompting for the release, JUNO is the only
# other directory that may differ but since we aren't leaping to JUNO,
# this should be safe to set here
CONFIG_DIR="/etc/openstack_deploy"
if [[ -f "${CONFIG_DIR}/upgrade-leap/redeploy-started.complete" && ! -f "${CONFIG_DIR}/upgrade-leap/osa-leap.complete" ]]; then
resume_incomplete_leap
elif [ "${VALIDATE_UPGRADE_INPUT}" == "TRUE" ]; then
@ -419,7 +438,7 @@ function run_venv_prep {
if [[ -e "/etc/rpc_deploy" ]]; then
PB_DIR="/opt/leap42/openstack-ansible-${JUNO_RELEASE}/rpc_deployment"
else
PB_DIR="/opt/leap42/openstack-ansible-${KILO_RELEASE}/playbooks"
PB_DIR="/opt/leap42/openstack-ansible-${RELEASE}/playbooks"
fi
pushd "${PB_DIR}"

View File

@ -40,7 +40,6 @@ export UPGRADE_UTILS="${UPGRADE_UTILS:-${SYSTEM_PATH}/upgrade-utilities}"
export VENV_URL="${VENV_URL:-https://rpc-repo.rackspace.com/venvs/leap-bundles}"
export VALIDATE_UPGRADE_INPUT="${VALIDATE_UPGRADE_INPUT:-TRUE}"
export UPGRADES_TO_TODOLIST="${UPGRADES_TO_TODOLIST:-''}"
export CODE_UPGRADE_FROM=""
# Bootstrap ansible tool, see also bootstrap_recent_ansible

View File

@ -21,6 +21,9 @@ set -e -u
source lib/vars.sh
source lib/functions.sh
## Ensure UPGRADES_TO_TODOLIST is set
check_for_todolist
### Run the DB migrations
# Stop the services to ensure DB and application consistency
if [[ ! -f "/opt/leap42/openstack-ansible-poweroff.leap" ]]; then
@ -35,46 +38,26 @@ if [[ ! -f "/opt/leap42/openstack-ansible-poweroff.leap" ]]; then
tag_leap_success "poweroff"
fi
# Kilo migrations
if [[ ! -f "/opt/leap42/openstack-ansible-${KILO_RELEASE}-db.leap" ]]; then
notice "Running Kilo DB Migrations"
link_release "/opt/leap42/openstack-ansible-${KILO_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-kilo.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${KILO_RELEASE}.tgz'")
run_items "/opt/leap42/openstack-ansible-${KILO_RELEASE}"
tag_leap_success "${KILO_RELEASE}-db"
fi
# Liberty migrations
if [[ ! -f "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}-db.leap" ]]; then
notice "Running Liberty DB Migrations"
link_release "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-liberty.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${LIBERTY_RELEASE}.tgz'")
RUN_TASKS+=("${UPGRADE_UTILS}/glance-db-storage-url-fix.yml")
run_items "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}"
tag_leap_success "${LIBERTY_RELEASE}-db"
fi
# Mitaka migrations
if [[ ! -f "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}-db.leap" ]]; then
notice "Running Mitaka DB Migrations"
link_release "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-mitaka.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${MITAKA_RELEASE}.tgz'")
RUN_TASKS+=("${UPGRADE_UTILS}/neutron-mtu-migration.yml")
run_items "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}"
tag_leap_success "${MITAKA_RELEASE}-db"
fi
# Newton migrations
if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-db.leap" ]]; then
notice "Running Newton DB Migrations"
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/db-collation-alter.yml")
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-newton.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${NEWTON_RELEASE}.tgz'")
run_items "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
tag_leap_success "${NEWTON_RELEASE}-db"
fi
### Run the DB migrations
# Run Migrations for Each Release in the TODO
for RELEASES in ${UPGRADES_TO_TODOLIST}; do
RELEASE_NAME=${RELEASES}_RELEASE
if [[ ! -f "/opt/leap42/openstack-ansible-${!RELEASE_NAME}-db.leap" ]]; then
notice "Running ${RELEASES} DB Migrations"
link_release "/opt/leap42/openstack-ansible-${!RELEASE_NAME}"
RUN_TASKS=()
if [[ "${RELEASES}" == "JUNO" ]]; then
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-kilo.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${!RELEASE_NAME}.tgz'")
elif [[ "${RELEASES}" == "LIBERTY" ]]; then
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-liberty.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${!RELEASE_NAME}.tgz'")
RUN_TASKS+=("${UPGRADE_UTILS}/glance-db-storage-url-fix.yml")
elif [[ "${RELEASES}" == "MITAKA" ]]; then
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-mitaka.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${!RELEASE_NAME}.tgz'")
RUN_TASKS+=("${UPGRADE_UTILS}/neutron-mtu-migration.yml")
elif [[ "${RELEASES}" == "NEWTON" ]]; then
RUN_TASKS+=("${UPGRADE_UTILS}/db-collation-alter.yml")
RUN_TASKS+=("${UPGRADE_UTILS}/db-migrations-newton.yml -e 'venv_tar_location=/opt/leap42/venvs/openstack-ansible-${!RELEASE_NAME}.tgz'")
fi
run_items "/opt/leap42/openstack-ansible-${!RELEASE_NAME}"
tag_leap_success "${!RELEASE_NAME}-db"
fi
done

View File

@ -24,38 +24,22 @@ source lib/functions.sh
# Execute a preflight check
pre_flight
# Clone the Juno release so we have a clean copy of the source code.
if [[ ! -f "/opt/leap42/openstack-ansible-${JUNO_RELEASE}-prep.leap" ]]; then
clone_release ${JUNO_RELEASE}
touch "/opt/leap42/openstack-ansible-${JUNO_RELEASE}-prep.leap"
fi
# Build the releases. This will clone all of the releases and check them out
# separately in addition to creating all of the venvs needed for a successful migration.
if [[ ! -f "/opt/leap42/openstack-ansible-${KILO_RELEASE}-prep.leap" ]]; then
clone_release ${KILO_RELEASE}
get_venv ${KILO_RELEASE}
touch "/opt/leap42/openstack-ansible-${KILO_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}-prep.leap" ]]; then
clone_release ${LIBERTY_RELEASE}
get_venv ${LIBERTY_RELEASE}
touch "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}-prep.leap" ]]; then
clone_release ${MITAKA_RELEASE}
get_venv ${MITAKA_RELEASE}
touch "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap" ]]; then
clone_release ${NEWTON_RELEASE}
get_venv ${NEWTON_RELEASE}
touch "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap"
fi
# assemble list of versions to check out
TODO="${CODE_UPGRADE_FROM}"
TODO+=" ${UPGRADES_TO_TODOLIST}"
# Build the releases. This will loop through the TODO variable, check out the
# releases, and create all of the venvs needed for a successful migration
for RELEASES in ${TODO}; do
RELEASE_NAME=${RELEASES}_RELEASE
if [[ ! -f "/opt/leap42/openstack-ansible-${!RELEASE_NAME}-prep.leap" ]]; then
clone_release ${!RELEASE_NAME}
if [[ "${RELEASES}" != "JUNO" ]]; then
get_venv ${!RELEASE_NAME}
fi
touch "/opt/leap42/openstack-ansible-${!RELEASE_NAME}-prep.leap"
fi
done
if [[ ! -f "/opt/leap42/openstack-ansible-prep-finalsteps.leap" ]]; then
RUN_TASKS=()

View File

@ -21,6 +21,9 @@ set -e -u
source lib/vars.sh
source lib/functions.sh
## Ensure UPGRADES_TO_TODOLIST is set
check_for_todolist
### Kilo System migration
# Run tasks
UPGRADE_SCRIPTS="${UPGRADE_UTILS}-kilo/scripts"