cloudstack/scripts/vm/hypervisor/kvm
jmsperu 0deb4c4803 fix(nas-backup): timeout, free-space check, trap-based cleanup with VM resume
Three independent reliability fixes for the KVM NAS backup script, layered on
top of the existing quiesce + EXIT_CLEANUP_FAILED groundwork:

1. BACKUP_TIMEOUT env var (default 6h) bounds the libvirt domjobinfo wait
   loop in backup_running_vm. Today a stuck QEMU backup holds the agent's
   command slot until the orchestrator-level timeout fires. The new guard
   issues domjobabort and exits non-zero so the agent reclaims the slot
   promptly.

2. MIN_FREE_SPACE env var (default 1 GiB) + check_free_space() runs after
   mount and before any qemu-img convert in both backup_running_vm and
   backup_stopped_vm. Fail-fast on a near-full NAS instead of failing
   mid-write halfway through a multi-GiB convert.

3. trap cleanup EXIT replaces the six explicit cleanup() call sites as the
   primary cleanup mechanism so orphan NFS mounts no longer accumulate when
   the script dies to SIGTERM, SIGINT, or any uncaught set -e failure
   between the explicit call sites. cleanup() is now guarded by
   CLEANUP_DONE so the trap doesn't re-run an already-completed cleanup
   from an explicit call.

cleanup() additionally resumes the VM if it's still paused — backup-begin
holds the guest paused briefly and a failed backup mid-pause currently
leaves the guest stuck in 'paused' state until an operator intervenes.

Targets main; supersedes the 4.20-targeted version of this PR.
2026-05-23 00:56:30 +03:00
..
gpudiscovery.sh Fix domain parsing for GPU & add Display controller in the supported PCI class (#12981) 2026-04-10 09:23:07 +05:30
kvmheartbeat.sh KVM Host HA improvements - Fix to not cancel VM HA items when Host HA inspection in progress, and some code improvements (#13088) 2026-05-08 19:50:50 +05:30
kvmsmpheartbeat.sh KVM: Enable HA heartbeat on ShareMountPoint (#12773) 2026-04-10 14:12:40 +05:30
kvmspheartbeat.sh KVM Host HA enhancement for StorPool storage (#8045) 2023-11-04 12:35:37 +05:30
kvmvmactivity.sh Improve logs on kvmvmactivity.sh (#4704) 2021-05-10 16:26:55 +02:00
nasbackup.sh fix(nas-backup): timeout, free-space check, trap-based cleanup with VM resume 2026-05-23 00:56:30 +03:00
nsrkvmbackup.sh Standardize and auto add license headers for Shell files with pre-commit (#12070) 2025-11-14 14:23:41 +01:00
nsrkvmrestore.sh Standardize and auto add license headers for Shell files with pre-commit (#12070) 2025-11-14 14:23:41 +01:00
patch.sh Adding AutoScaling for cks + CKS CoreOS EOL update + systemvmtemplate improvements (#4329) 2021-10-06 21:17:41 +05:30
setup_agent.sh pre-commit: add hook to trim trailing whitespace (#8205) 2024-05-28 09:01:30 +02:00