KVM NAS backup: resume VM and exit on backup failure#12872
Open
jmsperu wants to merge 1 commit intoapache:4.22from
Open
KVM NAS backup: resume VM and exit on backup failure#12872jmsperu wants to merge 1 commit intoapache:4.22from
jmsperu wants to merge 1 commit intoapache:4.22from
Conversation
Fix three bugs in nasbackup.sh that caused VMs to remain paused indefinitely when backup jobs fail (e.g. storage full): 1. Add exit after cleanup on Failed backup job status to prevent infinite polling loop in backup_running_vm() 2. Add exit after cleanup on qemu-img convert failure in backup_stopped_vm() to stop processing subsequent disks 3. Add VM state check and virsh resume to cleanup() so paused VMs are automatically resumed after backup failure Fixes apache#12821
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix three bugs in
nasbackup.shthat caused VMs to remain paused indefinitely when backup jobs fail (e.g. storage full, I/O error):Infinite polling loop:
backup_running_vm()falls through theFailedcase without exiting, causing the script to poll the already-failed job forever. Fixed by addingexit 1after cleanup.Continued processing after failure:
backup_stopped_vm()continues processing subsequent disks afterqemu-img convertfails. Fixed by addingexit 1after cleanup.VM never resumed:
cleanup()removes temp files and unmounts but never resumes the VM that was paused byvirsh backup-begin. Fixed by adding a VM state check andvirsh resumeat the top ofcleanup().Root Cause
When
virsh backup-beginstarts a backup, the VM may be paused. If the backup fails for any reason (storage full, network issue, I/O error), the script's cleanup path never callsvirsh resume, leaving the VM paused until manual intervention.Test Plan
qemu-img convertfailure on stopped VM exits cleanlyFixes #12821