Skip to content

Add debug logging for VM/LXC backup-skip decisions#16

Draft
nomis52 wants to merge 2 commits into
masterfrom
worktree-skip-vm-debug-logs
Draft

Add debug logging for VM/LXC backup-skip decisions#16
nomis52 wants to merge 2 commits into
masterfrom
worktree-skip-vm-debug-logs

Conversation

@nomis52

@nomis52 nomis52 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Context

The backup workflow skips a stopped VM/LXC when its most recent backup already post-dates the guest's last power-off. The skip logic wasn't visibly firing — debug logging was enabled but the existing "Skipping stopped VM already backed up after power-off" line never appeared, and nothing logged the inputs to the decision, so there was no way to see which condition was failing.

Changes

All confined to determineBackups in workflows/backup/backup_vms.go; logging only, no behavioural change:

  • Per-resource evaluation dump — logs status, type, last_backup at the top of the loop, immediately revealing e.g. if status isn't the literal "stopped" the code compares against.
  • Stop-time comparison dump — logs stopped_at, stop_time_found, and backup_after_stop on the success path (before the skip test, not only when it fires), pinpointing whether the stop-task lookup returned found=false or the timestamps didn't line up.
  • Age-check outcome logs — explicit select/skip lines ("Selecting resource for backup" with reason, "Skipping resource with recent backup").
  • resource.Type (qemu/lxc) added throughout so VMs and LXCs are distinguishable.

Verification

make fmt && make build && make test all pass.

🤖 Generated with Claude Code

nomis52 and others added 2 commits July 8, 2026 09:03
The stopped-guest skip logic in determineBackups only logged the
successful-skip case, and at debug level. With debug logging enabled a
guest that was unexpectedly backed up left no trace of why the skip
branch was not taken.

Add debug lines exposing the raw comparison inputs at each decision
point: a per-resource evaluation dump (status, type, last_backup), the
stop-time comparison (stopped_at, stop_time_found, backup_after_stop)
logged before the skip test rather than only when it fires, and explicit
select/skip lines for the age check. resource.Type is now included so
VMs (qemu) and LXCs (lxc) are distinguishable in the logs.

No behavioural change; logging only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
make fmt ran go fmt repo-wide and git add -A swept 13 pre-existing,
non-gofmt-clean files into the previous commit. Restore them to their
master state so this PR is scoped to the logging change alone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant