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.
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.
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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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), withClusterDict,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.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.