mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-01 22:50:54 +00:00
The shares-based fallback added for cpuManagerPolicy=static fired whenever the quota-based CPU count was 0, including for BestEffort sandboxes that have no CPU request. Those sandboxes still carry the cgroup-floor shares value (2), so the fallback derived ceil(2/1024)=1 and inflated every such sandbox by one vCPU. For peer-pods (static resource management) this changed the VM sizing to default_vcpus+1, regressing the libvirt instance-type CI checks. Gate the fallback on the quota being explicitly unconstrained (< 0), which is the actual cpuManagerPolicy=static signal, instead of on numCPU == 0. BestEffort sandboxes (quota 0/absent) now correctly contribute 0 vCPUs while the static-policy case still recovers the CPU count from shares. Add unit tests covering the static-policy, rounding, BestEffort, and explicit-quota cases. Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>