Skip to content

Commit 48dd4af

Browse files
committed
Handling Pausing from freezer state
Signed-off-by: Rajasekaran <[email protected]>
1 parent 90e6d37 commit 48dd4af

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libcontainer/container_linux.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,17 @@ func (c *linuxContainer) currentStatus() (Status, error) {
781781
}
782782
return 0, newSystemError(err)
783783
}
784-
if c.config.Cgroups != nil && c.config.Cgroups.Freezer == configs.Frozen {
785-
return Paused, nil
784+
path := c.cgroupManager.GetPaths()["freezer"]
785+
// Read file only if freezer subsystem exists, in some of the local unit test freezer subsystem is not passed in container creation
786+
if path != "" {
787+
contents, err := ioutil.ReadFile(filepath.Join(path, "freezer.state"))
788+
if err != nil {
789+
return 0, newSystemError(err)
790+
}
791+
freezerstate := string(contents)
792+
if strings.TrimSpace(freezerstate) == "FROZEN" {
793+
return Paused, nil
794+
}
786795
}
787796
return Running, nil
788797
}

0 commit comments

Comments
 (0)