[lxc-devel] [lxc/lxc] 058b94: don't truncate environment sometimes in setproctit...

GitHub noreply at github.com
Tue Nov 17 16:38:57 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 058b94fe0e3c6254c98911bfedb5695c825a8be2
      https://github.com/lxc/lxc/commit/058b94fe0e3c6254c98911bfedb5695c825a8be2
  Author: Tycho Andersen <tycho.andersen at canonical.com>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  don't truncate environment sometimes in setproctitle

Instead, let's just allocate new space for the proctitle to live and point
the kernel at that.

v2: take out testing hunk
v3: check return from realloc

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 43cea62db9ecfa83d4a2e5ffb27184909f5ec244
      https://github.com/lxc/lxc/commit/43cea62db9ecfa83d4a2e5ffb27184909f5ec244
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

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

  Log Message:
  -----------
  Add lxc-copy executable

This is a complete reimplementation of lxc-clone and lxc-start-ephemeral.
lxc-copy merges the functionalities of lxc-clone + lxc-start-ephemeral.

(1) Cloning containers:

	(a) as copy:

		lxc-copy -n aa -N bb

	(b) as snapshot:

		lxc-copy -n aa -N bb -s

(2) Renaming containers:

	lxc-copy -n aa -N bb -R

(3) Starting ephemeral containers:

Ephemeral containers are created and started by passing the flag -e /
--ephemeral. Whenever this flag is missing a copy of the container is created.
The flag -e / --ephemeral implies -s / --snapshot.

	(a) start ephemeral container daemonized with random name:

		lxc-copy -n aa -e

	(b) start ephemeral container in foreground mode with random name:

		lxc-copy -n aa -e -F

	(c) start ephemeral container with specified name in daemonized mode:
	    Analogous to lxc-start ephemeral containers start in daemonized
      mode per default:

		lxc-copy -n aa -N bb -e

	    One can however also explicitly pass -d / --daemon:

		lxc-copy -n aa -N bb -e -d

	    but both commands are equivalent.

	(d) start non-ephemeral container in daemonized mode:

		lxc-copy -n aa -D -e

	(e) start ephemeral container in daemonized mode and keep the original
	    hostname:

		lxc-copy -n aa -K -e

	(f) start ephemeral container in daemonized mode and keep the
	    MAC-address of the original container:

		lxc-copy -n aa -M -e

	(g) start ephemeral container with custom mounts (additional mounts can
      be of type {bind,aufs,overlay}) in daemonized mode:

		lxc-copy -n aa -e -m bind=/src:/dest:ro,aufs=/src:/dest,overlay=/src:/dest

(4) Other options:

	lxc-copy --help

In order to create a random containername and random upper- and workdirs for
custom mounts we use mkdtemp() to not just create the names but also directly
create the corresponding directories. This will be safer and make the code
considerably shorter.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 2b47bac3f81af9eb8ba392867c78fe3dec40a36a
      https://github.com/lxc/lxc/commit/2b47bac3f81af9eb8ba392867c78fe3dec40a36a
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M configure.ac
    M doc/Makefile.am
    A doc/lxc-copy.sgml.in
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  Add manpage for lxc-copy

(A trivial fix for lxc-copy is included.)

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: dca0532e37e44d1703b9fc80975d45dcffb0c27d
      https://github.com/lxc/lxc/commit/dca0532e37e44d1703b9fc80975d45dcffb0c27d
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  Use correct return when clone fails

When the clone failed we tried to destroy the container. This will lead to a
segfault. Instead simply return -1. Also move the call to free_mnts() after the
put label to free the user specified mounts even when we just goto put.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: b84e8c4bb2a63936f0eae0ab5f9a9ff39a79d8dc
      https://github.com/lxc/lxc/commit/b84e8c4bb2a63936f0eae0ab5f9a9ff39a79d8dc
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  Fix mode when creating temporary directory

When we create a random container directory with mkdtemp() we set the mode to
0770 otherwise do_lxcapi_clone() will complain about not being able to create
the config.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 8130ebe80fc66bbbccdfa54d70664084a36a1e13
      https://github.com/lxc/lxc/commit/8130ebe80fc66bbbccdfa54d70664084a36a1e13
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M src/lxc/lxc_copy.c

  Log Message:
  -----------
  Improve coding style and coding conventions

Local variables should not have the same name as global variables to avoid
confusion.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 5eea90e8505d9f336bb28379d8575be159fdd2e1
      https://github.com/lxc/lxc/commit/5eea90e8505d9f336bb28379d8575be159fdd2e1
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2015-11-17 (Tue, 17 Nov 2015)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  clone: clear the rootfs out of unexpanded config

Closes #694

When we start cloning container c1 to c2, we first save c1's
configuration in c2's as a starting point.  We long ago cleared
out the lxc.rootfs entry before saving it, so that if we are
killed before we update the rootfs, c2's rootfs doesn't point
to c1's.  Because then lxc-destroy -n c2 would delete c1's rootfs.

But when we introduced the unexpanded_config, we didn't update
this code to clear the rootfs out of the unexpanded_config, which
is what now actually gets saved in write_config().

Do so.

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/f8b2a49ce0bb...5eea90e8505d


More information about the lxc-devel mailing list