Merge pull request #29643 from tonistiigi/fix-restore-112
Fix liverestore/restartmanager conflict in v1.12
This commit is contained in:
commit
97cd32a6a9
2 changed files with 34 additions and 0 deletions
|
@ -2717,3 +2717,35 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) {
|
|||
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
}
|
||||
|
||||
// #29598
|
||||
func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
||||
c.Assert(s.d.StartWithBusybox("--live-restore"), check.IsNil)
|
||||
|
||||
out, err := s.d.Cmd("run", "-d", "--restart", "always", "busybox", "top")
|
||||
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
||||
id := strings.TrimSpace(out)
|
||||
|
||||
c.Assert(s.d.Restart("--live-restore"), check.IsNil)
|
||||
|
||||
c.Assert(s.d.waitRun(id), check.IsNil)
|
||||
|
||||
pid, err := s.d.Cmd("inspect", "-f", "{{.State.Pid}}", id)
|
||||
c.Assert(err, check.IsNil)
|
||||
pidint, err := strconv.Atoi(strings.TrimSpace(pid))
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(syscall.Kill(pidint, syscall.SIGKILL), check.IsNil)
|
||||
|
||||
// This test is only for v1.12 and only checks that killing of a process
|
||||
// doesn't cause a panic. Actual issue is fixed in v1.13 with a proper test.
|
||||
calls := 0
|
||||
for range time.NewTicker(500 * time.Millisecond).C {
|
||||
out, err := s.d.inspectFilter(id, "json .Id")
|
||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||
calls++
|
||||
if calls >= 10 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,6 +424,7 @@ func (clnt *client) restore(cont *containerd.Container, lastEvent *containerd.Ev
|
|||
|
||||
container := clnt.newContainer(cont.BundlePath, options...)
|
||||
container.systemPid = systemPid(cont)
|
||||
container.attachStdio = attachStdio
|
||||
|
||||
var terminal bool
|
||||
for _, p := range cont.Processes {
|
||||
|
@ -596,6 +597,7 @@ func (clnt *client) Restore(containerID string, attachStdio StdioCallback, optio
|
|||
w := clnt.getOrCreateExitNotifier(containerID)
|
||||
clnt.lock(cont.Id)
|
||||
container := clnt.newContainer(cont.BundlePath)
|
||||
container.attachStdio = attachStdio
|
||||
container.systemPid = systemPid(cont)
|
||||
clnt.appendContainer(container)
|
||||
clnt.unlock(cont.Id)
|
||||
|
|
Loading…
Add table
Reference in a new issue