runtime: check for pause pid existence

check that the pause pid exists before trying to move it to a separate
scope.

Closes: https://github.com/containers/podman/issues/12065

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-10-27 09:44:54 +02:00
parent 825889cc7e
commit 6b3b0a17c6
No known key found for this signature in database
GPG key ID: E4730F97F60286ED
2 changed files with 7 additions and 1 deletions

View file

@ -543,7 +543,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
return err
}
if became {
utils.MovePauseProcessToScope(pausePid)
// Check if the pause process was created. If it was created, then
// move it to its own systemd scope.
if _, err = os.Stat(pausePid); err == nil {
utils.MovePauseProcessToScope(pausePid)
}
os.Exit(ret)
}
}

View file

@ -60,6 +60,8 @@ var _ = Describe("podman system reset", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process")))
// If remote then the API service should have exited
// On local tests this is a noop
podmanTest.StartRemoteService()