fix(vm): get_vm_status reads status/current (NetOrk/netork#2696)

get_vm_status answered "running" for every VM whose config could be read
and never asked Proxmox for the VM's state, so a caller waiting for a clean
shutdown never saw the VM stop. It now reads status/current and maps it with
qemu_status, the mapping get_vms() uses: running, stopped, or paused for a
qmpstatus of paused or suspended. The guest agent is asked for an address
only while the VM runs; wait_for_ip ends at once with a RuntimeError when the
VM is stopped or paused.

Closes #72
This commit is contained in:
Christian Manivong committed 2026-11-26 00:21:40 +01:00
1 parent ad3b5b29a9
commit cae4859383
5 files changed
+190 -58

No files matched your search

+10
View File
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- `get_vm_status(vmid)` reports the VM's real state (#72): it reads
`GET /nodes/{node}/qemu/{vmid}/status/current` and answers `running`, `stopped`, or
`paused` for a `qmpstatus` of paused or suspended, the same as `get_vms()`. It used to say
`running` for every VM whose config could be read, so a caller waiting for a clean shutdown
never saw the VM stop (NetOrk/netork's workflow step "Shut down Proxmox VM" always ran into
its timeout). The guest agent is asked for an address only while the VM runs, and
`wait_for_ip=True` ends with a `RuntimeError` at once when the VM is stopped or paused,
rather than waiting out its timeout for an address that cannot come.
## [0.11.0] - 2026-11-25
### Added