[GH-ISSUE #360] CPULimit of ConfigLxc should be of type float, not int. #88

Open
opened 2026-02-28 00:40:31 +03:00 by kerem · 3 comments
Owner

Originally created by @Sonlis on GitHub (Aug 29, 2024).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/360

As the (documentation)[https://proxmox.bastincloud.local:8006/pve-docs/chapter-pct.html#pct_cpu] states, cpulimit can be a floating number:

cpulimit: You can use this option to further limit assigned CPU time. Please note that this is a floating point number, so it is perfectly valid to assign two cores to a container, but restrict overall CPU consumption to half a core.

Because the field CPULimit here: github.com/Telmate/proxmox-api-go@0d787afdba/proxmox/config_lxc.go (L21) is of type int, the user cannot input a floating point number.

Originally created by @Sonlis on GitHub (Aug 29, 2024). Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/360 As the (documentation)[https://proxmox.bastincloud.local:8006/pve-docs/chapter-pct.html#pct_cpu] states, `cpulimit` can be a floating number: ``` cpulimit: You can use this option to further limit assigned CPU time. Please note that this is a floating point number, so it is perfectly valid to assign two cores to a container, but restrict overall CPU consumption to half a core. ``` Because the field `CPULimit` here: https://github.com/Telmate/proxmox-api-go/blob/0d787afdba05eca42a3f09d71e66e9f0141a0f02/proxmox/config_lxc.go#L21 is of type int, the user cannot input a floating point number.
Author
Owner

@Tinyblargon commented on GitHub (Aug 30, 2024):

Currently a rework of LXC is ongoing #336, If this is an issue you need fixed please create a pull request, as my efforts are needing for the rewrite (this rewrite will take a long time).

<!-- gh-comment-id:2320193839 --> @Tinyblargon commented on GitHub (Aug 30, 2024): Currently a rework of LXC is ongoing #336, If this is an issue you need fixed please create a pull request, as my efforts are needing for the rewrite (this rewrite will take a long time).
Author
Owner

@Tchoupinax commented on GitHub (Dec 8, 2025):

Hello,

I am looking into the same question for Qemu VMs. Using the SDK, we can only provide an integer from 0 to 128, while the Proxmox API expects a floating-point value where 1.0 means 100%.

Could you confirm whether setting limit = 2 with the SDK really means 200% for Proxmox?

<!-- gh-comment-id:3626549038 --> @Tchoupinax commented on GitHub (Dec 8, 2025): Hello, I am looking into the same question for Qemu VMs. Using the SDK, we can only provide an integer from 0 to 128, while the Proxmox API expects a floating-point value [where 1.0 means 100%](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_cpu_resource_limits). Could you confirm whether setting `limit = 2` with the SDK really means `200%` for Proxmox?
Author
Owner

@Tinyblargon commented on GitHub (Dec 8, 2025):

For LXC this issue has been fixed and is implemented at:
github.com/Telmate/proxmox-api-go@81c14ce502/proxmox/config__lxc__cpu.go (L131-L132)

For Qemu this has been implemented incorrectly as it is implemented as an int instead of a float.

@Tchoupinax for Qemu limit = 2 does indeed mean 200%

The GUI only allows 2 digits of precision. Maybe we should implement this as a percentage directly so 100 means 100% in PVE.

<!-- gh-comment-id:3626636879 --> @Tinyblargon commented on GitHub (Dec 8, 2025): For LXC this issue has been fixed and is implemented at: https://github.com/Telmate/proxmox-api-go/blob/81c14ce502d86ccf7e905ee35e9a705eb2874d35/proxmox/config__lxc__cpu.go#L131-L132 For Qemu this has been implemented incorrectly as it is implemented as an int instead of a float. @Tchoupinax for Qemu `limit = 2` does indeed mean `200%` The GUI only allows 2 digits of precision. Maybe we should implement this as a percentage directly so `100` means `100%` in PVE.
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/proxmox-api-go#88
No description provided.