chore(release): 4.42.0 #130

Merged
christianmanivong merged 5 commits from chore/release-4.42.0 into main 2026-11-25 21:13:39 +00:00
3 changed files with 63 additions and 2 deletions
Showing only changes of commit cd47587e80 - Show all commits

No files matched your search

+10
View File
@@ -17,6 +17,16 @@ recorded here; their history is the git log.
`noble-security`), once each new suite's `InRelease` or `Release` is fetched with apt's
downloader; nothing is written where the vendor has none.
- `parse_apt_releases`, `rewrite_release`, `suite_release`, `APT_RELEASES_COMMAND`.
- `HypervisorDriver.resume_vm(name)`: bring a paused or suspended VM back where it stopped,
the counterpart of `suspend_vm` (NetOrk/netork#2658). Optional like every power action;
a driver that can resume some guests but not others refuses the others with
`RuntimeError`.
### Changed
- `HypervisorDriver.get_vms()`: a guest that is not executing is never `"running"`. It is
`"paused"` while its process still holds its memory and `"suspended"` once its state was
saved away (NetOrk/netork#2658). `suspend_vm` names `resume_vm`, not `start_vm`, as the
way back.
## [4.41.0] - 2026-11-17
+30 -2
View File
@@ -71,7 +71,11 @@ class HypervisorDriver(PackageManagementMixin, HealthMetricsMixin, DeviceTypeDri
* name (string) - VM display name
* vmid (string) - hypervisor-internal ID (Proxmox: ``"100"``,
VMware: the instance UUID)
* status (string) - ``"running"``, ``"stopped"``, ``"paused"``, ``"suspended"``
* status (string) - ``"running"``, ``"stopped"``, ``"paused"``, ``"suspended"``.
A guest that is not executing is never ``"running"``: ``"paused"``
while its process still holds its memory (Proxmox's ``qmpstatus``
``paused``), ``"suspended"`` once its state was saved away (VMware's
``suspended``). :meth:`resume_vm` brings either back.
* vcpus (int) - number of virtual CPUs assigned
* memory (int) - configured RAM in megabytes
* cpu_usage (float) - current CPU utilisation 0.0–1.0
@@ -248,7 +252,9 @@ class HypervisorDriver(PackageManagementMixin, HealthMetricsMixin, DeviceTypeDri
def suspend_vm(self, name: str) -> None:
"""
Suspends (pauses) a running virtual machine, preserving its in-memory
state. The VM can be resumed with :meth:`start_vm`.
state. :meth:`get_vms` then reports it ``"paused"`` (its process
still holds the memory) or ``"suspended"`` (its state was saved
away), and :meth:`resume_vm` brings it back.
:param name: VM name or its ``vmid``.
:raises ValueError: If no VM with the given name/ID exists.
@@ -260,6 +266,28 @@ class HypervisorDriver(PackageManagementMixin, HealthMetricsMixin, DeviceTypeDri
"""
...
def resume_vm(self, name: str) -> None:
"""
Resumes a paused or suspended virtual machine where it stopped, the
counterpart of :meth:`suspend_vm`. The method blocks until the
hypervisor took the request.
Optional, like every power action: a driver whose platform cannot
resume a guest does not implement it, and a caller then offers no
resume. A driver that can resume some guests but not others (a
Proxmox container) refuses the others with ``RuntimeError``.
:param name: VM name or its ``vmid``.
:raises ValueError: If no VM with the given name/ID exists.
:raises RuntimeError: If the VM is neither paused nor suspended, or
the platform cannot resume this kind of guest.
Example::
driver.resume_vm("web01")
"""
...
# ------------------------------------------------------------------
# Snapshots
# ------------------------------------------------------------------
+23
View File
@@ -12,6 +12,7 @@ These tests pin the property that prevents a fourth.
from __future__ import annotations
import ast
import inspect
import pytest
@@ -82,6 +83,7 @@ class TestDeclaredMethodsDoNotExistAtRuntime:
(StorageDriver, "get_disks"),
(StorageDriver, "get_volumes"),
(HypervisorDriver, "get_vms"),
(HypervisorDriver, "resume_vm"),
(FirewallDriver, "send_wake_on_lan"),
(SwitchDriver, "set_vlan"),
(AccessPointDriver, "get_wireless_config"),
@@ -101,6 +103,27 @@ class TestDeclaredMethodsDoNotExistAtRuntime:
assert not hasattr(base, method)
class TestHypervisorPowerContract:
"""The power actions a hypervisor driver may implement, as declared."""
@staticmethod
def _declared(module) -> dict[str, list[str]]:
tree = ast.parse(inspect.getsource(module))
methods: dict[str, list[str]] = {}
for node in ast.walk(tree):
if isinstance(node, ast.FunctionDef):
methods[node.name] = [a.arg for a in node.args.args]
return methods
def test_resume_vm_is_declared_beside_suspend_vm(self):
"""A VM netOrk paused must be one it can bring back (NetOrk/netork#2658)."""
from napalm_device_types import hypervisor
declared = self._declared(hypervisor)
assert declared.get("suspend_vm") == ["self", "name"]
assert declared.get("resume_vm") == ["self", "name"]
class TestNoShadowingAcrossRoles:
"""The regression test for the bug class."""