Releases: doutsis/vmbackup
Releases · doutsis/vmbackup
v0.5.6
Changed
- Structured exit codes — categorised non-zero exits (config / lock / storage / VM / tool / CLI / dependency) let monitoring distinguish why a run failed without parsing logs. Symmetric with vmrestore.
Fixed
- Retention not enforced for skipped or excluded VMs — Retention was wired only to the post-backup success path, so any VM that was skipped (
SKIP_OFFLINE_UNCHANGED_BACKUPS=true) or excluded (policy=never) accumulated period directories indefinitely with no rotation. The same code path also created the period directory viamkdir -pbefore deciding whether the backup would run, leaving an empty stub on disk every time a VM was skipped, excluded, or failed before first write. Combined effect on production: VMs atRETENTION_WEEKS=4carrying 8+ weekly directories, including pure stubs that no later session would ever clean up. Retention is now invoked from the skip and exclude paths via the newrun_retention_for_unbacked_vmwrapper, which orders stub cleanup before retention so the period count is correct before the limit check runs. Excluded VMs (policy=never) have stubs removed but their populated periods are preserved by the policy short-circuit. Failed-path retention remains intentionally suppressed; failed-path stubs are reaped on the next non-failed session.
Added
- Stub-aware retention pipeline for unbacked VMs — A new
run_retention_for_unbacked_vmwrapper inmodules/retention_module.shruns stub cleanup → retention → orphan retention in that order whenever a VM is skipped or excluded, so the on-disk period count is correct before the limit check fires. Stub cleanup is performed by the new_remove_empty_period_dirshelper, which removes pure stub directories (zero*.data, no.archives/) and is anchored toBACKUP_PATHwith a path-shape regex guard, deliberately bypassing_remove_period's keep-last, replication, and protected-period guards (all inappropriate for empty directories). Stub deletions in SQLite go through a new UPDATE-only library functionsqlite_mark_chain_deleted_if_exists(inlib/sqlite_module.sh) to avoid injecting phantomactive-then-deletedchain_healthrows when a pure stub never had a row to begin with.
Changed
retention_eventsaudit attribution — Field 12 (triggered_by) no longer carries hardcoded function-name literals; it now records the high-level event that drove the prune, with new enum valuesskipped,excluded, andorphan_dirjoining the existingpost_backup,prune, andorphan_retention. Theactioncolumn also gainsremove_stubfor the new stub-cleanup path. Internally,_remove_period,_remove_orphan_period,_remove_archive_chain,_remove_archives_in_period,_remove_vm_all,run_retention_for_vm, andrun_orphan_retention_for_vmall gain a newtriggerparameter so the originating event propagates through the call chain into the audit row — making it possible to attribute retention activity to skipped-VM and excluded-VM sessions for the first time.
v0.5.5
Added
- Configurable backup-destination space thresholds — Four new optional
vmbackup.confsettings (DISK_ABORT_PCT,DISK_WARN_PCT,DISK_ABORT_GB,DISK_WARN_GB) letcheck_disk_space()be tuned per instance. Percent and absolute thresholds are evaluated together so either can fire independently; setting any threshold to0disables it. Defaults (20%/30% and 10 GB/50 GB) preserve previous behaviour. - Disk-space snapshot per session (schema v2.1) —
sessionstable gainsdisk_free_bytesanddisk_total_bytescolumns, populated bysqlite_session_end()from adfcapture againstBACKUP_PATH. Migration from v2.0 is automatic, idempotent and additive. --statusreporting command — Seven report modes: sessions, VM history, failures, replication, chains, storage, policies. Terminal tables by default,--csvfor export,--days Nfor time window,--all-instancesto span every config instance. Sessions output is job-type-aware (backup / prune / replicate-only / mixed) and scoped to the activeCONFIG_INSTANCEby default. The storage report includes per-VM size trends and a destination-growth projection that names the configuredDISK_ABORT_PCTthreshold.- Post-upgrade config advisory in
postinst— On dpkg upgrade, lists.dpkg-distfiles awaiting merge with per-filediff -ucommands and points custom config instances atconfig/template/vmbackup.conffor new variables. Visible only on upgrade. vmbackup --config-prune-removed— Cleanup helper that comments out configuration variables removed in the running release. Idempotent; supports--dry-run. Operates ondefault/and all custom instances; skipstemplate/. Per-name allowlist keyed to release version, designed to be extended by future config-pruning ENHs.
Fixed
- Pre-flight aborts failed silently with no email —
check_backup_destination(),check_scratch_path()andcheck_disk_space()exit beforemain()reaches its normal email send, so destination/scratch/space failures left no notification (only a journal entry).cleanup_on_exit()now sends a failure report on any non-zero exit once a SQLite session has been registered, gated by_EMAIL_SENTso the existing success/failure path remains the single source of truth on normal runs. SKIP_OFFLINE_UNCHANGED_BACKUPSis now honoured — Previously the variable was defined and validated but never read; offline-unchanged VMs were always skipped regardless of the setting. The change-detection call inbackup_vm()is now gated by this flag.
Removed
OFFLINE_CHANGE_DETECTION_THRESHOLD— Was never read by the change-detection code (which uses strictmtime > last_backup). The variable inverted the safe default and would have introduced false negatives if implemented. Existing values in operator configs are inert; runvmbackup --config-prune-removedto clean them up.EMAIL_INCLUDE_REPLICATION— Was never read. Hiding replication results from the email is operator-hostile (silent on success, dangerous on failure). The empty-section logic already handles the no-replication case.EMAIL_INCLUDE_DISK_SPACE— Was never read; gated a section that was never built. A real disk-usage email section is tracked as ENH-16.
v0.5.4
Fixed
- SQLite session not finalised on normal exit — Sessions could be left permanently "in progress" in the database. Now finalised unconditionally in
cleanup_on_exit()with idempotency guard. - Silent permission failures on backup path —
chown/chmodfailures now log warnings instead of being silently suppressed with|| true. - Stale lock cleanup could delete active locks — Now validates PID liveness before deletion and uses correct
vmbackup-*.lockglob. - Session PID lock race condition — Replaced non-atomic check-then-write with
noclobberpattern. - Double email on SIGTERM — Added
_EMAIL_SENTguard flag. - virtnbdbackup not confirmed dead before retry — Added
pgrep/pkillcleanup andvirsh domjobabortbefore retry. - Reorder config-instance validation before session lock —
--config-instance nonexistentnow fails immediately at startup.
Install
wget https://github.com/doutsis/vmbackup/releases/download/v0.5.4/vmbackup_0.5.4_all.deb
sudo dpkg -i vmbackup_0.5.4_all.debFull changelog: CHANGELOG.md
v0.5.3
Added
--runflag required to start backups — explicit mode for all operations--vmtargeted backup mode — back up specific VMs on demand- Unknown flag detection and
--cancel-replicationconflict guards - Root privilege check with clear error message
- Global session lock to prevent concurrent invocations
session_typecolumn in SQLite sessions table (schema v2.0)
Changed
SKIP_OFFLINE_UNCHANGED_BACKUPSdefault changed totrue--helpoutput restructured- Systemd service updated with
--runflag - Documentation rewritten — condensed from ~4,500 to ~2,900 lines
Removed
- Host Configuration Backup feature
Fixed
RETENTION_ORPHAN_DRY_RUNconfig setting was being ignored
See CHANGELOG.md for full details.
v0.5.2
See CHANGELOG.md for details.
v0.5.1
Fixed
- chain_health off-by-one —
total_checkpointsandrestorable_countwere 0 after first backup instead of 1 - restore_points counted per-disk instead of per-backup — multi-disk VMs reported 3× the correct count
- csv_ variable name remnants — 25 stale variable names and dead CSV cleanup code removed
- Archived chains missing vmconfig XML and TPM marker — chain archives were incomplete; now self-contained
See CHANGELOG.md for details.