mirror of
https://github.com/containers/podman.git
synced 2025-11-15 02:29:16 +08:00
vendor c/common
Also update the e2e pull test to account for the changes when pulling from the dir transport. Images pulled via the dir transport are not tagged anymore; the path is not a reliable source. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
24
vendor/github.com/containers/common/pkg/cgroups/memory.go
generated
vendored
24
vendor/github.com/containers/common/pkg/cgroups/memory.go
generated
vendored
@@ -7,8 +7,7 @@ import (
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
type memHandler struct {
|
||||
}
|
||||
type memHandler struct{}
|
||||
|
||||
func getMemoryHandler() *memHandler {
|
||||
return &memHandler{}
|
||||
@@ -41,22 +40,23 @@ func (c *memHandler) Stat(ctr *CgroupControl, m *Metrics) error {
|
||||
usage := MemoryUsage{}
|
||||
|
||||
var memoryRoot string
|
||||
filenames := map[string]string{}
|
||||
var limitFilename string
|
||||
|
||||
if ctr.cgroup2 {
|
||||
memoryRoot = filepath.Join(cgroupRoot, ctr.path)
|
||||
filenames["usage"] = "memory.current"
|
||||
filenames["limit"] = "memory.max"
|
||||
limitFilename = "memory.max"
|
||||
if usage.Usage, err = readFileByKeyAsUint64(filepath.Join(memoryRoot, "memory.stat"), "anon"); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
memoryRoot = ctr.getCgroupv1Path(Memory)
|
||||
filenames["usage"] = "memory.usage_in_bytes"
|
||||
filenames["limit"] = "memory.limit_in_bytes"
|
||||
limitFilename = "memory.limit_in_bytes"
|
||||
if usage.Usage, err = readFileAsUint64(filepath.Join(memoryRoot, "memory.usage_in_bytes")); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
usage.Usage, err = readFileAsUint64(filepath.Join(memoryRoot, filenames["usage"]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
usage.Limit, err = readFileAsUint64(filepath.Join(memoryRoot, filenames["limit"]))
|
||||
|
||||
usage.Limit, err = readFileAsUint64(filepath.Join(memoryRoot, limitFilename))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user