DaanHoogland commented on code in PR #12872:
URL: https://github.com/apache/cloudstack/pull/12872#discussion_r3052194264


##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -221,6 +223,20 @@ mount_operation() {
 cleanup() {
   local status=0
 
+  # Resume the VM if it was paused (e.g. by virsh backup-begin)
+  if [[ -n "$VM" ]]; then
+    local vm_state
+    vm_state=$(virsh -c qemu:///system domstate "$VM" 2>/dev/null)
+    if [[ "$vm_state" == "paused" ]]; then
+      if virsh -c qemu:///system resume "$VM" > /dev/null 2>&1; then
+        log -ne "Resumed VM $VM after backup failure"
+      else
+        echo "Failed to resume VM $VM - manual intervention required (virsh 
resume $VM)"
+        status=1
+      fi
+    fi
+  fi

Review Comment:
   @jmsperu , could this be made a separate method?
   
   ```
     # Resume the VM if it was paused (e.g. by virsh backup-begin)
     if [[ -n "$VM" ]]; then
       local vm_state
       vm_state=$(virsh -c qemu:///system domstate "$VM" 2>/dev/null)
       if [[ "$vm_state" == "paused" ]]; then
         if virsh -c qemu:///system resume "$VM" > /dev/null 2>&1; then
           log -ne "Resumed VM $VM after backup failure"
         else
           echo "Failed to resume VM $VM - manual intervention required (virsh 
resume $VM)"
           status=1
         fi
       fi
     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