From cb982440d74731e4943b75ea51feaa4f0fdcb938 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Wed, 9 Sep 2020 15:04:27 +0200 Subject: [PATCH] Refresh Swift ring files without restarting containers Updating rings consists of multiple steps today: 1. Apply puppet in the swift_ringbuilder container 2. Copying files in step 3 using swift_copy_rings 3. Run kolla_set_config to copy files to /etc/swift before starting Swift service processes This needs a container restart today, because kolla_set_config will be executed only on container (re-)starts. This patch will execute kolla_set_configs at the step 5 of deployment, and apply all ring changes, if any, for the Swift processes without a container restart. Swift processes will notice the changed ring files within 15 seconds and will use the updated rings. Co-authored-by: Bogdan Dobrelya Change-Id: Ibdd783b484a84c0fdfaac84d892a8ea46be85fde --- .../swift-refresh-rings-cc327f998490b0df.yaml | 6 +++++ .../swift/swift-proxy-container-puppet.yaml | 10 +++++++++ .../swift/swift-storage-container-puppet.yaml | 22 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 deployment/swift/releasenotes/notes/swift-refresh-rings-cc327f998490b0df.yaml diff --git a/deployment/swift/releasenotes/notes/swift-refresh-rings-cc327f998490b0df.yaml b/deployment/swift/releasenotes/notes/swift-refresh-rings-cc327f998490b0df.yaml new file mode 100644 index 0000000000..e719cdbeef --- /dev/null +++ b/deployment/swift/releasenotes/notes/swift-refresh-rings-cc327f998490b0df.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Refresh Swift ring files without restarting containers. This makes it + possible to update rings without service restarts, lowering the overhead + for updates. diff --git a/deployment/swift/swift-proxy-container-puppet.yaml b/deployment/swift/swift-proxy-container-puppet.yaml index d62f5c83e6..206ec0e5a0 100644 --- a/deployment/swift/swift-proxy-container-puppet.yaml +++ b/deployment/swift/swift-proxy-container-puppet.yaml @@ -475,6 +475,16 @@ outputs: - swift_rsyslog_config is defined - swift_rsyslog_config.status is defined - swift_rsyslog_config.status.ActiveState == 'active' + - name: Run kolla_set_configs to copy ring files + when: step|int == 5 + shell: "{{ container_cli }} exec -u root {{ item }} /usr/local/bin/kolla_set_configs " + become: true + register: kolla_set_configs_result + failed_when: + - kolla_set_configs_result.rc is defined # do not fail in dry run mode + - kolla_set_configs_result.rc not in [0, 125] # ignore containers that are not running + with_items: + - swift_proxy update_tasks: - name: Check swift containers log folder/symlink exists stat: diff --git a/deployment/swift/swift-storage-container-puppet.yaml b/deployment/swift/swift-storage-container-puppet.yaml index ed0979c25a..7319a011bc 100644 --- a/deployment/swift/swift-storage-container-puppet.yaml +++ b/deployment/swift/swift-storage-container-puppet.yaml @@ -658,6 +658,28 @@ outputs: - swift_rsyslog_config is defined - swift_rsyslog_config.status is defined - swift_rsyslog_config.status.ActiveState == 'active' + - name: Run kolla_set_configs to copy ring files + when: step|int == 5 + shell: "{{ container_cli }} exec -u root {{ item }} /usr/local/bin/kolla_set_configs" + become: true + register: kolla_set_configs_result + failed_when: + - kolla_set_configs_result.rc is defined # do not fail in dry run mode + - kolla_set_configs_result.rc not in [0, 125] # ignore containers that are not running + with_items: + - swift_account_auditor + - swift_account_reaper + - swift_account_replicator + - swift_account_server + - swift_container_auditor + - swift_container_replicator + - swift_container_server + - swift_container_updater + - swift_object_auditor + - swift_object_expirer + - swift_object_replicator + - swift_object_server + - swift_object_updater update_tasks: - name: Check swift containers log folder/symlink exists stat: