Skip to content

Commit

Permalink
Merge pull request #2282 from kolyshkin/cgroupv2-getpaths
Browse files Browse the repository at this point in the history
libct/isPaused: don't use GetPaths from v2 code
  • Loading branch information
Mrunal Patel authored Apr 2, 2020
2 parents 9ec5b03 + 8d7977e commit 22a2c9a
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1822,14 +1822,23 @@ func (c *linuxContainer) runType() Status {
}

func (c *linuxContainer) isPaused() (bool, error) {
fcg := c.cgroupManager.GetPaths()["freezer"]
if fcg == "" {
// A container doesn't have a freezer cgroup
return false, nil
}
pausedState := "FROZEN"
filename := "freezer.state"
if cgroups.IsCgroup2UnifiedMode() {
var fcg, filename, pausedState string

if !cgroups.IsCgroup2UnifiedMode() {
fcg = c.cgroupManager.GetPaths()["freezer"]
if fcg == "" {
// A container doesn't have a freezer cgroup
return false, nil
}
filename = "freezer.state"
pausedState = "FROZEN"
} else {
var err error
fcg, err = c.cgroupManager.GetUnifiedPath()
if err != nil {
// should not happen
return false, err
}
filename = "cgroup.freeze"
pausedState = "1"
}
Expand Down

0 comments on commit 22a2c9a

Please sign in to comment.