src/util/vircgroupv2.c: interpret neg quota as "max"

Because of kernel doesn't allow passing negative values to
cpu.max as quota, it's needing to convert negative values to "max" token.

Signed-off-by: Anton Fadeev <anton.fadeev@red-soft.ru>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
antonios-f 2022-11-17 09:53:23 +00:00 committed by Pavel Hrdina
parent f41d1a2e75
commit 9233f0fa8c

View File

@ -1611,7 +1611,7 @@ virCgroupV2SetCpuCfsQuota(virCgroup *group,
return -1;
}
if (cfs_quota == VIR_CGROUP_CPU_QUOTA_MAX) {
if (cfs_quota < 0 || cfs_quota == VIR_CGROUP_CPU_QUOTA_MAX) {
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPU,
"cpu.max", "max");