Use Libpod tmpdir for pause path

Previously, we always computed pause path from the Rootless
runtime directory. Problem: this does not match the behavior of
Libpod when the directory changes. Libpod will continue to use
the previous directory, cached in the database; Pause pidfiles
will swap to the new path. This is problematic when the directory
needs to exist to write the pidfile, and Libpod is what creates
the directory.

There are two potential solutions - allow the pause pidfile to
move and just make the directory when we want to write it, or use
the cached Libpod paths for a guaranteed location. This patch
does the second, because it seems safer - we will never miss a
previously-existing pidfile because the location is now
consistent.

Fixes #8539

Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
Matthew Heon
2020-12-02 10:05:34 -05:00
parent ce45b71dcf
commit ab88632835
7 changed files with 46 additions and 11 deletions

View File

@ -18,9 +18,9 @@ import (
"github.com/sirupsen/logrus"
)
func stopPauseProcess() error {
func (r *Runtime) stopPauseProcess() error {
if rootless.IsRootless() {
pausePidPath, err := util.GetRootlessPauseProcessPidPath()
pausePidPath, err := util.GetRootlessPauseProcessPidPathGivenDir(r.config.Engine.TmpDir)
if err != nil {
return errors.Wrapf(err, "could not get pause process pid file path")
}
@ -98,5 +98,5 @@ func (r *Runtime) migrate(ctx context.Context) error {
}
}
return stopPauseProcess()
return r.stopPauseProcess()
}