From aa26271ee5a654caeeee0897236d7e844a595f08 Mon Sep 17 00:00:00 2001 From: Antony Messerli Date: Fri, 10 Aug 2018 13:49:29 -0500 Subject: [PATCH] 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 --- leap-upgrades/lib/vars.sh | 5 +++++ leap-upgrades/re-deploy.sh | 5 ++++- leap-upgrades/upgrade-utilities/power-down.yml | 11 ++++++++++- leap-upgrades/upgrade.sh | 8 +++++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/leap-upgrades/lib/vars.sh b/leap-upgrades/lib/vars.sh index e15d9c71..05e6be42 100644 --- a/leap-upgrades/lib/vars.sh +++ b/leap-upgrades/lib/vars.sh @@ -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}" diff --git a/leap-upgrades/re-deploy.sh b/leap-upgrades/re-deploy.sh index 84960609..cbf04f42 100755 --- a/leap-upgrades/re-deploy.sh +++ b/leap-upgrades/re-deploy.sh @@ -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") diff --git a/leap-upgrades/upgrade-utilities/power-down.yml b/leap-upgrades/upgrade-utilities/power-down.yml index 44ecb207..e45018f8 100644 --- a/leap-upgrades/upgrade-utilities/power-down.yml +++ b/leap-upgrades/upgrade-utilities/power-down.yml @@ -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 diff --git a/leap-upgrades/upgrade.sh b/leap-upgrades/upgrade.sh index 7fad31b4..2277288f 100755 --- a/leap-upgrades/upgrade.sh +++ b/leap-upgrades/upgrade.sh @@ -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"