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

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).
This commit is contained in:
Christian Manivong committed 2026-11-01 22:15:01 +01:00
1 parent cb29a42c31
commit 0704d9a102
11 files changed
+1653 -17

No files matched your search

+14
View File
@@ -167,6 +167,13 @@ SDN_VNETS = [
{"vnet": "overlay", "zone": "fabric", "tag": 100000, "type": "vnet", "digest": "x"},
]
# /cluster/config/nodes: corosync's nodelist; corosync.conf keeps every value a string.
CONFIG_NODES = [
{"node": "pve1", "name": "pve1", "nodeid": "1", "quorum_votes": "1", "ring0_addr": "10.0.0.1"},
{"node": "pve2", "name": "pve2", "nodeid": "2", "quorum_votes": "1", "ring0_addr": "10.0.0.2"},
{"node": "pve3", "name": "pve3", "nodeid": "3", "quorum_votes": "2", "ring0_addr": "10.0.0.3"},
]
HA_MANAGER_STATUS = {
"manager_status": {
"master_node": "pve1",
@@ -213,6 +220,12 @@ def _api(
manager.side_effect = ha
else:
manager.return_value = HA_MANAGER_STATUS if ha is None else ha
# Read for get_clusters' votes, HA resources and backups; see test_cluster_ha_backups.
api.cluster.config.nodes.get.return_value = CONFIG_NODES
api.cluster.ha.resources.get.return_value = []
api.cluster.ha.status.current.get.return_value = []
api.cluster.ha.rules.get.return_value = []
api.cluster.backup.get.return_value = []
return api
@@ -268,6 +281,7 @@ class TestNodes:
"cpu_usage": 0.25,
"memory_total": 128 * GIB,
"memory_used": 64 * GIB,
"votes": 1,
}
def test_other_member_is_not_local(self):