]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
9 years agoFix indentation
Stéphane Graber [Mon, 21 Sep 2015 20:25:47 +0000 (16:25 -0400)]
Fix indentation

I've noticed that a bunch of the code we've included over the past few
weeks has been using 8-spaces rather than tabs, making it all very hard
to read depending on your tabstop setting.

This commit attempts to revert all of that back to proper tabs and fix a
few more cases I've noticed here and there.

No functional changes are included in this commit.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoovl_rsync: make sure to umount
Serge Hallyn [Mon, 21 Sep 2015 19:33:23 +0000 (19:33 +0000)]
ovl_rsync: make sure to umount

Otherwise the kernel will umount when it gets around to it, but
that on lxc_destroy we may race with it and fail the rmdir of
the overmounted (BUSY) rootfs.

This makes lxc-test-snapshot pass for me again.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agooverlayfs_mount: create delta dir if it doesn't exist
Serge Hallyn [Mon, 21 Sep 2015 17:09:25 +0000 (17:09 +0000)]
overlayfs_mount: create delta dir if it doesn't exist

(This *should* fix the lxc-test-snapshot testcase, but doesn't seem
to by itself.)

If it doesn't exist, we may as well start with an empty one.  This
is needed when creating an overlayfs snapshot.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc_rmdir_onedev: don't fail if path doesn't exist
Serge Hallyn [Mon, 21 Sep 2015 17:01:10 +0000 (17:01 +0000)]
lxc_rmdir_onedev: don't fail if path doesn't exist

We're asked to delete it, don't fail if it doesn't exist.

This stops lxc-destroy from failing when the container isn't fully
built.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoMake ephemeral containers survive reboots
Christian Brauner [Mon, 21 Sep 2015 16:01:41 +0000 (18:01 +0200)]
Make ephemeral containers survive reboots

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoRemove ephemeral containers from lxc_snapshots
Christian Brauner [Tue, 15 Sep 2015 19:24:05 +0000 (21:24 +0200)]
Remove ephemeral containers from lxc_snapshots

On shutdown ephemeral containers will be destroyed. We use mod_all_rdeps() from
lxccontainer.c to update the lxc_snapshots file of the original container. We
also include lxclock.h to lock the container when mod_all_rdeps() is called to
avoid races.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMake mod_all_rdeps() public It will now also be called from start.c
Christian Brauner [Tue, 15 Sep 2015 19:24:04 +0000 (21:24 +0200)]
Make mod_all_rdeps() public It will now also be called from start.c

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-checkconfig: add some more config options
Tycho Andersen [Fri, 11 Sep 2015 18:45:33 +0000 (12:45 -0600)]
lxc-checkconfig: add some more config options

Here's some more config options that we do actually require to be able to
boot containers.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agogitignore: add Korean man page output
Tycho Andersen [Fri, 11 Sep 2015 18:45:34 +0000 (12:45 -0600)]
gitignore: add Korean man page output

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agogitignore: add strange lxc@.service file
Tycho Andersen [Fri, 11 Sep 2015 18:45:35 +0000 (12:45 -0600)]
gitignore: add strange lxc@.service file

I have no idea what this file is, but the build system seems to be
generating it, so let's ignore it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoEnsure that mmap()ed memory is \0-terminated (v3)
Christian Brauner [Fri, 11 Sep 2015 06:07:37 +0000 (08:07 +0200)]
Ensure that mmap()ed memory is \0-terminated (v3)

Use pwrite() to write terminating \0-byte

This allows us to use standard string handling functions and we can avoid using
the GNU-extension memmem(). This simplifies removing the container from the
lxc_snapshots file. Wrap strstr() in a while loop to remove duplicate entries.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFixing MTU calculation in instantiate_veth()]
Stephane Nguyen [Wed, 9 Sep 2015 06:22:52 +0000 (08:22 +0200)]
Fixing MTU calculation in instantiate_veth()]

Signed-off-by: Stephane Nguyen <stephminh@yahoo.es>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoEnable lxc_fini() to destroy container on shutdown
Christian Brauner [Tue, 8 Sep 2015 20:37:16 +0000 (22:37 +0200)]
Enable lxc_fini() to destroy container on shutdown

When lxc.ephemeral is set to 1 in the containers config it will be destroyed on
shutdown.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoDestroy bdevs using bdev_destroy() from bdev.h
Christian Brauner [Tue, 8 Sep 2015 20:37:15 +0000 (22:37 +0200)]
Destroy bdevs using bdev_destroy() from bdev.h

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd bdev_destroy() and bdev_destroy_wrapper()
Christian Brauner [Tue, 8 Sep 2015 20:37:14 +0000 (22:37 +0200)]
Add bdev_destroy() and bdev_destroy_wrapper()

static do_bdev_destroy() and bdev_destroy_wrapper() from lxccontainer.c become
public bdev_destroy() and bdev_destroy_wrapper() in bdev.c and bdev.h

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd lxc.ephemeral lxc.ephemeral indicates whether a container will be destroyed on...
Christian Brauner [Tue, 8 Sep 2015 20:37:13 +0000 (22:37 +0200)]
Add lxc.ephemeral lxc.ephemeral indicates whether a container will be destroyed on shutdown Can be 0 for non-ephemeral and 1 for ephemeral.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agooverlayfs_clone: rsync the mounted rootfs
Serge Hallyn [Thu, 17 Sep 2015 17:26:12 +0000 (17:26 +0000)]
overlayfs_clone: rsync the mounted rootfs

Closes #655

We can't rsync the delta as unpriv user because we can't create
the chardevs representing a whiteout.  We can however rsync the
rootfs and have the kernel create the whiteouts for us.

do_rsync: pass --delete

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFix reallocation calculation
Christian Brauner [Mon, 21 Sep 2015 07:53:43 +0000 (09:53 +0200)]
Fix reallocation calculation

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd tests for snapshot clone dependencies
Serge Hallyn [Tue, 8 Sep 2015 14:55:05 +0000 (14:55 +0000)]
Add tests for snapshot clone dependencies

Test edge cases (removing first and last entries in lxc_snapshots and the very
last snapshot) and make sure original container isn't destroyed while there are
snapshots, and is when there are none.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoAdd a nesting.conf which can be included to support nesting containers (v2)
Serge Hallyn [Thu, 3 Sep 2015 20:24:06 +0000 (20:24 +0000)]
Add a nesting.conf which can be included to support nesting containers (v2)

Newer kernels have added a new restriction:  if /proc or /sys on the
host has files or non-empty directories which are over-mounted, and
there is no /proc which fully visible, then it assumes there is a
"security" reason for this.  It prevents anyone in a non-initial user
namespace from creating a new proc or sysfs mount.

To work around this, this patch adds a new 'nesting.conf' which can be
lxc.include'd from a container configuration file.  It adds a
non-overmounted mount of /proc and /sys under /dev/.lxc, so that the
kernel can see that we're not trying to *hide* things like /proc/uptime.
and /sys/devices/virtual/net.  If the host adds this to the config file
for container w1, then container w1 will support unprivileged child
containers.

The nesting.conf file also sets the apparmor profile to the with-nesting
variant, since that is required anyway.  This actually means that
supporting nesting isn't really more work than it used to be, just
different.  Instead of adding

lxc.aa_profile = lxc-container-default-with-nesting

you now just need to

lxc.include = /usr/share/lxc/config/nesting.conf

(Look, fewer characters :)

Finally, in order to maintain the current apparmor protections on
proc and sys, we make /dev/.lxc/{proc,sys} non-read/writeable.
We don't need to be able to use them, we're just showing the
kernel what's what.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Update Korean lxc-snapshot(1) for newname option
Sungbae Yoo [Tue, 1 Sep 2015 10:12:57 +0000 (19:12 +0900)]
doc: Update Korean lxc-snapshot(1) for newname option

Update for commit dedd4f6

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add lxc.init_(uid|gid) in Korean lxc.container.conf(5)
Sungbae Yoo [Tue, 1 Sep 2015 08:45:38 +0000 (17:45 +0900)]
doc: Add lxc.init_(uid|gid) in Korean lxc.container.conf(5)

update for commit dbca923

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Update Korean lxc.cgroup.use in lxc.system.conf(5)
Sungbae Yoo [Tue, 1 Sep 2015 07:58:33 +0000 (16:58 +0900)]
doc: Update Korean lxc.cgroup.use in lxc.system.conf(5)

Update for commit 2d8632d

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the rename option to lxc-clone(1) in Korean manual
Sungbae Yoo [Tue, 1 Sep 2015 07:56:45 +0000 (16:56 +0900)]
doc: Add the rename option to lxc-clone(1) in Korean manual

Update for commit 585f3c6

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add LXC-specific mount option in Korean lxc.container.conf(5)
Sungbae Yoo [Tue, 1 Sep 2015 08:02:50 +0000 (17:02 +0900)]
doc: Add LXC-specific mount option in Korean lxc.container.conf(5)

Update for commit f5b67b3

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Update Japanese lxc-snapshot(1) for newname option
KATOH Yasufumi [Mon, 31 Aug 2015 10:00:11 +0000 (19:00 +0900)]
doc: Update Japanese lxc-snapshot(1) for newname option

Update for commit dedd4f6

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add lxc.init_(uid|gid) in Japanese lxc.container.conf(5)
KATOH Yasufumi [Mon, 31 Aug 2015 09:53:00 +0000 (18:53 +0900)]
doc: Add lxc.init_(uid|gid) in Japanese lxc.container.conf(5)

update for commit dbca923

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the common and '-s' option in lxc-destroy(1)
KATOH Yasufumi [Fri, 28 Aug 2015 07:29:03 +0000 (16:29 +0900)]
doc: Add the common and '-s' option in lxc-destroy(1)

* Add the description of '-s' option
* Remove '-P' option, and add common options
* Improve Japanese translation

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add LXC-specific mount option in Japanese lxc.container.conf(5)
KATOH Yasufumi [Fri, 28 Aug 2015 06:35:50 +0000 (15:35 +0900)]
doc: Add LXC-specific mount option in Japanese lxc.container.conf(5)

Add the description of optional, create=file/dir for lxc.mount.entry.
This is update for commit f5b67b3.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoDo not use strlen() on non-null terminated buffer
Christian Brauner [Mon, 7 Sep 2015 21:41:35 +0000 (23:41 +0200)]
Do not use strlen() on non-null terminated buffer

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agocoverity: avoid use of NULL c1
Serge Hallyn [Fri, 4 Sep 2015 18:21:35 +0000 (13:21 -0500)]
coverity: avoid use of NULL c1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agocoverity: fix mount_entry_create_dir_file
Serge Hallyn [Fri, 4 Sep 2015 18:15:13 +0000 (13:15 -0500)]
coverity: fix mount_entry_create_dir_file

First, fix use of uninitialized variable 'ret'.  Then, actually use
the value it returned in its caller.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #649 from major/lxc-delete-network-test
Stéphane Graber [Thu, 3 Sep 2015 16:58:53 +0000 (12:58 -0400)]
Merge pull request #649 from major/lxc-delete-network-test

Tear down network devices during container halt

9 years agoTear down network devices during container halt
Major Hayden [Wed, 2 Sep 2015 21:21:11 +0000 (16:21 -0500)]
Tear down network devices during container halt

On very busy systems, some virtual network devices won't be destroyed after a
container halts.  This patch uses the lxc_delete_network() method to ensure
that network devices attached to the container are destroyed when the
container halts.

Without the patch, some virtual network devices are left over on the system
and must be removed with `ip link del <device>`.  This caused containers
with lxc.network.veth.pair to not be able to start.  For containers using
randomly generated virtual network device names, the old devices will hang
around on the bridge with their original MAC address.

Signed-off-by: Major Hayden <major@mhtx.net>
9 years agoMerge pull request #646 from brauner/manpages_new
Stéphane Graber [Fri, 28 Aug 2015 17:36:19 +0000 (13:36 -0400)]
Merge pull request #646 from brauner/manpages_new

Adapt manpage for lxc-snapshot

9 years agoAdapt manpage for lxc-snapshot
Christian Brauner [Fri, 28 Aug 2015 16:55:29 +0000 (18:55 +0200)]
Adapt manpage for lxc-snapshot

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
9 years agoMerge pull request #585 from ptoomey3/lxc-execute-as-user
Stéphane Graber [Fri, 28 Aug 2015 15:23:13 +0000 (11:23 -0400)]
Merge pull request #585 from ptoomey3/lxc-execute-as-user

Add support for specified UID/GID for lxc-execute in a private user namespace

9 years agoMerge pull request #643 from raspberrypython/issue-616
Stéphane Graber [Fri, 28 Aug 2015 15:22:10 +0000 (11:22 -0400)]
Merge pull request #643 from raspberrypython/issue-616

Test dpkg for multiarch support in lxc-debian template

9 years agoAlternative test for dpkg multiarch support in lxc-debian template
David Noyes [Fri, 28 Aug 2015 14:44:25 +0000 (14:44 +0000)]
Alternative test for dpkg multiarch support in lxc-debian template

Signed-off-by: David Noyes <david.j.noyes@gmail.com>
9 years agoAdd support for get_config_item and set_config_item
Patrick Toomey [Thu, 27 Aug 2015 22:21:35 +0000 (16:21 -0600)]
Add support for get_config_item and set_config_item

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoUpdate docs to reflect lxc.init_uid and lxc.init_gid options
Patrick Toomey [Wed, 19 Aug 2015 17:19:11 +0000 (11:19 -0600)]
Update docs to reflect lxc.init_uid and lxc.init_gid options

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoUpdate english docs for new lxc.init_uid and lxc.init_gid options
Patrick Toomey [Wed, 19 Aug 2015 17:05:12 +0000 (11:05 -0600)]
Update english docs for new lxc.init_uid and lxc.init_gid options

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoAdd support for setting lxc-execute init UID/GID via configuration file
Patrick Toomey [Wed, 19 Aug 2015 17:04:38 +0000 (11:04 -0600)]
Add support for setting lxc-execute init UID/GID via configuration file

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoClarify struct field comment
Patrick Toomey [Wed, 19 Aug 2015 15:57:59 +0000 (09:57 -0600)]
Clarify struct field comment

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoPass UID/GID explicitly through flags
Patrick Toomey [Tue, 18 Aug 2015 22:26:28 +0000 (16:26 -0600)]
Pass UID/GID explicitly through flags

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoSet UID/GID to parent value for lxc-execute
Patrick Toomey [Mon, 20 Jul 2015 18:37:20 +0000 (12:37 -0600)]
Set UID/GID to parent value for lxc-execute

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoDo not switch to root for lxc-execute
Patrick Toomey [Thu, 9 Jul 2015 22:58:17 +0000 (16:58 -0600)]
Do not switch to root for lxc-execute

Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
9 years agoFix verification of start hook without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:20 +0000 (10:57 -0400)]
Fix verification of start hook without a rootfs

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoWhen creating container, save configuration if rootfs already exists
David Ward [Tue, 23 Jun 2015 14:57:24 +0000 (10:57 -0400)]
When creating container, save configuration if rootfs already exists

Commit 6c6892b "fix multithreaded create()" prevented the container
configuration from being saved if the backing store does not need
to be created.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoOnly mount /proc if needed, even without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:19 +0000 (10:57 -0400)]
Only mount /proc if needed, even without a rootfs

Use the same code with and without a rootfs to check if mounting
/proc is necessary before doing so. If mounting it is unsuccessful
and there is no rootfs, continue as before.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAllow autodev without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:23 +0000 (10:57 -0400)]
Allow autodev without a rootfs

A container without a rootfs is useful for running a collection of
processes in separate namespaces (to provide separate networking as
an example), while sharing the host filesystem (except for specific
paths that are re-mounted as needed). For multiple processes to run
automatically when such a container is started, it can be launched
using lxc-start, and a separate instance of systemd can manage just
the processes inside the container. (This assumes that the path to
the systemd unit files is re-mounted and only contains the services
that should run inside the container.) For this use case, autodev
should be permitted for a container that does not have a rootfs.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix /dev symlinks without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:21 +0000 (10:57 -0400)]
Fix /dev symlinks without a rootfs

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix container creation without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:25 +0000 (10:57 -0400)]
Fix container creation without a rootfs

It is not an error to create a container without a template or rootfs.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix automatic mounts without a rootfs
David Ward [Tue, 23 Jun 2015 14:57:22 +0000 (10:57 -0400)]
Fix automatic mounts without a rootfs

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #617 from alkino/master
Stéphane Graber [Thu, 27 Aug 2015 20:58:06 +0000 (16:58 -0400)]
Merge pull request #617 from alkino/master

A little bit of refactor and doc

9 years agoMerge pull request #631 from alkino/doc
Stéphane Graber [Thu, 27 Aug 2015 20:34:00 +0000 (16:34 -0400)]
Merge pull request #631 from alkino/doc

Add long option for -P in documentation

9 years agoMerge pull request #634 from alkino/config_mount
Stéphane Graber [Thu, 27 Aug 2015 20:33:38 +0000 (16:33 -0400)]
Merge pull request #634 from alkino/config_mount

Split handle of lxc.mount* with 3 functions

9 years agoMerge pull request #638 from schiele/master
Stéphane Graber [Thu, 27 Aug 2015 20:22:14 +0000 (16:22 -0400)]
Merge pull request #638 from schiele/master

check for NULL pointers before calling setenv()

9 years agoClone bridge interface MTU setting
Natanael Copa [Fri, 21 Aug 2015 09:48:10 +0000 (11:48 +0200)]
Clone bridge interface MTU setting

Instead of require static mtu setting in config we simply clone the
existing MTU setting of the bridge interface.

This fixes issue when bridge interface has bigger MTU (like 9000 for
jumbo frame support) than the default 1500. When veth interface is
created it has by default MTU set to 1500 and when this is added to the
bridge, the kernel wee reduce the MTU for the bridge to 1500. We solve
this by cloning the MTU value from bridge interface.

This simplifies managing containers with bridge interface who supports
jumbo frames (mtu 9000) and makes it easier to move containers between
hosts with different MTU settings.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agofix open() results check to include 0
Serge Hallyn [Thu, 27 Aug 2015 20:12:26 +0000 (15:12 -0500)]
fix open() results check to include 0

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoDestroy container with snapshots & clone-snapshots
Christian Brauner [Tue, 18 Aug 2015 11:40:11 +0000 (13:40 +0200)]
Destroy container with snapshots & clone-snapshots

- This enables lxc-destroy to destroy a container with all its snapshots
  including clone-snapshots not located in the snaps/ folder.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agomod_rdep(): Write path and name of clone to file
Christian Brauner [Tue, 11 Aug 2015 08:33:46 +0000 (10:33 +0200)]
mod_rdep(): Write path and name of clone to file

If we currently create clone-snapshots via lxc-clone only the plain total
number of the containers it serves as a base-container is written to the file
"lxc-snapshots". This commit modifies mod_rdep() so it will store the paths and
names to the containers that are clone-snapshots (similar to the "lxc_rdepends"
file for the clones). **Users which still have containers that have a non-empty
(with a number > 0 as an entry) "lxc-snapshots" file in the old format are not
affected by this change. It will be used until all old clones have been
deleted!** For all others, the "lxc_snapshots" file placed under the original
container now looks like this:

      /var/lib/lxc
      bb
      /var/lib/lxc
      cc
      /opt
      dd

This is an example of a container that provides the base for three
clone-snapshots bb, cc, and dd. Where bb and cc both are placed in the usual
path for privileged containers and dd is placed in a custom path.

- Add additional argument to function that takes in the clone-snapshotted
  lxc_container.
- Have mod_rdep() write the path and name of the clone-snapshotted container the
  file lxc_snapshots of the original container.
- If a clone-snapshot gets deleted the corresponding line in the file
  lxc_snapshot of the original container will be deleted and the file updated
  via mmap() + memmove() + munmap().
- Adapt has_fs_snapshots().
- **If an lxc-snapshot file in the old format is found we'll keep using it.**

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix grammar in some of the executables
Christian Brauner [Fri, 14 Aug 2015 18:24:05 +0000 (20:24 +0200)]
Fix grammar in some of the executables
"NAME for name of the container" becomes "NAME of the container"

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMake LXC_CLONE_KEEPNAME work
Christian Brauner [Fri, 14 Aug 2015 18:17:21 +0000 (20:17 +0200)]
Make LXC_CLONE_KEEPNAME work

- Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected and
  let to unexpected behaviour for e.g. lxc-clone. We wrap
  clear_unexp_config_line() and set_config_item_line() in an appropriate
  if-condition.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-destroy: Remove container with all snapshots
Christian Brauner [Fri, 14 Aug 2015 18:16:16 +0000 (20:16 +0200)]
lxc-destroy: Remove container with all snapshots

- This enables the user to destroy a container with all its snapshots without
  having to use lxc-snapshot first to destroy all snapshots. (The enum values
  DESTROY and SNAP from the previous commit are reused here again.)
- Some unification regarding the usage of exit() and return has been done.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoRefactor lxc-snapshot
Christian Brauner [Fri, 14 Aug 2015 18:14:01 +0000 (20:14 +0200)]
Refactor lxc-snapshot

- lxc_snapshot.c lacked necessary members in the associated lxc_arguments struct
  in arguments.h. This commit extends the lxc_arguments struct to include
  several parameters used by lxc-snapshot which allows a rewrite that is more
  consistent with the rest of the lxc-* executables.
- All tests have been moved beyond the call to lxc_log_init() to allow for the
  messages to be printed or saved.
- Some small changes to the my_args struct. (The enum task is set to SNAP (for
  snapshot) per default and variables illustrating the usage of the command line
  flags are written in all caps.)
- arguments.h has been extended to accommodate a future rewrite of lxc-clone
- Traditional behaviour of the executable has been retained in this commit.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodoc: Update lxc.cgroup.use in lxc.system.conf(5)
KATOH Yasufumi [Wed, 19 Aug 2015 11:35:36 +0000 (20:35 +0900)]
doc: Update lxc.cgroup.use in lxc.system.conf(5)

LXC now uses lxc.cgroup.use even when cgmanager is used.
So remove the description for the case of using cgmanager.
And add the case of not specifying it.
This commit only updates en and ja man pages.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-debian: allow not including contrib/non-free
Antonio Terceiro [Wed, 19 Aug 2015 21:06:50 +0000 (23:06 +0200)]
lxc-debian: allow not including contrib/non-free

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-debian: support stretch (Debian 9) images
Antonio Terceiro [Wed, 19 Aug 2015 20:14:13 +0000 (22:14 +0200)]
lxc-debian: support stretch (Debian 9) images

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoinit: Support older apparmor
Stéphane Graber [Thu, 27 Aug 2015 19:25:08 +0000 (15:25 -0400)]
init: Support older apparmor

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoTest dpkg for multiarch support in lxc-debian template
David Noyes [Wed, 26 Aug 2015 13:18:49 +0000 (14:18 +0100)]
Test dpkg for multiarch support in lxc-debian template

Signed-off-by: David Noyes <david.j.noyes@gmail.com>
9 years agocheck for NULL pointers before calling setenv()
Robert Schiele [Fri, 21 Aug 2015 05:35:34 +0000 (07:35 +0200)]
check for NULL pointers before calling setenv()

Latest glibc release actually honours calling setenv with a NULL
pointer by causing SIGSEGV but checking pointers before submitting
to any system function is a good idea anyway.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
9 years agoSplit handle of lxc.mount* with 3 functions
Nicolas Cornu [Sat, 15 Aug 2015 22:52:44 +0000 (00:52 +0200)]
Split handle of lxc.mount* with 3 functions

Signed-off-by: Nicolas Cornu <nicolac76@yahoo.fr>
9 years agoc/r: enable tracefs
Tycho Andersen [Fri, 14 Aug 2015 16:24:47 +0000 (10:24 -0600)]
c/r: enable tracefs

tracefs is a new filesystem that can be mounted by users. Only the options
and fs name need to be passed to restore the state, so we can use criu's
auto fs feature.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoMerge pull request #632 from lxc/revert-621-arguments
Serge Hallyn [Fri, 14 Aug 2015 16:01:56 +0000 (11:01 -0500)]
Merge pull request #632 from lxc/revert-621-arguments

Revert "Refactor lxc-snapshot, lxc-clone, make LXC_CLONE_KEEPNAME wor…

9 years agoRevert "Refactor lxc-snapshot, lxc-clone, make LXC_CLONE_KEEPNAME work and add option...
Serge Hallyn [Fri, 14 Aug 2015 15:59:19 +0000 (10:59 -0500)]
Revert "Refactor lxc-snapshot, lxc-clone, make LXC_CLONE_KEEPNAME work and add option to destroy container with all snapshots to lxc-destroy"

9 years agoRefactor and factorize mount entries
Nicolas Cornu [Thu, 6 Aug 2015 08:37:15 +0000 (10:37 +0200)]
Refactor and factorize mount entries

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoAdd doc for optional, create=dir and create=file in lxc.container.conf man
Nicolas Cornu [Wed, 5 Aug 2015 18:17:48 +0000 (20:17 +0200)]
Add doc for optional, create=dir and create=file in lxc.container.conf man

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoFactorize handle of create=dir and create=file
Nicolas Cornu [Thu, 6 Aug 2015 08:35:16 +0000 (10:35 +0200)]
Factorize handle of create=dir and create=file

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoAdd long option for -P in documentation
Nicolas Cornu [Fri, 14 Aug 2015 15:57:53 +0000 (17:57 +0200)]
Add long option for -P in documentation

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoMerge pull request #621 from brauner/arguments
Serge Hallyn [Fri, 14 Aug 2015 00:36:16 +0000 (19:36 -0500)]
Merge pull request #621 from brauner/arguments

Refactor lxc-snapshot, lxc-clone, make LXC_CLONE_KEEPNAME work and add option to destroy container with all snapshots to lxc-destroy

9 years agoMerge pull request #596 from lazy404/master
Stéphane Graber [Thu, 13 Aug 2015 21:00:19 +0000 (17:00 -0400)]
Merge pull request #596 from lazy404/master

Only use LOGPATH if lxcpath is unset or default

9 years agoOnly use LOGPATH if lxcpath is unset or default
Michal Grzedzicki [Tue, 21 Jul 2015 08:29:00 +0000 (10:29 +0200)]
Only use LOGPATH if lxcpath is unset or default

Signed-off-by: Michał Grzędzicki <lazy404@gmail.com>
9 years agoMerge pull request #628 from rldleblanc/cap_clone_fix
Stéphane Graber [Thu, 13 Aug 2015 20:38:07 +0000 (16:38 -0400)]
Merge pull request #628 from rldleblanc/cap_clone_fix

Caps are getting lost when cloning an LXC.

9 years agoMerge pull request #629 from rldleblanc/clone_typo
Stéphane Graber [Thu, 13 Aug 2015 20:37:32 +0000 (16:37 -0400)]
Merge pull request #629 from rldleblanc/clone_typo

Small trivial typo.

9 years agolxc-debian: skip security updates for unstable/sid
Antonio Terceiro [Sat, 18 Jul 2015 23:24:12 +0000 (20:24 -0300)]
lxc-debian: skip security updates for unstable/sid

There is no such thing as security support for unstable/sid.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the rename option to lxc-clone(1)
KATOH Yasufumi [Wed, 5 Aug 2015 08:49:19 +0000 (17:49 +0900)]
doc: Add the rename option to lxc-clone(1)

Update Japanese and English man pages.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoc/r: get rid of dump_net_info()
Tycho Andersen [Mon, 10 Aug 2015 17:12:18 +0000 (11:12 -0600)]
c/r: get rid of dump_net_info()

This was originally used to propagate the bridge and veth names across
hosts, but now we extract both from the container's config file, and
nothing reads the files that dump_net_info() writes, so let's just get rid
of them.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoc/r: allow empty networks to be checkpointed/restored
Tycho Andersen [Mon, 10 Aug 2015 17:12:19 +0000 (11:12 -0600)]
c/r: allow empty networks to be checkpointed/restored

Empty networks don't have anything (besides lo) for us to dump and restore,
so we should allow these as well.

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agogitignore: add TAGS files
Tycho Andersen [Mon, 10 Aug 2015 17:12:17 +0000 (11:12 -0600)]
gitignore: add TAGS files

Somehow our `make tags` target generates TAGS and not tags, so let's ignore
that too.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc_monitor: free @preg on error
Arjun Sreedharan [Sun, 12 Jul 2015 12:46:17 +0000 (18:16 +0530)]
lxc_monitor: free @preg on error

reuse label cleanup since free(NULL) is a no-op
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agopass on reboot flag and delete old veth on reboot
Wolfgang Bumiller [Mon, 27 Jul 2015 05:33:08 +0000 (07:33 +0200)]
pass on reboot flag and delete old veth on reboot

When setting lxc.network.veth.pair to get a fixed interface
name the recreation of it after a reboot caused an EEXIST.
-) The reboot flag is now a three-state value. It's set to
1 to request a reboot, and 2 during a reboot until after
lxc_spawn where it is reset to 0.
-) If the reboot is set (!= 0) within instantiate_veth and
a fixed name is used, the interface is now deleted before
being recreated.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoPrevent from error on umount /proc if userns are used.
Przemek Rudy [Wed, 29 Jul 2015 17:41:28 +0000 (19:41 +0200)]
Prevent from error on umount /proc if userns are used.

Signed-off-by: Przemek Rudy <prudy1@o2.pl>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoSmall trivial typo.
Robert LeBlanc [Thu, 13 Aug 2015 20:14:52 +0000 (14:14 -0600)]
Small trivial typo.

9 years agoMerge pull request #623 from christiaan/ephemeral_bind
Stéphane Graber [Thu, 13 Aug 2015 20:11:29 +0000 (16:11 -0400)]
Merge pull request #623 from christiaan/ephemeral_bind

Bind mount at different location

9 years agoMerge pull request #619 from alkino/contributing
Stéphane Graber [Thu, 13 Aug 2015 20:08:41 +0000 (16:08 -0400)]
Merge pull request #619 from alkino/contributing

Fresh CONTRIBUTING

9 years agoMerge pull request #577 from CameronNemo/systemd-instanced
Stéphane Graber [Thu, 13 Aug 2015 20:03:33 +0000 (16:03 -0400)]
Merge pull request #577 from CameronNemo/systemd-instanced

Add instanced systemd service

9 years agoCaps are getting lost when cloning an LXC. Adding the -X parameter copies the extende...
Robert LeBlanc [Thu, 13 Aug 2015 19:36:55 +0000 (13:36 -0600)]
Caps are getting lost when cloning an LXC. Adding the -X parameter copies the extended attributes. This allows things like ping to continue to be used by a non-privilged user in Debian at least.

9 years agolxc-destroy: Remove container with all snapshots
Christian Brauner [Sat, 8 Aug 2015 12:51:11 +0000 (14:51 +0200)]
lxc-destroy: Remove container with all snapshots

- This enables the user to destroy a container with all its snapshots without
  having to use lxc-snapshot first to destroy all snapshots. (The enum values
  DESTROY and SNAP from the previous commit are reused here again.)
- Some unification regarding the usage of exit() and return has been done.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
9 years agoFix grammar in some of the executables
Christian Brauner [Sat, 8 Aug 2015 00:34:18 +0000 (02:34 +0200)]
Fix grammar in some of the executables

"NAME for name of the container" becomes "NAME of the container"

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>