Cannot set vCPU quota to -1 on newer kernels
Software environment
- Operating system: CentOS 9 Stream
- Architecture: x86_64
- kernel version: kernel-5.14.0-105.el9.x86_64
- libvirt version: libvirt-daemon-8.3.0-1.el9.x86_64
- Hypervisor and version: qemu-kvm-core-7.0.0-4.el9.x86_64
Description of problem
On recent kernels it is not possible to set vCPU quota to -1
. Libvirt fails with:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/vdsm/virt/vm.py", line 5572, in setCpuTuneQuota
self._dom.setSchedulerParameters({'vcpu_quota': int(quota)})
File "/usr/lib/python3.9/site-packages/vdsm/virt/virdomain.py", line 121, in f
ret = attr(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/vdsm/common/libvirtconnection.py", line 131, in wrapper
ret = f(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/vdsm/common/function.py", line 94, in wrapper
return func(inst, *args, **kwargs)
File "/usr/lib64/python3.9/site-packages/libvirt.py", line 2818, in setSchedulerParameters
raise libvirtError('virDomainSetSchedulerParameters() failed')
libvirt.libvirtError: Invalid value '-1' for 'cpu.max': Invalid argument
This seems to be caused by some change in cgroups v2 which does not consider negative value as valid anymore:
# echo -1 > cpu.max
-bash: echo: write error: Invalid argument
But this is also a libvirt problem because documentation clearly says:
A domain with quota as any negative value indicates that the domain has
infinite bandwidth for vCPU threads, which means that it is not bandwidth
controlled.