[lxc-devel] [lxc/lxc] 60a77c: lxc-copy: allow snapshots to be placed on tmpfs

GitHub noreply at github.com
Mon Jul 18 18:45:51 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 60a77c182229855703f859d884ef9584c80fb987
      https://github.com/lxc/lxc/commit/60a77c182229855703f859d884ef9584c80fb987
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-07-18 (Mon, 18 Jul 2016)

  Changed paths:
    M src/lxc/arguments.h
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  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 at suse.de>


  Commit: 897dcac41f53c8869c8fe190b69b7b9dc53f8db0
      https://github.com/lxc/lxc/commit/897dcac41f53c8869c8fe190b69b7b9dc53f8db0
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2016-07-18 (Mon, 18 Jul 2016)

  Changed paths:
    M src/lxc/arguments.h
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  Merge pull request #1084 from brauner/2016-07-16/clone_on_tmpfs

lxc-copy: allow snapshots to be placed on tmpfs


Compare: https://github.com/lxc/lxc/compare/878353260117...897dcac41f53


More information about the lxc-devel mailing list