Title: KVM NAS backup: VM remains paused indefinitely when backup job fails · Issue #12821 · apache/cloudstack · GitHub
Open Graph Title: KVM NAS backup: VM remains paused indefinitely when backup job fails · Issue #12821 · apache/cloudstack
X Title: KVM NAS backup: VM remains paused indefinitely when backup job fails · Issue #12821 · apache/cloudstack
Description: Description When using the NAS backup plugin on KVM, if a backup job fails (e.g. due to backup storage being full or I/O errors on the NFS target), the VM remains indefinitely paused at the hypervisor level. CloudStack marks the backup a...
Open Graph Description: Description When using the NAS backup plugin on KVM, if a backup job fails (e.g. due to backup storage being full or I/O errors on the NFS target), the VM remains indefinitely paused at the hypervi...
X Description: Description When using the NAS backup plugin on KVM, if a backup job fails (e.g. due to backup storage being full or I/O errors on the NFS target), the VM remains indefinitely paused at the hypervi...
Opengraph URL: https://github.com/apache/cloudstack/issues/12821
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"KVM NAS backup: VM remains paused indefinitely when backup job fails","articleBody":"## Description\n\nWhen using the NAS backup plugin on KVM, if a backup job fails (e.g. due to backup storage being full or I/O errors on the NFS target), the VM remains **indefinitely paused** at the hypervisor level. CloudStack marks the backup as `Error` but does not resume the VM, leaving it unresponsive until manually resumed via `virsh resume`.\n\n## Steps to Reproduce\n\n1. Configure NAS backup with NFS storage for a running KVM VM\n2. Fill up the NFS backup storage to 100% capacity\n3. Wait for the scheduled backup to trigger\n4. Observe the VM becomes paused and never resumes\n\n## Expected Behavior\n\nThe VM should be automatically resumed after a backup failure. The backup should be marked as failed, but the VM should continue running normally.\n\n## Actual Behavior\n\nThe VM remains in a `paused` state indefinitely. The backup monitoring loop in `nasbackup.sh` enters an infinite cycle:\n1. `virsh backup-begin` pauses the QEMU domain for consistent snapshot\n2. Backup write fails (storage full)\n3. `domjobinfo` reports `Failed` status\n4. `cleanup()` is called but **does not resume the VM**\n5. No `exit` statement after cleanup — loop continues, repeatedly detecting the failed job\n\n## Root Cause Analysis\n\nThree bugs in `scripts/vm/hypervisor/kvm/nasbackup.sh`:\n\n### Bug 1: Missing exit after failed backup cleanup (line 144)\n```bash\ncase \"$status\" in\n Failed)\n echo \"Virsh backup job failed\"\n cleanup ;; # \u003c-- no exit, falls through to sleep and loops forever\nesac\n```\n\n### Bug 2: cleanup() never resumes the VM (line 222)\nThe `cleanup()` function only removes files and unmounts storage. It never checks if the VM is paused or attempts to resume it, even though `virsh backup-begin` may have paused the domain.\n\n### Bug 3: Missing exit in backup_stopped_vm() (line 181)\nSimilar to Bug 1, `backup_stopped_vm()` calls `cleanup()` on `qemu-img convert` failure but does not exit, allowing the loop to continue processing subsequent disks.\n\n## Impact\n\n- **Production outage**: All services on the affected VM become unresponsive\n- **Cascading failures**: When backup storage fills up, ALL VMs being backed up get paused simultaneously\n- **Silent failure**: CloudStack UI shows the VM as \"Running\" while it is actually paused at the KVM level\n- **No automatic recovery**: Manual intervention (`virsh resume`) is required per VM\n\nIn our environment, NFS backup storage filling to 100% caused **8 production VMs** to become paused simultaneously across 3 KVM hosts, with some VMs remaining paused for over 6 hours before detection.\n\n## Environment\n\n- CloudStack 4.19/4.20/main (code is unchanged across versions)\n- KVM hypervisor\n- NAS backup plugin with NFS storage\n- File: `scripts/vm/hypervisor/kvm/nasbackup.sh`\n\n## Proposed Fix\n\nPR forthcoming with the following changes:\n1. Add VM state check and `virsh resume` to `cleanup()` function\n2. Add missing `exit 1` after `cleanup()` in the `Failed` backup job case\n3. Add missing `exit 1` after `cleanup()` in `backup_stopped_vm()` on `qemu-img convert` failure","author":{"url":"https://github.com/jmsperu","@type":"Person","name":"jmsperu"},"datePublished":"2026-03-17T03:56:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/12821/cloudstack/issues/12821"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8c566afc-4cee-575c-2263-2d44c653d84f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 965C:16195D:130000B:19B4983:6A4EF272 |
| html-safe-nonce | b6e72a20ef1a86c2ae4a4ceda22d03c1d4f81f508c32e082f61cc1a303fb930d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjVDOjE2MTk1RDoxMzAwMDBCOjE5QjQ5ODM6NkE0RUYyNzIiLCJ2aXNpdG9yX2lkIjoiNjk4ODgzNDA1OTI5Mjk2MzQ0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d37869b01c35652d304557de9c589636fefe7be19ab04d3800b59f32e54ea004 |
| hovercard-subject-tag | issue:4086053729 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/cloudstack/12821/issue_layout |
| twitter:image | https://opengraph.githubassets.com/454878c0b3e76c7938b0bcc3c727909b162fca2bde8369e001268221a386f70e/apache/cloudstack/issues/12821 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/454878c0b3e76c7938b0bcc3c727909b162fca2bde8369e001268221a386f70e/apache/cloudstack/issues/12821 |
| og:image:alt | Description When using the NAS backup plugin on KVM, if a backup job fails (e.g. due to backup storage being full or I/O errors on the NFS target), the VM remains indefinitely paused at the hypervi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jmsperu |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 00d04d6b867d2f16ab50bebae8ccc56e07c8988b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width