1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

Merge pull request #25872 from coolljt0725/fix_25870

Persist pause state to disk to support container live restore
Upstream-commit: 374caa98d8a1aac01478c1d9b69f9cf13874f1b3
Component: engine
This commit is contained in:
Brian Goff
2016-08-22 12:18:01 -04:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -210,7 +210,6 @@ func (s *State) SetExitCode(ec int) {
func (s *State) SetRunning(pid int, initial bool) {
s.error = ""
s.Running = true
s.Paused = false
s.Restarting = false
s.exitCode = 0
s.Pid = pid

View File

@@ -99,11 +99,17 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
case libcontainerd.StatePause:
// Container is already locked in this case
c.Paused = true
if err := c.ToDisk(); err != nil {
return err
}
daemon.updateHealthMonitor(c)
daemon.LogContainerEvent(c, "pause")
case libcontainerd.StateResume:
// Container is already locked in this case
c.Paused = false
if err := c.ToDisk(); err != nil {
return err
}
daemon.updateHealthMonitor(c)
daemon.LogContainerEvent(c, "unpause")
}