feat: get_clusters() and create_vm_from_cloud_init(node=) #68

Merged
christianmanivong merged 2 commits from feat/cluster-inventory into main 2026-11-01 18:41:05 +00:00
Owner

Summary

A hypervisor can now describe its clusters, and a new VM can be placed on a named node. netOrk uses this to keep clusters as objects of their own and to place new VMs itself (NetOrk/netork#1820).

Changes

  • HypervisorDriver.get_clusters() -> list[ClusterDict] (declared only), with ClusterDict, ClusterNodeDict, ClusterStorageDict, ClusterNetworkDict: nodes with state, maintenance, CPU (threads, cores, model, flags, usage) and memory; storages and networks with the nodes that see each. A value the platform does not report is None, never a guess. A standalone host is a cluster of one without a name.
  • create_vm_from_cloud_init(..., node=None): the node to create the VM on; a driver that can only create on its own node raises ValueError for another.
  • CHANGELOG entry.

Related Issue

NetOrk/netork#484, NetOrk/netork#1821, NetOrk/netork#1822. Merge first: napalm-proxmox and napalm-vmware build on it (their CI installs device-types from main).

Testing

tests/test_clusters.py (shapes, declared-only, the new keyword); full suite 1038 passed, ruff and mypy clean.

## Summary A hypervisor can now describe its clusters, and a new VM can be placed on a named node. netOrk uses this to keep clusters as objects of their own and to place new VMs itself (NetOrk/netork#1820). ## Changes - `HypervisorDriver.get_clusters() -> list[ClusterDict]` (declared only), with `ClusterDict`, `ClusterNodeDict`, `ClusterStorageDict`, `ClusterNetworkDict`: nodes with state, maintenance, CPU (threads, cores, model, flags, usage) and memory; storages and networks with the nodes that see each. A value the platform does not report is None, never a guess. A standalone host is a cluster of one without a name. - `create_vm_from_cloud_init(..., node=None)`: the node to create the VM on; a driver that can only create on its own node raises ValueError for another. - CHANGELOG entry. ## Related Issue NetOrk/netork#484, NetOrk/netork#1821, NetOrk/netork#1822. Merge first: napalm-proxmox and napalm-vmware build on it (their CI installs device-types from main). ## Testing `tests/test_clusters.py` (shapes, declared-only, the new keyword); full suite 1038 passed, ruff and mypy clean.
christianmanivong added 1 commit 2026-11-01 15:39:12 +00:00
feat: get_clusters() and create_vm_from_cloud_init(node=)
driver / lint (pull_request) Successful in 16s
driver / standard (pull_request) Failing after 19s
driver / types (pull_request) Successful in 1m10s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / test (3.12) (pull_request) Successful in 1m19s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Failing after 2m32s
driver / publish (pull_request) Skipped
00aa5efef0
A hypervisor reports every cluster its connection can see: the cluster's
name and quorum, its nodes (offline ones too, the local one marked) with
CPU and memory, and the storages and networks with the nodes that see
each. A standalone host is a cluster of one without a name; a manager
reports each cluster and standalone host it runs. Declared only, so a
capability check stays truthful.

create_vm_from_cloud_init() takes the node to create the VM on; a driver
that can only create on its own node refuses another.

Refs NetOrk/netork#484, NetOrk/netork#1822
christianmanivong added 1 commit 2026-11-01 16:08:11 +00:00
refactor: the cluster shapes in clusters.py, a shorter provisioning docstring
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Successful in 2m16s
driver / publish (pull_request) Skipped
5b894913e1
models.py is over the file size limit and may not grow, and the declaration
of create_vm_from_cloud_init() may not get longer: the four cluster shapes
move to napalm_device_types/clusters.py (exported from the package as
before), and the docstring says the same in fewer lines.

Refs NetOrk/netork#484
christianmanivong merged commit a809e6c02f into main 2026-11-01 18:41:05 +00:00
christianmanivong deleted branch feat/cluster-inventory 2026-11-01 18:41:05 +00:00
Sign in to join this conversation.