From 9bc664090741d43fd49857230238fc345bf8d0c9 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 17 Mar 2020 12:45:15 +0100 Subject: [PATCH] Fix swift containers idempotency The change https://review.opendev.org/#/c/616116 unwinded the swift part of the https://review.opendev.org/#/c/590008/ changes. So the contents of the /var/lib/config-data/swift_ringbuilder config volume used to be managed by container-puppet tool. That made swift containers always restarted because the puppet-generated rings are always changing on each deployment/update execution. Restore that unwinded change back and exclude swift rings from the management of container-puppet tooling. Instead make init containers swift_copy_rings and swift_setup_srv to be always executed (takes the same approach as in https://review.opendev.org/#/c/564798/). That also fixes the issue with swift_copy_rings seems never been executed - at least there is no traces of it in CI jobs logs for swift init containers. Change-Id: I23b469057e4c47c42601beb166f815ee71147c14 Closes-Bug: #1867765 Related-Bug: #1802066 Related-Bug: #1786065 Signed-off-by: Bogdan Dobrelya --- common/container-puppet.sh | 6 +++--- .../swift/swift-ringbuilder-container-puppet.yaml | 10 ++++++++++ deployment/swift/swift-storage-container-puppet.yaml | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/container-puppet.sh b/common/container-puppet.sh index de60e5fc35..357d0b8af6 100644 --- a/common/container-puppet.sh +++ b/common/container-puppet.sh @@ -160,9 +160,9 @@ if [ -z "$NO_ARCHIVE" ]; then excluded_original_passwords+=" --exclude=/var/lib/config-data/*${p}" fi done - # We need to exclude the swift ring backups as those change over time and - # containers do not need to restart if they change - EXCLUDE=--exclude='*/etc/swift/backups/*'\ --exclude='*/etc/libvirt/passwd.db'\ ${excluded_original_passwords} + # We need to exclude the swift rings and backups as those change over time + # and containers do not need to restart if they change + EXCLUDE=--exclude='*/etc/swift/backups/*'\ --exclude='*/etc/swift/*.ring.gz'\ --exclude='*/etc/swift/*.builder'\ --exclude='*/etc/libvirt/passwd.db'\ ${excluded_original_passwords} # We need to repipe the tar command through 'tar xO' to force text # output because otherwise the sed command cannot work. The sed is diff --git a/deployment/swift/swift-ringbuilder-container-puppet.yaml b/deployment/swift/swift-ringbuilder-container-puppet.yaml index 67cc259f2c..49c16d8dc4 100644 --- a/deployment/swift/swift-ringbuilder-container-puppet.yaml +++ b/deployment/swift/swift-ringbuilder-container-puppet.yaml @@ -65,6 +65,12 @@ parameters: default: '' description: A temporary Swift URL to upload rings to. type: string + DeployIdentifier: + default: '' + type: string + description: > + Setting this to a unique value will re-run any deployment tasks which + perform configuration on a Heat stack-update. conditions: swift_use_local_dir: @@ -124,3 +130,7 @@ outputs: volumes: - /var/lib/config-data/puppet-generated/swift/etc/swift:/etc/swift:rw,z - /var/lib/config-data/swift_ringbuilder:/swift_ringbuilder:ro + environment: + # NOTE: this should force this container to re-run on each + # update (scale-out, etc.) + TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier} diff --git a/deployment/swift/swift-storage-container-puppet.yaml b/deployment/swift/swift-storage-container-puppet.yaml index 7319a011bc..6a3f9b7d18 100644 --- a/deployment/swift/swift-storage-container-puppet.yaml +++ b/deployment/swift/swift-storage-container-puppet.yaml @@ -77,6 +77,12 @@ parameters: default: 0 description: Number of workers for Swift account service. type: string + DeployIdentifier: + default: '' + type: string + description: > + Setting this to a unique value will re-run any deployment tasks which + perform configuration on a Heat stack-update. # DEPRECATED options for compatibility with overcloud.yaml # This should be removed and manipulation of the ControllerServices list @@ -313,6 +319,10 @@ outputs: command: ['chown', '-R', 'swift:', '/srv/node'] volumes: - /srv/node:/srv/node:z + environment: + # NOTE: this should force this container to re-run on each + # update (scale-out, etc.) + TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier} step_4: map_merge: - if: