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

Merged
christianmanivong merged 3 commits from feat/cluster-inventory into main 2026-11-01 19:11:34 +00:00
Owner

Summary

Implements get_clusters() from napalm-device-types for vCenter and ESXi, and create_vm_from_cloud_init(node=) (NetOrk/netork#1820).

Changes

  • parse/clusters.py (pure): vCenter reports each ClusterComputeResource and each standalone compute resource as a cluster of one, id = "<about.instanceUuid>/<moref>"; ESXi reports itself (id = its system UUID). Hosts: state (connected → online, disconnected/notResponding → offline), maintenance, threads, cores, model, memory, CPU usage from quick stats (capped at 1.0, None when not computable); cpu_flags and quorate are None (vSphere gives neither). Datastores with the hosts that mount them (accessible only), port groups with fixed VLAN where readable (uplink port groups left out).
  • paths.CLUSTER and the merged ComputeResource paths in paths.ALL (harvest stays in sync).
  • choose_placement(..., host_name=) raises NodeRefused(ValueError) for an unknown or ineligible host; placement now runs before the image download, so a refused node fails at once (CHANGELOG: Changed). choose_placement split below complexity 10 and dropped from the baseline.

Related Issue

NetOrk/netork#484, NetOrk/netork#1822. Needs NAPALM/napalm-device-types feat/cluster-inventory merged first; raise the device-types floor with its release.

Testing

Parser and placement unit tests; vcsim: 10 passed (get_clusters on vCenter and ESXi, provisioning on a named node and refusing an unknown one). pytest 339 passed, 10 skipped, coverage 97 %; ruff and mypy clean.

## Summary Implements `get_clusters()` from napalm-device-types for vCenter and ESXi, and `create_vm_from_cloud_init(node=)` (NetOrk/netork#1820). ## Changes - `parse/clusters.py` (pure): vCenter reports each ClusterComputeResource and each standalone compute resource as a cluster of one, `id` = `"<about.instanceUuid>/<moref>"`; ESXi reports itself (`id` = its system UUID). Hosts: state (connected → online, disconnected/notResponding → offline), maintenance, threads, cores, model, memory, CPU usage from quick stats (capped at 1.0, None when not computable); `cpu_flags` and `quorate` are None (vSphere gives neither). Datastores with the hosts that mount them (accessible only), port groups with fixed VLAN where readable (uplink port groups left out). - `paths.CLUSTER` and the merged ComputeResource paths in `paths.ALL` (harvest stays in sync). - `choose_placement(..., host_name=)` raises `NodeRefused(ValueError)` for an unknown or ineligible host; placement now runs before the image download, so a refused node fails at once (CHANGELOG: Changed). `choose_placement` split below complexity 10 and dropped from the baseline. ## Related Issue NetOrk/netork#484, NetOrk/netork#1822. Needs NAPALM/napalm-device-types `feat/cluster-inventory` merged first; raise the device-types floor with its release. ## Testing Parser and placement unit tests; vcsim: 10 passed (get_clusters on vCenter and ESXi, provisioning on a named node and refusing an unknown one). pytest 339 passed, 10 skipped, coverage 97 %; ruff and mypy clean.
christianmanivong added 1 commit 2026-11-01 15:39:13 +00:00
feat: get_clusters() and create_vm_from_cloud_init(node=)
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Failing after 1m2s
driver / test (3.12) (pull_request) Failing after 57s
driver / test (3.13) (pull_request) Failing after 52s
driver / lowest (pull_request) Failing after 25s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 57s
CI / driver (pull_request) Failing after 2m21s
driver / publish (pull_request) Skipped
52c802ed41
vCenter reports each cluster compute resource, and each standalone host
it runs as a cluster of one, identified by "<instanceUuid>/<moref>"; an
ESXi host reports itself. Nodes carry state, maintenance, CPU and memory;
datastores and port groups carry the hosts that see them.

create_vm_from_cloud_init(node=) places the VM on that host and refuses
one that does not exist or cannot take it, before anything is created.
Placement now runs before the image download, so a refused host fails at
once instead of after the download.

Refs NetOrk/netork#484, NetOrk/netork#1822
christianmanivong added 1 commit 2026-11-01 16:08:11 +00:00
refactor: import the cluster shapes from the package root
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Failing after 1m12s
driver / test (3.12) (pull_request) Failing after 1m9s
driver / test (3.13) (pull_request) Failing after 58s
driver / lowest (pull_request) Failing after 46s
driver / build (pull_request) Successful in 36s
driver / security (pull_request) Successful in 1m24s
CI / driver (pull_request) Failing after 3m10s
driver / publish (pull_request) Skipped
68194b6164
napalm-device-types keeps them in a module of their own now; the package exports them.

Refs NetOrk/netork#484
christianmanivong added 1 commit 2026-11-01 19:07:03 +00:00
ci: install napalm-device-types from main until the cluster shapes are on PyPI
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m4s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m34s
driver / publish (pull_request) Skipped
881ba7f1db
christianmanivong merged commit 447b17cbeb into main 2026-11-01 19:11:34 +00:00
christianmanivong deleted branch feat/cluster-inventory 2026-11-01 19:11:34 +00:00
Sign in to join this conversation.