Allow for Swift Leap Upgrade to be skipped

An operator might want to ensure Swift is available during
an upgrade and manually upgrade Swift on completion of the
maintenance.

The operator would need to set these vars before operation:

   export SKIP_SWIFT_UPGRADE=yes
   export CONTAINERS_TO_DESTROY=add_!swift_all_exclusion

This would prevent the swift containers from being torn
down during the upgrade and would skip all Swift upgrade
operations.

Change-Id: Ibf40499750751dd9f41e447b7b90bb77f592cc14
This commit is contained in:
Antony Messerli 2018-08-10 13:49:29 -05:00
parent 340e2243c6
commit aa26271ee5
4 changed files with 24 additions and 5 deletions

View File

@ -48,3 +48,8 @@ export ANSIBLE_LOG_PATH="/opt/leap42/ansible-${LEAP_TIMESTAMP}.log"
## Containers List to Destroy in destroy-old-containers.yml
export CONTAINERS_TO_DESTROY='"'"${CONTAINERS_TO_DESTROY:-all_containers:!galera_all:!neutron_agent:!ceph_all:!rsyslog_all}"'"'
# By default don't skip Swift Upgrade, this option is in place for operators who
# who might want to maximize Swift availablity during the upgrade and want to
# manually upgrade swift after the main deploy
export SKIP_SWIFT_UPGRADE="${SKIP_SWIFT_UPGRADE:-no}"

View File

@ -127,7 +127,10 @@ if grep -rni "^gnocchi_storage_driver" /etc/openstack_deploy/*.{yaml,yml} | grep
RUN_TASKS+=("os-gnocchi-install.yml -e gnocchi_identity_only=true")
fi
RUN_TASKS+=("os-swift-install.yml")
if [ "${SKIP_SWIFT_UPGRADE}" != "yes" ]; then
RUN_TASKS+=("os-swift-install.yml")
fi
RUN_TASKS+=("os-gnocchi-install.yml")
RUN_TASKS+=("os-ironic-install.yml")
RUN_TASKS+=("os-magnum-install.yml")

View File

@ -28,7 +28,6 @@
- barbican
- magnum
- ironic
- swift
- gnocchi
- designate
- aodh
@ -44,3 +43,13 @@
failed_when: false
args:
executable: /bin/bash
- name: Stop swift if not skipped
shell: |
for i in $(ls /etc/init /etc/init.d | grep "swift"); do
service ${i%".conf"*} stop || true;
done
failed_when: false
args:
executable: /bin/bash
when: not lookup('env', 'SKIP_SWIFT_UPGRADE') | bool

View File

@ -63,9 +63,11 @@ if [[ ! -f "/opt/leap42/openstack-ansible-${KILO_RELEASE}.leap" ]] && [[ "${UPGR
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/user-secrets-adjustments-kilo.yml -e 'osa_playbook_dir=/opt/leap42/openstack-ansible-${KILO_RELEASE}'")
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/host-adjustments.yml")
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/remove-juno-log-rotate.yml || true")
if [ "$(ansible 'swift_hosts' --list-hosts)" != "No hosts matched" ]; then
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/swift-ring-adjustments.yml")
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/swift-repo-adjustments.yml")
if [ "${SKIP_SWIFT_UPGRADE}" != "yes" ]; then
if [ "$(ansible 'swift_hosts' --list-hosts)" != "No hosts matched" ]; then
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/swift-ring-adjustments.yml")
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/swift-repo-adjustments.yml")
fi
fi
run_items "/opt/leap42/openstack-ansible-${KILO_RELEASE}"
tag_leap_success "${KILO_RELEASE}-prep"