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