MitchDrage commented on code in PR #14305:
URL: https://github.com/apache/cloudstack/pull/14305#discussion_r4205647761


##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -503,9 +530,33 @@ mount_operation() {
   fi
 }
 
+abort_backup_job() {
+  [[ $BACKUP_JOB_ACTIVE -eq 1 ]] || return 0
+
+  # The push backup job writes into $dest until it ends, so it must be gone 
before the
+  # destination is removed or unmounted.
+  virsh -c qemu:///system domjobabort "$VM" > /dev/null 2>>"$logFile" || true
+  local i job
+  for ((i = 0; i < 60; i++)); do
+    job=$(virsh -c qemu:///system domjobinfo "$VM" 2>/dev/null | awk '/Job 
type:/ {print $3}')
+    if [[ -z "$job" || "$job" == "None" ]]; then
+      BACKUP_JOB_ACTIVE=0
+      return 0
+    fi
+    sleep 1
+  done

Review Comment:
   Fixed in 90410e31b5.
   The abort wait now ends only when domjobinfo succeeds and reports None. 
Failed queries keep polling, and after 60 seconds the destination stays mounted.
   
   As an aside, I found the same issue in the main polling loop: under set -e, 
one failed query exited the script with no cleanup and the job still running. 
Fixed in 3a258b5e2c, which retries for a minute and then aborts through 
cleanup().
   
   Tested by killing libvirtd mid-backup: a 20-second outage was ridden out, 
and a permanent one left the files and mount in place with exit code 20.



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