[CRIU] [RFC][PATCH 0/3] Proposal for native (w/o plugins) support for external bind mounts v2

Saied Kazemi saied at google.com
Thu Jun 5 09:49:38 PDT 2014


Pavel,

Actually the first attempt is working, albeit with a little help.  So I
don't think we need to _replace_ the entire path that is relative to the
FS's root with what is passed to CRIU on the command line.  We just need to
find the missing part of the pathname and prepend it to the relative path.

Let's look at the following realistic example from Docker.  Docker bind
mounts the container's /etc/host as follows:

mount /var/lib/docker/containers/<ID>/hosts
/var/lib/docker/vfs/dir/<ID>/etc/hosts

The container's root is at /var/lib/docker/vfs/dir/<ID>.  For container's
/etc/hosts, CRIU records /containers/<ID>/hosts as source during dump.  On
restore, CRIU already has the container's root and ./etc/hosts within it,
so all it needs is the leading /var/lib/docker for external bind mount.  In
other words, there is no need replacing the entire path which is --by the
way-- dynamically generated for each container and not always easy to
figure out.

Does it make sense?

--Saied



On Thu, Jun 5, 2014 at 8:10 AM, Pavel Emelyanov <xemul at parallels.com> wrote:

> So, the 1st attempt with modifying original mount points roots is
> not working since the paths we see in /proc and dump are relative
> to the FS's root, not relative to global (well, CRIU's) root.
>
> That said, we can try to go another route and here it is.
>
> On dump we use one or more --ext-mount option with A=B arguments.
> A denotes a mountpoint (as seen from the target mount namespace)
> criu dumps and B is the string that will be written into the
> image file instead of the mountpoint's root. E.g. if we have a
> /foo/bar bind mounted into container under /x name, then the
> --ext-mount /x=foobar option will tell criu, that /x is a mount
> point with external source and it should write "foobar" into image
> instead of the path read from /proc.
>
> On restore we use the same --ext-mount option(s) with similar
> A=B arguments, but this time criu treats A as string from the
> image's root field (foobar in the example above) and B as the
> path in criu's mount namespace the should be bind mounted into
> the mountpoint.
>
> For example, let's again imagine we have /foo/bar bind mounted
> into container under /x name and /foo/bar is inaccessible from
> this container.
>
> On dump we say --ext-mount /x=foobar and mountpoints.img will
> contain a mountpoint with root=foobar and mountpoint=/x. On restore
> we use --ext-mount foobar=/foo2/bar option. This will result the
> /foo2/bar from criu's namespace get bind-mounted to /x inside the
> container we restore.
>
>
> Thanks,
> Pavel
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20140605/33e0d51a/attachment-0001.html>


More information about the CRIU mailing list