mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Persist pause state to disk to support container live restore
Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
parent
09e1de2080
commit
f4bbfc34ce
2 changed files with 6 additions and 1 deletions
|
@ -210,7 +210,6 @@ func (s *State) SetExitCode(ec int) {
|
||||||
func (s *State) SetRunning(pid int, initial bool) {
|
func (s *State) SetRunning(pid int, initial bool) {
|
||||||
s.error = ""
|
s.error = ""
|
||||||
s.Running = true
|
s.Running = true
|
||||||
s.Paused = false
|
|
||||||
s.Restarting = false
|
s.Restarting = false
|
||||||
s.exitCode = 0
|
s.exitCode = 0
|
||||||
s.Pid = pid
|
s.Pid = pid
|
||||||
|
|
|
@ -99,11 +99,17 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
|
||||||
case libcontainerd.StatePause:
|
case libcontainerd.StatePause:
|
||||||
// Container is already locked in this case
|
// Container is already locked in this case
|
||||||
c.Paused = true
|
c.Paused = true
|
||||||
|
if err := c.ToDisk(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
daemon.updateHealthMonitor(c)
|
daemon.updateHealthMonitor(c)
|
||||||
daemon.LogContainerEvent(c, "pause")
|
daemon.LogContainerEvent(c, "pause")
|
||||||
case libcontainerd.StateResume:
|
case libcontainerd.StateResume:
|
||||||
// Container is already locked in this case
|
// Container is already locked in this case
|
||||||
c.Paused = false
|
c.Paused = false
|
||||||
|
if err := c.ToDisk(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
daemon.updateHealthMonitor(c)
|
daemon.updateHealthMonitor(c)
|
||||||
daemon.LogContainerEvent(c, "unpause")
|
daemon.LogContainerEvent(c, "unpause")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue