feat(vm): resume a paused VM, and list it as paused (NetOrk/netork#2658)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 2m43s
driver / publish (pull_request) Skipped

suspend_vm paused a QEMU guest that nothing could bring back: start is
refused because PVE still says the guest is running. resume_vm posts
status/resume for a paused VM and refuses a container or a guest that is
not paused. get_vms() asks for the full status and reports a guest whose
qmpstatus is paused or suspended as paused, not running.
This commit is contained in:
Christian Manivong committed 2026-11-25 21:28:46 +01:00
1 parent 449230c624
commit 93c974b8f0
4 files changed
+109 -4

No files matched your search

+21
View File
@@ -19,6 +19,8 @@ from napalm_device_types.models import (
VMPassthroughDict,
)
from napalm_proxmox.vm_mixin import qemu_status
_JsonDict = dict[str, Any]
_POWER_TIMEOUT = 120
@@ -188,6 +190,25 @@ class ProxmoxVMContractMixin:
raise RuntimeError(f"Proxmox cannot suspend container {vmid}")
self._run_power(vmid, vm_type, "suspend")
def resume_vm(self, name: str) -> None:
"""``status/resume`` for a paused QEMU guest (NetOrk/netork#2658).
A container is refused: this driver does not suspend one, PVE's container
suspend is experimental (CRIU), and its listing does not tell a suspended
container from another. A guest that is not paused is refused too: PVE would
answer a running one with success and do nothing.
"""
vmid, vm_type = self._resolve_vm(name)
if vm_type != "vm":
raise RuntimeError(
f"Proxmox cannot resume container {vmid}: only a paused VM can be resumed"
)
current = self._guest_api(vmid, vm_type).status.current.get() or {}
state = qemu_status(current)
if state != "paused":
raise RuntimeError(f"Cannot resume VM {vmid}: it is not paused ({state})")
self._run_power(vmid, vm_type, "resume")
def get_vm_config(self, name: str) -> VMConfigDict:
vmid, vm_type = self._resolve_vm(name)
cfg = self._guest_api(vmid, vm_type).config.get() or {}