fix: resolve the node the connection landed on, not the first cluster member #2

Merged
christianmanivong merged 1 commits from fix/cluster-node-resolution into master 2026-09-29 08:44:25 +00:00
Owner

_resolve_node() took the first entry of GET /nodes, which in a cluster is just some member. That made pve-dual (172.22.8.120) report pve-02's name and VMs, and netOrk's VM sync moved pve-02's VM devices over to it (NetOrk/netork#417).

It also swallowed API errors: with a self-signed certificate and verify_ssl on, open() still succeeded and every poll reported success with empty data (NetOrk/netork#418).

Change

  • Resolve through GET /cluster/status. The entry marked local comes first, then a match by IP or (short) name, then the sole node of a standalone host. If none of these match, raise ConnectionException instead of guessing.
  • API errors now propagate, so open() fails with the real cause.

Verification

  • 8 new tests in tests/test_connection.py; the full suite passes (204).
  • Live and read-only against the home cluster with node removed from driver_args: .101→pve-01, .102→pve-02, .120→pve-dual, .5→pve-garden.
`_resolve_node()` took the first entry of `GET /nodes`, which in a cluster is just some member. That made pve-dual (172.22.8.120) report pve-02's name and VMs, and netOrk's VM sync moved pve-02's VM devices over to it (NetOrk/netork#417). It also swallowed API errors: with a self-signed certificate and `verify_ssl` on, `open()` still succeeded and every poll reported success with empty data (NetOrk/netork#418). **Change** - Resolve through `GET /cluster/status`. The entry marked `local` comes first, then a match by IP or (short) name, then the sole node of a standalone host. If none of these match, raise `ConnectionException` instead of guessing. - API errors now propagate, so `open()` fails with the real cause. **Verification** - 8 new tests in `tests/test_connection.py`; the full suite passes (204). - Live and read-only against the home cluster with `node` removed from driver_args: .101→pve-01, .102→pve-02, .120→pve-dual, .5→pve-garden.
christianmanivong added 1 commit 2026-09-29 08:37:13 +00:00
_resolve_node() took the first entry of GET /nodes. In a cluster that
lists every member, so a node polled without an explicit `node` driver
argument talked to whichever member came first: pve-dual reported
pve-02's name and VMs, and netOrk's VM sync moved pve-02's VM devices
over to it.

Resolve through GET /cluster/status instead: the entry marked local,
then a match by IP or (short) name, then the sole node of a standalone
host, and otherwise raise rather than guess.

The lookup no longer swallows API errors either. A TLS verification
failure used to leave the IP as the node name, so open() succeeded and
every getter failed quietly while the poll reported success with empty
data. It now surfaces as a ConnectionException from open().

Refs NetOrk/netork#417, NetOrk/netork#418
christianmanivong merged commit 741a26566f into master 2026-09-29 08:44:25 +00:00
christianmanivong deleted branch fix/cluster-node-resolution 2026-09-29 08:44:25 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-proxmox#2