feat(system_baseline): optionally skip the upgrade while a vzdump backup is running #410

Open
Dragonish wants to merge 1 commits from feat/400-skip-upgrade-during-vzdump into main
pull from: feat/400-skip-upgrade-during-vzdump
Collaborator

What and why

Closes #400

An apt upgrade of a Proxmox node can restart Proxmox services while a backup holds a snapshot of a guest, and the role had no way to say "not now".

This adds system_baseline_skip_upgrade_during_vzdump (bool, default false). With true and system_baseline_system_type: pve, tasks/update.yml runs pvesh get /nodes/localhost/tasks --source active --limit 0 before the upgrade. A vzdump task without an endtime skips the upgrade, and a message says why. Autoremove, autoclean and the reboot check still run, and the role does not wait for the backup.

  • The command task has check_mode: false and changed_when: false. In the main flow's check mode it is skipped together with the upgrade; the update entry point (which previews the upgrade) asks.
  • The answer must be a JSON list, otherwise the run stops instead of upgrading on a guess.
  • __system_baseline_vzdump_running is set on every run, so a guard that is off never inherits an earlier answer.
  • With the default no pvesh command runs. The role adds one set_fact and one skipped debug to the task list.
  • argument_specs (the update entry point mentions it too), README (table, a section "Skipping the upgrade during a backup", the Tests list) and a minor_changes fragment.

Decisions beyond the issue, which you may want to look at:

  • --source active. pvesh lists only finished tasks by default (source defaults to archive), so without it a running backup is not in the answer. I read the default with pvesh usage on a Proxmox node.
  • localhost as the node. It is the node's own alias in the Proxmox API, so no node name and no gathered facts are needed (the update entry point may run without them). I ran the call on a node; if you prefer the real node name, it is one string.
  • One code path. The update entry point gets the guard too, as proposed in the issue. It is off unless a caller sets the input.

Verified

  • All commit-stage hooks passed (ansible-lint, yamllint, changelog fragments lint, REUSE, Conventional Commit, Assisted-by).
  • The seven scenario cases (running vzdump, running next to another task, finished vzdump, other task only, empty list, input off, ubuntu_lxc) pass on a Debian host with ansible-core 2.22.0, against this branch, with a pvesh stub. Breaking the endtime test makes them fail.
  • On a Proxmox node, read-only: pvesh usage /nodes/{node}/tasks shows --source (default archive) and --limit (0 to N); pvesh get /nodes/localhost/tasks --source active --limit 0 --output-format json answers [] with no backup running, and --source all lists finished vzdump tasks with an endtime.
  • An independent read-only review found the missing --source, a test that would have failed the check and idempotence steps (moved to verify.yml), a misplaced spec bullet and a line over 160 characters; all are fixed in this commit.

Not verified

  • A running backup: I have not seen --source active list a running vzdump task without an endtime (nothing was running); the guard relies on that.
  • Molecule: it runs only in CI. The verify.yml play is the first run of the cases there.
  • That the apt task itself is skipped: the cases assert the fact that decides it and the pvesh call, not the task result.
  • No Proxmox image exists in CI (open issue about a Debian 13 image), so the stub stands for the real answer.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none. (None.)

Assisted-by: Claude Code:claude-sonnet-5-5

## What and why Closes #400 An apt upgrade of a Proxmox node can restart Proxmox services while a backup holds a snapshot of a guest, and the role had no way to say "not now". This adds `system_baseline_skip_upgrade_during_vzdump` (bool, default `false`). With `true` and `system_baseline_system_type: pve`, `tasks/update.yml` runs `pvesh get /nodes/localhost/tasks --source active --limit 0` before the upgrade. A `vzdump` task without an `endtime` skips the upgrade, and a message says why. Autoremove, autoclean and the reboot check still run, and the role does not wait for the backup. - The command task has `check_mode: false` and `changed_when: false`. In the main flow's check mode it is skipped together with the upgrade; the `update` entry point (which previews the upgrade) asks. - The answer must be a JSON list, otherwise the run stops instead of upgrading on a guess. - `__system_baseline_vzdump_running` is set on every run, so a guard that is off never inherits an earlier answer. - With the default no `pvesh` command runs. The role adds one `set_fact` and one skipped `debug` to the task list. - argument_specs (the `update` entry point mentions it too), README (table, a section "Skipping the upgrade during a backup", the Tests list) and a `minor_changes` fragment. Decisions beyond the issue, which you may want to look at: - **`--source active`.** `pvesh` lists only finished tasks by default (`source` defaults to `archive`), so without it a running backup is not in the answer. I read the default with `pvesh usage` on a Proxmox node. - **`localhost` as the node.** It is the node's own alias in the Proxmox API, so no node name and no gathered facts are needed (the `update` entry point may run without them). I ran the call on a node; if you prefer the real node name, it is one string. - **One code path.** The `update` entry point gets the guard too, as proposed in the issue. It is off unless a caller sets the input. ## Verified - All commit-stage hooks passed (ansible-lint, yamllint, changelog fragments lint, REUSE, Conventional Commit, `Assisted-by`). - The seven scenario cases (running vzdump, running next to another task, finished vzdump, other task only, empty list, input off, `ubuntu_lxc`) pass on a Debian host with ansible-core 2.22.0, against this branch, with a `pvesh` stub. Breaking the `endtime` test makes them fail. - On a Proxmox node, read-only: `pvesh usage /nodes/{node}/tasks` shows `--source` (default `archive`) and `--limit` (0 to N); `pvesh get /nodes/localhost/tasks --source active --limit 0 --output-format json` answers `[]` with no backup running, and `--source all` lists finished `vzdump` tasks with an `endtime`. - An independent read-only review found the missing `--source`, a test that would have failed the `check` and `idempotence` steps (moved to `verify.yml`), a misplaced spec bullet and a line over 160 characters; all are fixed in this commit. ## Not verified - A running backup: I have not seen `--source active` list a running `vzdump` task without an `endtime` (nothing was running); the guard relies on that. - Molecule: it runs only in CI. The `verify.yml` play is the first run of the cases there. - That the apt task itself is skipped: the cases assert the fact that decides it and the `pvesh` call, not the task result. - No Proxmox image exists in CI (open issue about a Debian 13 image), so the stub stands for the real answer. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. (None.) Assisted-by: Claude Code:claude-sonnet-5-5
Dragonish added 1 commit 2026-11-26 23:03:25 +00:00
feat(system_baseline): optionally skip the upgrade while a vzdump backup is running
Build / build (pull_request) Successful in 42s
Lint / lint (pull_request) Successful in 2m48s
Molecule / molecule (pull_request) Successful in 15m25s
5519733312
An apt upgrade of a Proxmox node can restart Proxmox services while a
backup holds a snapshot of a guest, and the role had no way to say
"not now".

system_baseline_skip_upgrade_during_vzdump (bool, default false) makes
the main flow and the update entry point ask the node for its running
tasks (pvesh get /nodes/localhost/tasks --source active) before the
upgrade, on the pve system type only. A vzdump task without an end time
skips the upgrade with a message; autoremove, autoclean and the reboot
check still run. The role does not wait for the backup. A pvesh answer
that is not a JSON list stops the run. With the default no pvesh
command runs.

Closes #400

Assisted-by: Claude Code:claude-sonnet-5-5
All checks were successful
Build / build (pull_request) Successful in 42s
Required
Details
Lint / lint (pull_request) Successful in 2m48s
Required
Details
Molecule / molecule (pull_request) Successful in 15m25s
Required
Details
This pull request is blocked because it's outdated.
You are not authorized to merge this pull request.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/400-skip-upgrade-during-vzdump:feat/400-skip-upgrade-during-vzdump
git checkout feat/400-skip-upgrade-during-vzdump
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#410