Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers/sandbox: calculate container's CPU from sandbox.contai…
Browse files Browse the repository at this point in the history
…ners

sandbox.config.Containers is not up to date, so use container.config directly

Fixes: #2129

Signed-off-by: Wang Liang <wangliangzz@inspur.com>
  • Loading branch information
Wang Liang committed Oct 11, 2019
1 parent c7b4c5e commit a597de9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -1873,8 +1873,8 @@ func (s *Sandbox) calculateSandboxMemory() int64 {
func (s *Sandbox) calculateSandboxCPUs() uint32 {
mCPU := uint32(0)

for _, c := range s.config.Containers {
if cpu := c.Resources.CPU; cpu != nil {
for _, c := range s.containers {
if cpu := c.config.Resources.CPU; cpu != nil {
if cpu.Period != nil && cpu.Quota != nil {
mCPU += utils.CalculateMilliCPUs(*cpu.Quota, *cpu.Period)
}
Expand Down

0 comments on commit a597de9

Please sign in to comment.