From dc1389bc586f800389dc4eff3c33be593e352d76 Mon Sep 17 00:00:00 2001 From: confi-surya Date: Wed, 11 Apr 2018 12:03:29 +0900 Subject: [PATCH] Apply Swift rolling upgrade Apply Swift rolling upgrade based on recommendations from Swift PTL John Dickinson at [1] [1]https://www.swiftstack.com/blog/2013/12/20/upgrade-openstack-swift-no-downtime/ Co-Authored-By: Duong Ha-Quang Co-Authored-By: Ha Manh Dong Change-Id: Ic59a2d2dda3469af5d4259e020d22b619ff7d603 Implements: blueprint apply-service-upgrade-procedure --- docker/swift/swift-proxy-server/Dockerfile.j2 | 3 +++ docker/swift/swift-proxy-server/extend_start.sh | 8 ++++++++ docker/swift/swift-rsyncd/extend_start.sh | 9 +++++++++ 3 files changed, 20 insertions(+) create mode 100644 docker/swift/swift-proxy-server/extend_start.sh diff --git a/docker/swift/swift-proxy-server/Dockerfile.j2 b/docker/swift/swift-proxy-server/Dockerfile.j2 index 4e5aaf4d9c..27a877fe77 100644 --- a/docker/swift/swift-proxy-server/Dockerfile.j2 +++ b/docker/swift/swift-proxy-server/Dockerfile.j2 @@ -30,6 +30,9 @@ RUN {{ macros.install_pip(swift_proxy_server_pip_packages | customizable("pip_pa {% endif %} +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start + {% block swift_proxy_server_footer %}{% endblock %} {% block footer %}{% endblock %} diff --git a/docker/swift/swift-proxy-server/extend_start.sh b/docker/swift/swift-proxy-server/extend_start.sh new file mode 100644 index 0000000000..20f0dcae4f --- /dev/null +++ b/docker/swift/swift-proxy-server/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Gracefully stop swift proxy and exit if KOLLA_STOP_SERVICES variable is set. +if [[ "${!KOLLA_STOP_SERVICES[@]}" ]]; then + echo "Gracefully Shutdown all Swift proxy processes" + swift-init proxy shutdown + exit +fi diff --git a/docker/swift/swift-rsyncd/extend_start.sh b/docker/swift/swift-rsyncd/extend_start.sh index 86d24724bc..37bc4e012f 100644 --- a/docker/swift/swift-rsyncd/extend_start.sh +++ b/docker/swift/swift-rsyncd/extend_start.sh @@ -2,3 +2,12 @@ sudo chown -R swift:swift /srv/node mkdir -p /var/lib/swift/lock + +# Migrate swift database and exit if KOLLA_STOP_SERVICES variable is set. +if [[ "${!KOLLA_STOP_SERVICES[@]}" ]]; then + echo "Stop background Swift jobs" + swift-init rest stop + echo "Gracefully Shutdown all Swift storage processes" + swift-init {account|container|object} shutdown + exit +fi