]> git.ipfire.org Git - thirdparty/lxc.git/commit
lxc-copy: allow snapshots to be placed on tmpfs 1084/head
authorChristian Brauner <christian.brauner@mailbox.org>
Sat, 16 Jul 2016 09:00:17 +0000 (11:00 +0200)
committerChristian Brauner <christian.brauner@mailbox.org>
Mon, 18 Jul 2016 18:40:13 +0000 (20:40 +0200)
commit60a77c182229855703f859d884ef9584c80fb987
treeff5225f1df66a010dbf43ad5b2b6a42611b9ac1e
parent878353260117ce10b8448eb234c9d8fa1131bb79
lxc-copy: allow snapshots to be placed on tmpfs

Place an ephemeral container started with -e flag on a tmpfs. Restrictions are
that you cannot request the data to be kept while placing the container on a
tmpfs, that either overlay or aufs backing storage must be used, and that the
storage backend of the original container must be a directory.

For ephemeral snapshots backed by overlay or aufs filesystems, a fresh tmpfs
is mounted over the containers directory if the user requests it. This should
be the easiest options. Anything else would require us to change the current
mount-layout of overlay and aufs snapshots. (A standard overlay or aufs
snapshot clone currently has the layout:

/var/lib/lxc/CLONE_SNAPSHOT/delta0      <-- upperdir
/var/lib/lxc/CLONE_SNAPSHOT/rootfs
/var/lib/lxc/CLONE_SNAPSHOT/olwork
/var/lib/lxc/CLONE_SNAPSHOT/olwork/work <-- workdir

with the lowerdir being

/var/lib/lxc/CLONE_PARENT/rootfs

The fact that upperdir and workdir are not placed in a common subfolder under
the container directory has the consequence that we cannot simply mount a fresh
tmpfs under upperdir and workdir because overlay expects them to be on the same
filesystem.)

Because we mount a fresh tmpfs over the directory of the container the updated
/etc/hostname file created during the clone residing in the upperdir (currently
named "delta0" by default) will be hidden. Hence, if the user requests that the
old name is not to be kept for the clone, we recreate this file on the tmpfs.
This should be all that is required to restore the exact behaviour we would get
with a normal clone.
NOTE: If the container is rebooted all changes made to it are lost. This is not
easy to prevent since each reboot remounts the rootfs again.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
src/lxc/arguments.h
src/lxc/lxc_copy.c