diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml index c8897c355..a8942ad5d 100644 --- a/helm-toolkit/Chart.yaml +++ b/helm-toolkit/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Helm-Toolkit name: helm-toolkit -version: 0.2.51 +version: 0.2.52 home: https://docs.openstack.org/openstack-helm icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png sources: diff --git a/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl b/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl index 9597d3421..3963bd405 100755 --- a/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl +++ b/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl @@ -214,7 +214,7 @@ send_to_remote_server() { fi # load balance delay - DELAY=$((1 + ${RANDOM} % 300)) + DELAY=$((1 + ${RANDOM} % 30)) echo "Sleeping for ${DELAY} seconds to spread the load in time..." sleep ${DELAY} @@ -231,31 +231,17 @@ send_to_remote_server() { return 2 fi - # load balance delay - DELAY=$((1 + ${RANDOM} % 300)) - echo "Sleeping for ${DELAY} seconds to spread the load in time..." - sleep ${DELAY} - - # Calculation remote file SHA256 hash - REMOTE_FILE=$(mktemp -p /tmp) - openstack object save --file ${REMOTE_FILE} $CONTAINER_NAME $FILE - if [[ $? -ne 0 ]]; then - log WARN "${DB_NAME}_backup" "Unable to save container object $FILE for SHA256 hash verification." - rm -rf ${REMOTE_FILE} - return 1 - fi - # Remote backup verification - SHA256_REMOTE=$(cat ${REMOTE_FILE} | sha256sum | awk '{print $1}') - SHA256_LOCAL=$(cat ${FILEPATH}/${FILE} | sha256sum | awk '{print $1}') - log INFO "${DB_NAME}_backup" "Calculated SHA256 hashes for the file $FILE in container $CONTAINER_NAME." - log INFO "${DB_NAME}_backup" "Local SHA256 hash is ${SHA256_LOCAL}." - log INFO "${DB_NAME}_backup" "Remote SHA256 hash is ${SHA256_REMOTE}." - if [[ "${SHA256_LOCAL}" == "${SHA256_REMOTE}" ]]; then - log INFO "${DB_NAME}_backup" "The local backup & remote backup SHA256 hash values are matching for file $FILE in container $CONTAINER_NAME." + MD5_REMOTE=$(openstack object show $CONTAINER_NAME $FILE -f json | jq -r ".etag") + MD5_LOCAL=$(cat ${FILEPATH}/${FILE} | md5sum | awk '{print $1}') + log INFO "${DB_NAME}_backup" "Obtained MD5 hash for the file $FILE in container $CONTAINER_NAME." + log INFO "${DB_NAME}_backup" "Local MD5 hash is ${MD5_LOCAL}." + log INFO "${DB_NAME}_backup" "Remote MD5 hash is ${MD5_REMOTE}." + if [[ "${MD5_LOCAL}" == "${MD5_REMOTE}" ]]; then + log INFO "${DB_NAME}_backup" "The local backup & remote backup MD5 hash values are matching for file $FILE in container $CONTAINER_NAME." else - log ERROR "${DB_NAME}_backup" "Mismatch between the local backup & remote backup sha256 hash values" - return 1 + log ERROR "${DB_NAME}_backup" "Mismatch between the local backup & remote backup MD5 hash values" + return 2 fi rm -rf ${REMOTE_FILE} diff --git a/releasenotes/notes/helm-toolkit.yaml b/releasenotes/notes/helm-toolkit.yaml index 918baf4e0..eb13d25ea 100644 --- a/releasenotes/notes/helm-toolkit.yaml +++ b/releasenotes/notes/helm-toolkit.yaml @@ -58,4 +58,5 @@ helm-toolkit: - 0.2.49 Moved RabbitMQ Guest Admin removal to init - 0.2.50 Allow tls for external ingress without specifying key and crt - 0.2.51 Added a random delay up to 300 seconds to remote backup upload/download for load spreading purpose + - 0.2.52 Decreased random delay to up to 30 seconds and switched remote backup verification protocol to md5 ...