-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Handling Pausing from freezer state #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -775,6 +775,27 @@ func (c *linuxContainer) updateState(process parentProcess) error { | |
| return json.NewEncoder(f).Encode(state) | ||
| } | ||
|
|
||
| func (c *linuxContainer) checkFreezer() (Status, error) { | ||
| path := c.cgroupManager.GetPaths()["freezer"] | ||
| if _, err := os.Stat(path); err != nil { | ||
| if os.IsNotExist(err) { | ||
| // Freezer subsystem is not available,Application is neither Checkpointed nor Destroyed | ||
| // return the status as Running | ||
| return Running, nil | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems a little weird to have here. Maybe a comment explaining why the status would be running if the error is an IsNotExist error. |
||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you are missing a |
||
| } | ||
| contents, err := ioutil.ReadFile(filepath.Join(path, "freezer.state")) | ||
| if err != nil { | ||
| return 0, newSystemError(err) | ||
| } | ||
| freezerstate := string(contents) | ||
| if strings.TrimSpace(freezerstate) == "FROZEN" { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should check both
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Mon, Sep 07, 2015 at 12:01:35AM -0700, Qiang Huang wrote:
Previous thoughts on model state settings in [1,2,3]. But if we |
||
| return Paused, nil | ||
| } | ||
| return Running, nil | ||
|
|
||
| } | ||
|
|
||
| func (c *linuxContainer) currentStatus() (Status, error) { | ||
| if _, err := os.Stat(filepath.Join(c.root, "checkpoint")); err == nil { | ||
| return Checkpointed, nil | ||
|
|
@@ -789,10 +810,7 @@ func (c *linuxContainer) currentStatus() (Status, error) { | |
| } | ||
| return 0, newSystemError(err) | ||
| } | ||
| if c.config.Cgroups != nil && c.config.Cgroups.Freezer == configs.Frozen { | ||
| return Paused, nil | ||
| } | ||
| return Running, nil | ||
| return c.checkFreezer() | ||
| } | ||
|
|
||
| func (c *linuxContainer) currentState() (*State, error) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commend seems a bit odd to me, isn't
Checkpointedalready checked before this function is called?