[lxc-devel] [lxc/lxc] d7063d: API support for container snapshots (v2)

GitHub noreply at github.com
Tue Sep 10 17:35:28 UTC 2013


  Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: d7063dcf4926a3bff38de2f35217d66065d47e5a
      https://github.com/lxc/lxc/commit/d7063dcf4926a3bff38de2f35217d66065d47e5a
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/lxccontainer.c
    M src/lxc/lxccontainer.h
    M src/tests/Makefile.am
    A src/tests/snapshot.c

  Log Message:
  -----------
  API support for container snapshots (v2)

The api allows for creating, listing, and restoring of container
snapshots.  Snapshots are created as snapshot clones of the
original container - i.e. btrfs and lvm will be done as snapshot,
a directory-backed container will have overlayfs snapshots.  A
restore is a copy-clone, using the same backing store as the
original container had.

Changelog:

 . remove lxcapi_snap_open, which wasn't defined anyway.
 . rename get_comment to get_commentpath
 . if no newname is specified at restore, use c->name (as we meant to)
   rather than segving.
 . when choosing a snapshot index, use the correct path to check for.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>


  Commit: b49d70ab1541fe8ec41f022a28b7fbc5bd53a5fd
      https://github.com/lxc/lxc/commit/b49d70ab1541fe8ec41f022a28b7fbc5bd53a5fd
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/Makefile.am
    A src/lxc/lxc_snapshot.c

  Log Message:
  -----------
  introduce lxc-snapshot

Hopefully someone else will come in and spruce it up :)  This
version is as simple as can be

lxc-snapshot -n a1
	create a snapshot of a1
echo "second commit" > /tmp/a
lxc-snapshot -n a1 -c /tmp/a
	create a snapshot of a1 with /tmp/a as a commit comment
lxc-snapshot -n a1 -L
	list a1's snapshots
lxc-snapshot -n a1 -L -C
	list a1's snapshots along with commit comments
lxc-snapshot -n a1 -r snap0 a2
	restore snapshot 0 of a1 as container a2

Some easy nice-to-haves:

1. sort snapshots in the list
2. allow a comment to be given in-line
3. an option to remove a snapshot?

Removing a snapshot can just as well be done with

	lxc-destroy -P /var/lib/lxcsnaps/c1 -n snap2

so I leave it to others to decide whether they really want
it, and provide the patch if so.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>


  Commit: 1b92e80dc74fc20aad9c1b07965b35e469a219a5
      https://github.com/lxc/lxc/commit/1b92e80dc74fc20aad9c1b07965b35e469a219a5
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/error.c

  Log Message:
  -----------
  error.c: don't return error if container init signaled

We log that at INFO level in case it is needed.  However, in a modern
kernel a container which was shut down using 'shutdown' will always
have been signaled with SIGINT.  Making lxc-start return an error to
reflect that seems overkill.

It's *conceivable* that someone is depending on this behavior, so I'm
sending this out for anyone to NACK, but if I hear no complaints I'll
apply.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/3e15e0d37ebc...1b92e80dc74f


More information about the lxc-devel mailing list