Implements the HypervisorDriver VM methods that until now were only declared, so netOrk can drive Proxmox and VMware through the same contract.
Changes
New vm_contract_mixin.py: start_vm, stop_vm(force), reboot_vm(force), suspend_vm, get_vm_config. They take a name or vmid, wait for the Proxmox task, and raise ValueError/RuntimeError. Forced container reboot = stop + start (LXC has no reset); suspending a container is refused.
get_vm_config returns a VMConfigDict (the parsing formerly in netOrk's _parse_proxmox_hw_config).
get_vms() reports vmid as a string ("100"), still sorted numerically.
## Summary
Implements the `HypervisorDriver` VM methods that until now were only declared, so netOrk can drive Proxmox and VMware through the same contract.
## Changes
- New `vm_contract_mixin.py`: `start_vm`, `stop_vm(force)`, `reboot_vm(force)`, `suspend_vm`, `get_vm_config`. They take a name or vmid, wait for the Proxmox task, and raise `ValueError`/`RuntimeError`. Forced container reboot = stop + start (LXC has no reset); suspending a container is refused.
- `get_vm_config` returns a `VMConfigDict` (the parsing formerly in netOrk's `_parse_proxmox_hw_config`).
- `get_vms()` reports `vmid` as a string (`"100"`), still sorted numerically.
- `power_vm` unchanged.
- Requires `napalm_device_types>=2.0.0`.
## Related
Needs NAPALM/napalm-device-types#1. Consumed by netOrk `feature/vmware-driver`.
## Testing
`pytest`: 223 passed (27 new in `tests/test_vm_contract.py`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
start_vm, stop_vm, reboot_vm, suspend_vm and get_vm_config existed only
as declarations. netOrk called Proxmox's own power_vm and read a VM's
raw config through _node_api(), so no other hypervisor could serve the
same endpoints. These let netOrk talk to every hypervisor alike.
The power methods accept a VM's name or vmid, wait for the Proxmox task,
and raise ValueError/RuntimeError as the contract says instead of
returning a result dict. A forced reboot of a container is stop + start,
since LXC has no reset; suspending a container is refused. power_vm is
unchanged for existing callers.
get_vm_config moves the config parsing netOrk did in
_parse_proxmox_hw_config into the driver and returns a VMConfigDict:
disks with storage and size, NICs with model, MAC, bridge and VLAN, CPU
topology, firmware, machine type and PCI/USB passthrough.
get_vms reports vmid as a string ("100"), following
napalm-device-types 2.0, still ordered numerically.
get_vm_snapshots, create_vm_snapshot, delete_vm_snapshot and
rollback_vm_snapshot for VMs and containers, so netOrk's snapshot view
works on Proxmox as it does on VMware. Proxmox lists the live state as a
pseudo-snapshot named "current"; it is never reported or addressable.
Containers have no RAM state, so include_memory is ignored for them.
reboot_host() restarts the node with POST /nodes/{node}/status
command=reboot instead of /sbin/reboot over SSH.
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
Implements the
HypervisorDriverVM methods that until now were only declared, so netOrk can drive Proxmox and VMware through the same contract.Changes
vm_contract_mixin.py:start_vm,stop_vm(force),reboot_vm(force),suspend_vm,get_vm_config. They take a name or vmid, wait for the Proxmox task, and raiseValueError/RuntimeError. Forced container reboot = stop + start (LXC has no reset); suspending a container is refused.get_vm_configreturns aVMConfigDict(the parsing formerly in netOrk's_parse_proxmox_hw_config).get_vms()reportsvmidas a string ("100"), still sorted numerically.power_vmunchanged.napalm_device_types>=2.0.0.Related
Needs NAPALM/napalm-device-types#1. Consumed by netOrk
feature/vmware-driver.Testing
pytest: 223 passed (27 new intests/test_vm_contract.py).🤖 Generated with Claude Code
start_vm, stop_vm, reboot_vm, suspend_vm and get_vm_config existed only as declarations. netOrk called Proxmox's own power_vm and read a VM's raw config through _node_api(), so no other hypervisor could serve the same endpoints. These let netOrk talk to every hypervisor alike. The power methods accept a VM's name or vmid, wait for the Proxmox task, and raise ValueError/RuntimeError as the contract says instead of returning a result dict. A forced reboot of a container is stop + start, since LXC has no reset; suspending a container is refused. power_vm is unchanged for existing callers. get_vm_config moves the config parsing netOrk did in _parse_proxmox_hw_config into the driver and returns a VMConfigDict: disks with storage and size, NICs with model, MAC, bridge and VLAN, CPU topology, firmware, machine type and PCI/USB passthrough. get_vms reports vmid as a string ("100"), following napalm-device-types 2.0, still ordered numerically.get_vm_snapshots, create_vm_snapshot, delete_vm_snapshot and rollback_vm_snapshot for VMs and containers, so netOrk's snapshot view works on Proxmox as it does on VMware. Proxmox lists the live state as a pseudo-snapshot named "current"; it is never reported or addressable. Containers have no RAM state, so include_memory is ignored for them. reboot_host() restarts the node with POST /nodes/{node}/status command=reboot instead of /sbin/reboot over SSH.