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:
1 parent
ad3b5b29a9
commit
cae4859383
5 files changed
+190
-58
No files matched your search
@@ -201,7 +201,7 @@ class TestLoopbackIsNeverTheVmsAddress:
|
||||
mixin = ProxmoxVMProvisionMixin()
|
||||
node = MagicMock()
|
||||
mixin._node_api = MagicMock(return_value=node)
|
||||
node.qemu.return_value.config.get.return_value = {"net0": "virtio,bridge=vmbr0"}
|
||||
node.qemu.return_value.status.current.get.return_value = {"status": "running"}
|
||||
node.qemu.return_value.agent.return_value.get.return_value = {"result": interfaces}
|
||||
with patch("time.sleep"):
|
||||
return mixin.get_vm_status("101", wait_for_ip=True, timeout=30, poll_interval=1)
|
||||
|
||||
Reference in new issue
Block a user