Hanarion commented on code in PR #12133:
URL: https://github.com/apache/cloudstack/pull/12133#discussion_r2902561672
##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -218,6 +219,34 @@ mount_operation() {
fi
}
+umount_operation() {
+ elapsed=0
+ while fuser -m "$mount_point" >/dev/null 2>&1 && (( elapsed < 10 )); do
+ sleep 1
+ elapsed=$((elapsed + 1))
+ done
+
+ # Check if timeout was reached
+ if (( elapsed >= 10 )); then
+ echo "Timeout for unmounting reached: still busy"
+ fi
+
+ # Attempt to unmount safely and capture output
+ set +e
+ umount_output=$(umount "$mount_point" 2>&1)
+ umount_exit=$?
+ set -e
Review Comment:
The script was set to exit on error at the start of the file, but when
unmounting fails it does not give any error output, capturing the output allows
to generate a log and an error message that is verbose and allows the
administrator to know there is an issue.
Also when umount fails and stops the script, the backup is reported as
failed and can't be deleted from Cloudstack as in the DB of Cloudstack this
backup is failed and not created. Removing the exit on error and instead
logging allows the backup to be marked as success.
In most of the cases, the umount should not fail, as we are waiting before
for the fs to be synced. But in the case it does, it allows the backup to be
usable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]