Improve suspend/resume of leapfrog

While we could do better by using other mechanisms than shell
scripts, this commit sticks to the current method of doing (having
marker files), to mark steps that were missing a marker.

On top of it, you couldn't resume from a leapfrog that's started
from a shell script, because the readlink failed.

Change-Id: I73f09bb8214741772545c73fac5e5fdb5698c52e
This commit is contained in:
Jean-Philippe Evrard 2017-05-31 15:57:55 +01:00 committed by Jean-Philippe Evrard
parent 9d282388ac
commit 6178be497b
4 changed files with 57 additions and 42 deletions

View File

@ -204,6 +204,12 @@ function set_upgrade_vars {
export ANSIBLE_INVENTORY="/opt/leap42/openstack-ansible-${RELEASE}/playbooks/inventory"
export CONFIG_DIR="/etc/openstack_deploy"
;;
NEWTON)
export RELEASE="${NEWTON_RELEASE}"
export UPGRADES_TO_TODOLIST=""
export ANSIBLE_INVENTORY="/opt/leap42/openstack-ansible-${RELEASE}/playbooks/inventory"
export CONFIG_DIR="/etc/openstack_deploy"
;;
esac
}
@ -262,6 +268,7 @@ function pre_flight {
exit 99
fi
if [[ ! -f /opt/leap42/rebootstrap-ansible ]]; then
# Don't run this over and over again if the variables above are not set!
pushd /opt/leap42
# Using this lookup plugin because it allows us to compile exact service releaes and build a complete venv from it
@ -289,6 +296,8 @@ function pre_flight {
PS1="\\u@\h \\W]\\$" . "/opt/ansible-runtime/bin/activate"
pip install "ansible==1.9.3" "netaddr>=0.7.12,<=0.7.13" --force-reinstall --upgrade --isolated
deactivate
touch /opt/leap42/rebootstrap-ansible
fi
}
function run_items {

View File

@ -27,7 +27,7 @@ export NEWTON_RELEASE="${NEWTON_RELEASE:-14.2.3}" # commit used due to packagin
## Environment Vars ------------------------------------------------------------------
export MAIN_PATH="${MAIN_PATH:-/opt/openstack-ansible}"
export SYSTEM_PATH="$(dirname $(readlink -f $0))"
export SYSTEM_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
export UPGRADE_UTILS="${UPGRADE_UTILS:-${SYSTEM_PATH}/upgrade-utilities}"
# If the the OpenStack-Ansible system venvs have already been built elsewhere and can be downloaded

View File

@ -59,16 +59,20 @@ if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap" ]]; then
touch "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap"
fi
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/cinder-volume-container-lvm-check.yml")
RUN_TASKS+=("${UPGRADE_UTILS}/db-backup.yml")
if [[ ! -f "/opt/leap42/openstack-ansible-prep-finalsteps.leap" ]]; then
RUN_TASKS=()
# temp upgrade ansible is used to ensure 1.9.x compat.
PS1="\\u@\h \\W]\\$" . "/opt/ansible-runtime/bin/activate"
run_items "/opt/leap42/openstack-ansible-${RELEASE}"
deactivate
unset ANSIBLE_INVENTORY
RUN_TASKS+=("${UPGRADE_UTILS}/cinder-volume-container-lvm-check.yml")
RUN_TASKS+=("${UPGRADE_UTILS}/db-backup.yml")
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
system_bootstrap "/opt/openstack-ansible"
# temp upgrade ansible is used to ensure 1.9.x compat.
PS1="\\u@\h \\W]\\$" . "/opt/ansible-runtime/bin/activate"
run_items "/opt/leap42/openstack-ansible-${RELEASE}"
deactivate
unset ANSIBLE_INVENTORY
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
system_bootstrap "/opt/openstack-ansible"
touch "/opt/leap42/openstack-ansible-prep-finalsteps.leap"
fi

View File

@ -124,10 +124,12 @@ if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}.leap" ]] && [[ "${UP
fi
### Run host upgrade
notice 'Running host upgrade'
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/pip-conf-purge.yml")
RUN_TASKS+=("openstack-hosts-setup.yml")
run_items "/opt/openstack-ansible"
### Run host upgrade
if [[ ! -f "/opt/leap42/openstack-ansible-upgrade-hostupgrade.leap" ]]; then
notice 'Running host upgrade'
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/pip-conf-purge.yml")
RUN_TASKS+=("openstack-hosts-setup.yml")
run_items "/opt/openstack-ansible"
tag_leap_success "upgrade-hostupgrade"
fi