[CRIU] Podman container migration

Adrian Reber adrian at lisas.de
Thu Jan 24 13:20:21 MSK 2019


On Thu, Jan 10, 2019 at 10:08:16PM -0800, Andrei Vagin wrote:
> On Wed, Jan 09, 2019 at 03:16:38PM +0100, Adrian Reber wrote:
> > I started to look into migrating containers with Podman and I am
> > currently stuck at files which are bind-mounted into the container:
> > 
> > If I checkpoint a container and restore it, it works.
> > 
> > If I checkpoint a container and transfer the checkpoint to another
> > container it only works if the previous container is running, as
> > CRIU fails to mount the file into the container.
> > 
> > Following is from the checkpointed container:
> > 
> >         {
> >             "fstype": 5, 
> >             "mnt_id": 368, 
> >             "root_dev": "0:20", 
> >             "parent_mnt_id": 367, 
> >             "flags": "0x1000006", 
> >             "root": "/containers/storage/overlay-containers/43d02fb390d236ec42c5119b6655be44157e4a61103bc827db3b0718feecc898/userdata/run/secrets", 
> >             "mountpoint": "/run/secrets", 
> >             "source": "tmpfs", 
> >             "options": "size=2899748k,nr_inodes=724937,mode=755", 
> >             "shared_id": 0, 
> >             "master_id": 0, 
> >             "sb_flags": "0x0", 
> >             "ext_key": "/run/secrets"
> >         }, 
> > 
> > 
> > The main problem I see is that the storage location of the checkpointed
> > container is part of "root".
> > 
> > Or do I have to make sure that the migrated container is using the same
> > paths as the restored container.
> > 
> > I get the following error during restore, if I copy the checkpoint to another
> > container.
> > 
> > (00.009274)      1: mnt: Start with 0:/tmp/.criu.mntns.d6UW28
> > (00.009279)      1: mnt: 	Mounting overlay @/tmp/.criu.mntns.d6UW28/12-0000000000/ (0)
> > (00.009285)      1: mnt: 367:/tmp/.criu.mntns.d6UW28/12-0000000000/ private 1 shared 0 slave 0
> > (00.009295)      1: mnt: 	Mounting tmpfs @/tmp/.criu.mntns.d6UW28/12-0000000000/run/secrets (0)
> > (00.009297)      1: mnt: 	Bind /var/run/containers/storage/overlay-containers/43d02fb390d236ec42c5119b6655be44157e4a61103bc827db3b0718feecc898/userdata/run/secrets to /tmp/.criu.mntns.d6UW28/12-0000000000/run/secrets
> > (00.009326)      1: Error (criu/mount.c:2279): mnt: Can't mount at /tmp/.criu.mntns.d6UW28/12-0000000000/run/secrets: No such file or directory
> 
> runsc creates a destination directory for external mounts:
> https://github.com/opencontainers/runc/blob/master/libcontainer/rootfs_linux.go#L278
> 
> when a container is restored, destination directories for external
> mounts are not created, because we suppose that the container rootfs
> will be restored or migrated too. CRIU and runsc doesn't handle a
> container rootfs, so you need to do this in podman.

I am doing this now. It still does not work, so I am probably doing it
wrong.

CRIU has the following information about the container in its
mountpoints-*img:

        {
            "fstype": 17, 
            "mnt_id": 252, 
            "root_dev": "0:43", 
            "parent_mnt_id": 153, 
            "flags": "0x200000", 
            "root": "/", 
            "mountpoint": "/", 
            "source": "overlay", 
            "options": "lowerdir=/var/lib/containers/storage/overlay/l/2S375XKZQPDN4PUEXDF5O6UOHR:/var/lib/containers/storage/overlay/l/BZ4VT4FMA3V5R3B5OQCCTI4EIK:/var/lib/containers/storage/overlay/l/PPTBJ3ILFMWC2I7GTG4MW5LFJS:/var/lib/containers/storage/overlay/l/7MYJABNPHL5WGKWQZUQZIAZAAK:/var/lib/containers/storage/overlay/l/PR33ERQ7UP22DCFFUD7T22TE2L:/var/lib/containers/storage/overlay/l/3JGMFT6UEEGG3ENP6ZU4A6WVRX:/var/lib/containers/storage/overlay/l/ZOZ7KNBDLJ22DO6YYFSRHX2BXJ:/var/lib/containers/storage/overlay/l/UX2SILYJEP6X63BN3J2KOJD2VI:/var/lib/containers/storage/overlay/l/LA5B6O3237C5XBRVMWX2F353VJ:/var/lib/containers/storage/overlay/l/7UCRZZJIKLTNFMJWKMXUSXY542:/var/lib/containers/storage/overlay/l/VYA4EVBDXX2YFRVI2WQW2YIDWP:/var/lib/containers/storage/overlay/l/LKKTET5Q6LOPVNF4SUMH5DTLFM:/var/lib/containers/storage/overlay/l/7K3UZVA54OYTUGJYW7VOYAZZXP:/var/lib/containers/storage/overlay/l/3OWJO6K4ZJY2UQPDDN5ZXWZBHC,upperdir=/var/lib/containers/storage/overlay/761a5c37a39a0436741a35fed374c8212b37b053ebe826d40096008413960659/diff,workdir=/var/lib/containers/storage/overlay/761a5c37a39a0436741a35fed374c8212b37b053ebe826d40096008413960659/work", 
            "shared_id": 0, 
            "master_id": 0, 
            "sb_flags": "0x0"
        }

If I am restoring the container the options of the overlay filesystem
are different. 'upperdir' and 'workdir' changes. 'lowerdir' stays the
same. As an ugly hack I am now changing the mountpoint.img before
restoring the container. I still see the message:

 1: mnt:    Mounting overlay @/tmp/.criu.mntns.d6UW28/12-0000000000/ (0)

But I do not see anything mounted at /tmp/.criu.mntns.d6UW28/12-0000000000/

Is there some mechanism in CRIU with which I can mount another overlay
as the root file system? Somehow ignore or skip the one from
mountpoints-*.img?

		Adrian



More information about the CRIU mailing list