Hanarion commented on issue #12122:
URL: https://github.com/apache/cloudstack/issues/12122#issuecomment-3575056942

   If we should not return it as a backup failure event if unmount fails, then 
we need to catch the failure of unmount and neutralize it, and instead of `exit 
1` when the fuser check times out, we need to `exit 0`, so, something like that 
:
   ```bash
     # Print statistics
     virsh -c qemu:///system domjobinfo $VM --completed
     du -sb $dest | cut -f1
   
     elapsed=0
     while fuser -m "$mount_point" >/dev/null 2>&1; do
       if (( elapsed >= 10 )); then
         echo "Timeout for unmounting reached: still busy"
         exit 0
       fi
       sleep 1
       elapsed=$((elapsed + 1))
     done
   
     # Attempt to unmount, ignore failure
     if umount "$mount_point"; then
       # Only remove directory if unmount succeeded
       rmdir "$mount_point"
     else
       echo "Warning: failed to unmount $mount_point, skipping rmdir"
     fi
   ```


-- 
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]

Reply via email to