You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "abh1sar (via GitHub)" <gi...@apache.org> on 2026/05/14 04:02:42 UTC
Re: [PR] Creating a unmount_operation with safety checks for nasbackup.sh [cloudstack]
abh1sar commented on code in PR #12133:
URL: https://github.com/apache/cloudstack/pull/12133#discussion_r3238984941
##########
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
+
+ if [ "$umount_exit" -eq 0 ]; then
+ # Only remove directory if unmount succeeded
+ rmdir "$mount_point"
+ else
+ echo "Warning: failed to unmount $mount_point, skipping rmdir"
Review Comment:
ping @Hanarion
just a gentle reminder
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org