Two declared contracts for netOrk's graph workflows, which switch a hypervisor off when CI has nothing for it (NetOrk/netork#1636, epic NetOrk/netork#1633).
Changes
HostShutdownMixin.shutdown_host() (host_shutdown.py), mixed into DeviceTypeDriver like HostRebootMixin. The device shuts itself down cleanly through its own means. It is declared under TYPE_CHECKING, so hasattr tells a caller whether a driver can. There is no forced variant: cutting the power is the BMC's business.
VmStopRequestMixin.begin_stop_vm(name) (vm_stop_request.py) asks for a VM's clean shutdown and returns at once. stop_vm blocks within a driver's own limit (120 s in napalm-proxmox), while a guest with down=300 may take longer. A caller with timer-based waits asks with this and reads get_vm_status. No role base carries it, so VMware owes nothing.
README and CHANGELOG (Unreleased).
Testing
tests/test_host_shutdown.py and tests/test_vm_stop_request.py: declared, not implemented; documented; on the right bases.
Full suite: 861 passed. Coverage 95 %, the new modules 100 %. ruff, format and mypy --strict are clean.
One change outside the new code: the type: ignore[misc] on DeviceTypeDriver moved to the NetworkDriver base, because the class header now spans lines.
## Summary
Two declared contracts for netOrk's graph workflows, which switch a hypervisor off when CI has nothing for it (NetOrk/netork#1636, epic NetOrk/netork#1633).
## Changes
- `HostShutdownMixin.shutdown_host()` (`host_shutdown.py`), mixed into `DeviceTypeDriver` like `HostRebootMixin`. The device shuts itself down cleanly through its own means. It is declared under `TYPE_CHECKING`, so `hasattr` tells a caller whether a driver can. There is no forced variant: cutting the power is the BMC's business.
- `VmStopRequestMixin.begin_stop_vm(name)` (`vm_stop_request.py`) asks for a VM's clean shutdown and returns at once. `stop_vm` blocks within a driver's own limit (120 s in napalm-proxmox), while a guest with `down=300` may take longer. A caller with timer-based waits asks with this and reads `get_vm_status`. No role base carries it, so VMware owes nothing.
- README and CHANGELOG (Unreleased).
## Testing
- `tests/test_host_shutdown.py` and `tests/test_vm_stop_request.py`: declared, not implemented; documented; on the right bases.
- Full suite: 861 passed. Coverage 95 %, the new modules 100 %. ruff, format and `mypy --strict` are clean.
- One change outside the new code: the `type: ignore[misc]` on `DeviceTypeDriver` moved to the `NetworkDriver` base, because the class header now spans lines.
HostShutdownMixin.shutdown_host(), on DeviceTypeDriver: a device shuts
itself down cleanly through its own means; declared, so hasattr says
whether a driver can. There is no forced variant.
VmStopRequestMixin.begin_stop_vm(name): ask for a VM's clean shutdown
and return at once, for a caller that waits on a timer and reads
get_vm_status instead of blocking in stop_vm. No role demands it.
For netOrk's graph workflows, which switch a hypervisor off when CI has
nothing for it (NetOrk/netork#1636).
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
Two declared contracts for netOrk's graph workflows, which switch a hypervisor off when CI has nothing for it (NetOrk/netork#1636, epic NetOrk/netork#1633).
Changes
HostShutdownMixin.shutdown_host()(host_shutdown.py), mixed intoDeviceTypeDriverlikeHostRebootMixin. The device shuts itself down cleanly through its own means. It is declared underTYPE_CHECKING, sohasattrtells a caller whether a driver can. There is no forced variant: cutting the power is the BMC's business.VmStopRequestMixin.begin_stop_vm(name)(vm_stop_request.py) asks for a VM's clean shutdown and returns at once.stop_vmblocks within a driver's own limit (120 s in napalm-proxmox), while a guest withdown=300may take longer. A caller with timer-based waits asks with this and readsget_vm_status. No role base carries it, so VMware owes nothing.Testing
tests/test_host_shutdown.pyandtests/test_vm_stop_request.py: declared, not implemented; documented; on the right bases.mypy --strictare clean.type: ignore[misc]onDeviceTypeDrivermoved to theNetworkDriverbase, because the class header now spans lines.