diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-07-09 18:42:35 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-07-10 10:54:36 +0200 |
commit | b0c2bb996276a706585d1a3eebcaa0b687715b5a (patch) | |
tree | ff42b12fb448ad05e1381bb1f7bc38106dadc29a /pkg/cgroups | |
parent | bbe03e61a375416180432fbd9d00d23a7c2a4714 (diff) | |
download | podman-b0c2bb996276a706585d1a3eebcaa0b687715b5a.tar.gz podman-b0c2bb996276a706585d1a3eebcaa0b687715b5a.tar.bz2 podman-b0c2bb996276a706585d1a3eebcaa0b687715b5a.zip |
cgroups: skip not existing cpuacct files
if the cpuacct file doesn't exist, ignore it instead of erroring out.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1728242
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/cgroups')
-rw-r--r-- | pkg/cgroups/cpu.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pkg/cgroups/cpu.go b/pkg/cgroups/cpu.go index c9325946b..1c8610cc4 100644 --- a/pkg/cgroups/cpu.go +++ b/pkg/cgroups/cpu.go @@ -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} |