mirror of https://github.com/containers/podman.git
Fix up ConmonPidFile after restore
After restoring a container with a different name (ID) the ConmonPidFile was still pointing to the path of the original container. This means that the last restored container will overwrite the ConmonPidFile of the original container. It was also not possible to restore a container with a new name (ID) if the original container was not running. The ConmonPidFile is only changed if the ConmonPidFile starts with the value of RunRoot. This assumes that if RunRoot is part of ConmonPidFile the user did not specify --conmon-pidfile' during run or create. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
dc3816819d
commit
a891b84528
|
@ -54,6 +54,14 @@ func (r *Runtime) RestoreContainer(ctx context.Context, rSpec *spec.Spec, config
|
|||
}
|
||||
// For an imported checkpoint no one has ever set the StartedTime. Set it now.
|
||||
ctr.state.StartedTime = time.Now()
|
||||
|
||||
// If the path to ConmonPidFile starts with the default value (RunRoot), then
|
||||
// the user has not specified '--conmon-pidfile' during run or create (probably).
|
||||
// In that case reset ConmonPidFile to be set to the default value later.
|
||||
if strings.HasPrefix(ctr.config.ConmonPidFile, r.config.StorageConfig.RunRoot) {
|
||||
ctr.config.ConmonPidFile = ""
|
||||
}
|
||||
|
||||
return r.setupContainer(ctx, ctr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue