feat: Proxmox VE 9.3 API additions (NetOrk/netork#2728)

On a node running 9.3: HA maintenance over PUT /nodes/{node}/maintenance
(the target node's version decides, SSH below it), the guest uid in
get_vms, the cluster-id as ClusterDict.id, sync-time-on-resume on resume.
get_credential_expiry reads the expiry of the token or account the driver
logged in with; get_update_history lists the node's APT transactions.
Needs napalm-device-types 4.44.0.
This commit is contained in:
Christian Manivong committed 2026-11-26 17:35:50 +01:00
1 parent c2d9d7e75e
commit fddf8af680
17 files changed
+718 -17

No files matched your search

+13 -6
View File
@@ -4,8 +4,8 @@ Every PVE node can read its whole cluster, so the getter always reports exactly
one cluster, the one the connected node is a member of (a standalone node is a
cluster of one, without a name). Read from:
- ``GET /cluster/status``: the cluster's name and quorum, and every member with
``online`` and ``local``;
- ``GET /cluster/status``: the cluster's name, quorum and (PVE 9.3) ``cluster-id``,
and every member with ``online`` and ``local``;
- ``GET /cluster/resources``: per node ``maxcpu``, ``cpu``, ``maxmem``, ``mem``;
per node and storage one row with ``plugintype``, ``shared``, ``content``,
``maxdisk``, ``disk`` and ``status``;
@@ -124,6 +124,12 @@ def _name_backup_servers(storages: list[ClusterStorageDict], api: Any) -> None:
storage["backup_server"] = _backup_server_ref(config) if config else None
def _cluster_id(head: _JsonDict | None, status: list[_JsonDict]) -> str | None:
"""``cluster-id`` (PVE 9.3) of the cluster entry, or of a standalone node's own entry."""
entry = head or next((s for s in status if s.get("type") == "node"), {})
return str(entry.get("cluster-id") or "") or None
def _merge_bridges(per_node: list[tuple[str, list[_JsonDict]]]) -> list[ClusterNetworkDict]:
merged: dict[str, ClusterNetworkDict] = {}
for node, network in per_node:
@@ -149,9 +155,10 @@ class ProxmoxClusterMixin:
"""
Return the one cluster this node belongs to, its nodes, storages and networks.
- ``id`` is always None: PVE gives a cluster no identity beyond its name.
``name`` and ``quorate`` are None on a standalone node, which reports
itself as a cluster of one.
- ``id`` is the ``cluster-id`` of PVE 9.3, a random identifier the cluster
keeps when it is renamed; a standalone node reports its own on its node
entry. None on an older node. ``name`` and ``quorate`` are None on a
standalone node, which reports itself as a cluster of one.
- Every member is listed. An offline node has ``status`` ``"offline"`` and
no capacity values: its own API cannot be asked. ``local`` marks the
node ``/cluster/status`` calls local, or else the node this driver
@@ -181,7 +188,7 @@ class ProxmoxClusterMixin:
_name_backup_servers(storages, self._api)
return [
{
"id": None,
"id": _cluster_id(head, status),
"name": (head.get("name") or None) if head else None,
"quorate": _flag(head.get("quorate")) if head else None,
"nodes": self._cluster_nodes(members, resources),