diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-10 14:50:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-10 14:50:04 +0200 |
commit | cef566306c9132c610cdd028f7e5035433c12798 (patch) | |
tree | ff42b12fb448ad05e1381bb1f7bc38106dadc29a /pkg/cgroups/cpu.go | |
parent | 551edd287e7cb31327d18c3ebc0d2e6b1160c235 (diff) | |
parent | b0c2bb996276a706585d1a3eebcaa0b687715b5a (diff) | |
download | podman-cef566306c9132c610cdd028f7e5035433c12798.tar.gz podman-cef566306c9132c610cdd028f7e5035433c12798.tar.bz2 podman-cef566306c9132c610cdd028f7e5035433c12798.zip |
Merge pull request #3506 from giuseppe/cgroup2-improvements
cgroups: support creating cgroupsv2 paths
Diffstat (limited to 'pkg/cgroups/cpu.go')
-rw-r--r-- | pkg/cgroups/cpu.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pkg/cgroups/cpu.go b/pkg/cgroups/cpu.go index 8640d490e..1c8610cc4 100644 --- a/pkg/cgroups/cpu.go +++ b/pkg/cgroups/cpu.go @@ -61,7 +61,7 @@ func (c *cpuHandler) Apply(ctr *CgroupControl, res *spec.LinuxResources) error { // Create the cgroup func (c *cpuHandler) Create(ctr *CgroupControl) (bool, error) { if ctr.cgroup2 { - return false, fmt.Errorf("cpu create not implemented for cgroup v2") + return false, nil } return ctr.createCgroupDirectory(CPU) } @@ -98,15 +98,24 @@ func (c *cpuHandler) Stat(ctr *CgroupControl, m *Metrics) error { } else { usage.Total, err = readAcct(ctr, "cpuacct.usage") if err != nil { - return err + if !os.IsNotExist(errors.Cause(err)) { + return err + } + usage.Total = 0 } usage.Kernel, err = readAcct(ctr, "cpuacct.usage_sys") if err != nil { - return err + if !os.IsNotExist(errors.Cause(err)) { + return err + } + usage.Kernel = 0 } usage.PerCPU, err = readAcctList(ctr, "cpuacct.usage_percpu") if err != nil { - return err + if !os.IsNotExist(errors.Cause(err)) { + return err + } + usage.PerCPU = nil } } m.CPU = CPUMetrics{Usage: usage} |