Skip to content

Commit 86c1d6f

Browse files
committed
Handling Pausing from freezer state
Signed-off-by: Rajasekaran <[email protected]> freezer status Signed-off-by: Rajasekaran <[email protected]>
1 parent e7663a6 commit 86c1d6f

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

libcontainer/container_linux.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,23 @@ func (c *linuxContainer) updateState(process parentProcess) error {
767767
return json.NewEncoder(f).Encode(state)
768768
}
769769

770+
func (c *linuxContainer) checkFreezer() (Status, error) {
771+
path := c.cgroupManager.GetPaths()["freezer"]
772+
_, err := os.Stat(path)
773+
if err != nil {
774+
return Running, err
775+
}
776+
contents, err := ioutil.ReadFile(filepath.Join(path, "freezer.state"))
777+
if err != nil {
778+
return 0, newSystemError(err)
779+
}
780+
freezerstate := string(contents)
781+
if strings.TrimSpace(freezerstate) == "FROZEN" {
782+
return Paused, nil
783+
}
784+
return Running, nil
785+
}
786+
770787
func (c *linuxContainer) currentStatus() (Status, error) {
771788
if _, err := os.Stat(filepath.Join(c.root, "checkpoint")); err == nil {
772789
return Checkpointed, nil
@@ -781,7 +798,13 @@ func (c *linuxContainer) currentStatus() (Status, error) {
781798
}
782799
return 0, newSystemError(err)
783800
}
784-
if c.config.Cgroups != nil && c.config.Cgroups.Freezer == configs.Frozen {
801+
status, err := c.checkFreezer()
802+
if err != nil {
803+
if os.IsNotExist(err) {
804+
return Running, nil
805+
}
806+
}
807+
if status == Paused {
785808
return Paused, nil
786809
}
787810
return Running, nil

0 commit comments

Comments
 (0)