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

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

@ -27,7 +27,7 @@ export NEWTON_RELEASE="${NEWTON_RELEASE:-14.2.3}" # commit used due to packagin
## Environment Vars ------------------------------------------------------------------ ## Environment Vars ------------------------------------------------------------------
export MAIN_PATH="${MAIN_PATH:-/opt/openstack-ansible}" 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}" 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 # If the the OpenStack-Ansible system venvs have already been built elsewhere and can be downloaded

@ -59,6 +59,8 @@ if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap" ]]; then
touch "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap" touch "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap"
fi fi
if [[ ! -f "/opt/leap42/openstack-ansible-prep-finalsteps.leap" ]]; then
RUN_TASKS=() RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/cinder-volume-container-lvm-check.yml") RUN_TASKS+=("${UPGRADE_UTILS}/cinder-volume-container-lvm-check.yml")
@ -72,3 +74,5 @@ unset ANSIBLE_INVENTORY
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}" link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
system_bootstrap "/opt/openstack-ansible" system_bootstrap "/opt/openstack-ansible"
touch "/opt/leap42/openstack-ansible-prep-finalsteps.leap"
fi

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