feat: HA state, backups and votes in get_clusters(); migrate_vm, preflight, maintenance #42

Merged
christianmanivong merged 1 commits from feat/vm-lifecycle into main 2026-11-01 22:02:36 +00:00
Owner

Summary

Stage 7 of NetOrk/netork#1820 on Proxmox VE: HA state, backups and votes in get_clusters(), live migration with PVE's own pre-flight, HA maintenance mode.

Changes

  • get_clusters(): /cluster/ha/resources, /cluster/ha/status/current, /cluster/ha/rules (PVE 9; PVE 8 gives rules: []); /cluster/backup with pool members (/pools?poolid=, falling back to /pools/{id}); the newest backup per guest on each backup storage, PBS included; /cluster/config/nodes votes. Each read is best-effort; a partial list is None, never half a list.
  • get_vm_migration_preflight(): qemu from GET …/qemu/{vmid}/migrate (refusal reasons in plain words, a local ISO in a CD drive as a local resource); lxc from cluster membership and mount points.
  • migrate_vm(): refuses a non-member or the current node before the API; online/with-local-disks/restart as fitting; follows the task, an HA-managed guest through the HA manager; on failure raises with the task log's ERROR: lines (log read with limit=50000).
  • set_node_maintenance(): ha-manager crm-command node-maintenance enable|disable over SSH, node validated and quoted.
  • New modules cluster_ha.py, cluster_backups.py, migration.py, vm_migrate_mixin.py, pve_values.py.

Testing

  • 443 passed (coverage 74.84 %); ruff, mypy strict, napalm-standard check and ratchet green. Fixtures follow pve-ha-manager, pve-manager and qemu-server sources.

Needs NAPALM/napalm-device-types feat/vm-lifecycle merged first (the CI pre-installs device-types from main).

## Summary Stage 7 of NetOrk/netork#1820 on Proxmox VE: HA state, backups and votes in `get_clusters()`, live migration with PVE's own pre-flight, HA maintenance mode. ## Changes - `get_clusters()`: `/cluster/ha/resources`, `/cluster/ha/status/current`, `/cluster/ha/rules` (PVE 9; PVE 8 gives `rules: []`); `/cluster/backup` with pool members (`/pools?poolid=`, falling back to `/pools/{id}`); the newest backup per guest on each backup storage, PBS included; `/cluster/config/nodes` votes. Each read is best-effort; a partial list is None, never half a list. - `get_vm_migration_preflight()`: qemu from `GET …/qemu/{vmid}/migrate` (refusal reasons in plain words, a local ISO in a CD drive as a local resource); lxc from cluster membership and mount points. - `migrate_vm()`: refuses a non-member or the current node before the API; online/with-local-disks/restart as fitting; follows the task, an HA-managed guest through the HA manager; on failure raises with the task log's `ERROR:` lines (log read with `limit=50000`). - `set_node_maintenance()`: `ha-manager crm-command node-maintenance enable|disable` over SSH, node validated and quoted. - New modules `cluster_ha.py`, `cluster_backups.py`, `migration.py`, `vm_migrate_mixin.py`, `pve_values.py`. ## Testing - 443 passed (coverage 74.84 %); ruff, mypy strict, `napalm-standard check` and `ratchet` green. Fixtures follow pve-ha-manager, pve-manager and qemu-server sources. Needs NAPALM/napalm-device-types `feat/vm-lifecycle` merged first (the CI pre-installs device-types from main).
christianmanivong added 1 commit 2026-11-01 21:15:26 +00:00
feat: HA state, backups and votes in get_clusters(); migrate_vm, preflight, maintenance
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m27s
CI / driver (pull_request) Successful in 3m4s
driver / publish (pull_request) Skipped
0704d9a102
get_clusters() reads /cluster/ha/* (PVE 8 and 9), /cluster/backup with pool
members, the newest backup per guest on each backup storage (PBS included) and
/cluster/config/nodes votes; each read is best-effort. migrate_vm() moves a
guest of the connected node and follows the task (HA-managed guests through
the HA manager), raising with the task log's ERROR lines;
get_vm_migration_preflight() maps PVE's own pre-flight; set_node_maintenance()
runs ha-manager over SSH.

Part of NetOrk/netork#1820 (stage 7: #759, #760, #761).
christianmanivong merged commit 8dad7c3767 into main 2026-11-01 22:02:36 +00:00
christianmanivong deleted branch feat/vm-lifecycle 2026-11-01 22:02:36 +00:00
Sign in to join this conversation.