Recreate the Rootfs in mountStorage for infra-container.

After the system reboot, the Rootfs for infra-container can
be removed. This can happen when it is stored on tmpfs.

This commit recreates the infra-container directory which is
used for Rootfs for infra-container before mounting it.

Fixes: #26190

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza
2025-05-27 14:13:17 +02:00
parent 27fdd7fc6d
commit e0b08fcfa3
4 changed files with 56 additions and 17 deletions

View File

@ -250,7 +250,11 @@ func (r *Runtime) newContainer(ctx context.Context, rSpec *spec.Spec, options ..
func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Container, retErr error) {
if ctr.IsDefaultInfra() || ctr.IsService() {
_, err := ctr.prepareInitRootfs()
err := ctr.createInitRootfs()
if err != nil {
return nil, err
}
_, err = ctr.prepareCatatonitMount()
if err != nil {
return nil, err
}