mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-26 09:44:46 +01:00
Merge pull request #1530 from devimc/topic/virtcontainers/inheritParentCpuCgroup
virtcontainers: inherit parent's CPU constraint
This commit is contained in:
@@ -266,6 +266,8 @@ func (s *Sandbox) resources() (specs.LinuxResources, error) {
|
||||
}
|
||||
|
||||
func (s *Sandbox) cpuResources() *specs.LinuxCPU {
|
||||
// Use default period and quota if they are not specified.
|
||||
// Container will inherit the constraints from its parent.
|
||||
quota := int64(0)
|
||||
period := uint64(0)
|
||||
shares := uint64(0)
|
||||
@@ -322,13 +324,6 @@ func (s *Sandbox) cpuResources() *specs.LinuxCPU {
|
||||
|
||||
cpu.Cpus = strings.Trim(cpu.Cpus, " \n\t,")
|
||||
|
||||
// use a default constraint for sandboxes without cpu constraints
|
||||
if period == uint64(0) && quota == int64(0) {
|
||||
// set a quota and period equal to the default number of vcpus
|
||||
quota = int64(s.config.HypervisorConfig.NumVCPUs) * 100000
|
||||
period = 100000
|
||||
}
|
||||
|
||||
return validCPUResources(cpu)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user