hot plug cpu in proxmox for linux vm

lethargos

Well-Known Member
Jun 10, 2017
134
6
58
74
Hello,

I know this has been talked about on this forum alreadyit , but I haven't been able to solve it with the provided solutions.

I'm using Ubuntu 20.04 on Proxmox 6.4-13 and I'm trying to add live several cpu cores.
I've added the udev rule documented here (https://pve.proxmox.com/wiki/Hotplug_(qemu_disk,nic,cpu,memory)), shut the VM and started it again, but it still doesn't work. Memory has worked without any issues from the very beginning, and I don't need any additional rules for that.
This is what the rule looks like:
Code:
cat /lib/udev/rules.d/80-hotplug-cpu.rules
SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"

When I add the cpu, proxmox expects me to shut down the VM, because it adds another yellow field in the CPU section, under the actual values. So it doesn't seem to be reading the udev rule at all.
Hotplug for CPU and Numa are activated.

Any ideas are greatly appreciated.
 
Hi,

You need to use the vpcu setting to change how many cores are online, set the value for cores and sockets to the maximum you want to use.
I've used this on my system without issue (recent openSUSE Tumbleweed vm) without changing udev rules.
The current pve admin documentation has the most current info on this I believe:
From https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings

vCPU hot-plug​

Modern operating systems introduced the capability to hot-plug and, to a certain extent, hot-unplug CPUs in a running system. Virtualization allows us to avoid a lot of the (physical) problems real hardware can cause in such scenarios. Still, this is a rather new and complicated feature, so its use should be restricted to cases where its absolutely needed. Most of the functionality can be replicated with other, well tested and less complicated, features, see Resource Limits.
In Proxmox VE the maximal number of plugged CPUs is always cores * sockets. To start a VM with less than this total core count of CPUs you may use the vpus setting, it denotes how many vCPUs should be plugged in at VM start.
Currently only this feature is only supported on Linux, a kernel newer than 3.10 is needed, a kernel newer than 4.7 is recommended.
You can use a udev rule as follow to automatically set new CPUs as online in the guest:
SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
Save this under /etc/udev/rules.d/ as a file ending in .rules.
Note: CPU hot-remove is machine dependent and requires guest cooperation. The deletion command does not guarantee CPU removal to actually happen, typically it’s a request forwarded to guest using target dependent mechanism, e.g., ACPI on x86/amd64.
 
Hi,

You need to use the vpcu setting to change how many cores are online, set the value for cores and sockets to the maximum you want to use.
I've used this on my system without issue (recent openSUSE Tumbleweed vm) without changing udev rules.
The current pve admin documentation has the most current info on this I believe:
From https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings

So basically I should add a maximum number of cores at the very beginning and limit this through the vCPUs, if I understand correctly?
This is a little bit annoying, to be honest, because I have an additional limit I have to look out for, but as long as there's no performance issue by assigning unused cores, I suppose that's ok.
I wonder how vmware does it. This doesn't come into question.

In any case, thanks for the reply.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!