[GH-ISSUE #147] Can't get vm lock status #75

Closed
opened 2026-02-27 15:46:18 +03:00 by kerem · 1 comment
Owner

Originally created by @SuicidalToaster on GitHub (Oct 16, 2023).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/147

I wrote a bunch of variations trying to get quemu lock status and can't pin down this. I managed to get all subdirs of a vm but never the state of said vm. For instance we have a readme example:

for vm in proxmox.nodes('node').qemu.get():      
print(f"{vm['vmid']}. {vm['name']} => {vm['status']}") 

is working but

for vm in proxmox.nodes('node').qemu.get():            
    print(f"{vm['vmid']}. {vm['name']} => {vm['lock']}") 

is not

What am I doing wrong?

Python 3.11
Proxmox 8.0.4

Originally created by @SuicidalToaster on GitHub (Oct 16, 2023). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/147 I wrote a bunch of variations trying to get quemu lock status and can't pin down this. I managed to get all subdirs of a vm but never the state of said vm. For instance we have a readme example: ``` for vm in proxmox.nodes('node').qemu.get(): print(f"{vm['vmid']}. {vm['name']} => {vm['status']}") ``` is working but ``` for vm in proxmox.nodes('node').qemu.get(): print(f"{vm['vmid']}. {vm['name']} => {vm['lock']}") ``` is not What am I doing wrong? Python 3.11 Proxmox 8.0.4
kerem closed this issue 2026-02-27 15:46:18 +03:00
Author
Owner

@SuicidalToaster commented on GitHub (Oct 17, 2023):

Turns out when vm is not locked, vm['lock'] will always throw an error unless it is in any kind of lock state. For example let's take 2 machines: locked VM1 and unlocked VM2

vmStatus = proxmox.nodes('node').qemu('VM1').status.current.get()
print(vmStatus["lock"])

//returns "snapshot" lock status


vmStatus = proxmox.nodes('node').qemu('VM2').status.current.get()
print(vmStatus["lock"])

//throws KeyError: 'lock'
<!-- gh-comment-id:1765780981 --> @SuicidalToaster commented on GitHub (Oct 17, 2023): Turns out when vm is not locked, vm['lock'] will always throw an error unless it is in any kind of lock state. For example let's take 2 machines: locked VM1 and unlocked VM2 ``` vmStatus = proxmox.nodes('node').qemu('VM1').status.current.get() print(vmStatus["lock"]) //returns "snapshot" lock status vmStatus = proxmox.nodes('node').qemu('VM2').status.current.get() print(vmStatus["lock"]) //throws KeyError: 'lock' ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#75
No description provided.