]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
8 years agoConfigure a static MAC address on the LXC bridge 1314/head
Cam Cope [Tue, 22 Nov 2016 23:16:32 +0000 (15:16 -0800)] 
Configure a static MAC address on the LXC bridge

Signed-off-by: Cam Cope <cam@dropbox.com>
8 years agoMerge pull request #1312 from brauner/2016-11-22/fix_lxc_unshare_parsing
Stéphane Graber [Tue, 22 Nov 2016 17:12:21 +0000 (12:12 -0500)] 
Merge pull request #1312 from brauner/2016-11-22/fix_lxc_unshare_parsing

tools: replace non-standard namespace identifiers

8 years agoMerge pull request #1313 from brauner/2016-11-22/fix_lxc_tests
Stéphane Graber [Tue, 22 Nov 2016 17:10:41 +0000 (12:10 -0500)] 
Merge pull request #1313 from brauner/2016-11-22/fix_lxc_tests

tests: remove overflow tests

8 years agotests: remove overflow tests 1313/head
Christian Brauner [Tue, 22 Nov 2016 16:38:18 +0000 (17:38 +0100)] 
tests: remove overflow tests

They do not behave correctly on some architectures, so let's remove them for
now and come up with better ones later.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agotools: replace non-standard namespace identifiers 1312/head
Christian Brauner [Tue, 22 Nov 2016 08:42:59 +0000 (09:42 +0100)] 
tools: replace non-standard namespace identifiers

The identifiers for namespaces used with lxc-unshare and lxc-attach as given on
the manpage do not align with the standard identifiers. This affects network,
mount, and uts namespaces. The standard identifiers are: "mnt", "uts", and
"net" whereas lxc-unshare and lxc-attach use "MOUNT", "UTSNAME", and "NETWORK".
I'm weary to hack this into namespace.{c.h} by e.g. adding additional members
to the ns_info struct or to special case this in lxc_fill_namespace_flags().
Internally, we should only accept standard identifiers to ensure that we are
always correctly aligned with the kernel. So let's use some cheap memmove()s to
replace them by their standard identifiers in lxc-unshare and lxc-attach.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1256 from brauner/2016-09-06/remove_atoi
Serge Hallyn [Tue, 22 Nov 2016 04:46:21 +0000 (22:46 -0600)] 
Merge pull request #1256 from brauner/2016-09-06/remove_atoi

remove atoi

8 years agoconfile: non-functional change 1256/head
Christian Brauner [Tue, 22 Nov 2016 03:44:14 +0000 (04:44 +0100)] 
confile: non-functional change

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_console: use lxc_safe_uint()
Christian Brauner [Sat, 29 Oct 2016 11:29:26 +0000 (13:29 +0200)] 
tools/lxc_console: use lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_autostart: use lxc_safe_{int,long}()
Christian Brauner [Sat, 29 Oct 2016 11:23:47 +0000 (13:23 +0200)] 
tools/lxc_autostart: use lxc_safe_{int,long}()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_ls: use lxc_safe_uint()
Christian Brauner [Sat, 29 Oct 2016 11:13:21 +0000 (13:13 +0200)] 
tools/lxc_ls: use lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_top: use lxc_safe_int()
Christian Brauner [Sat, 29 Oct 2016 11:11:14 +0000 (13:11 +0200)] 
tools/lxc_top: use lxc_safe_int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_stop: use lxc_safe_long()
Christian Brauner [Sat, 29 Oct 2016 10:40:15 +0000 (12:40 +0200)] 
tools/lxc_stop: use lxc_safe_long()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotests: add unit tests for lxc_safe_long()
Christian Brauner [Sat, 29 Oct 2016 10:39:54 +0000 (12:39 +0200)] 
tests: add unit tests for lxc_safe_long()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: add lxc_safe_long()
Christian Brauner [Sat, 29 Oct 2016 10:39:36 +0000 (12:39 +0200)] 
utils: add lxc_safe_long()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_stop: use lxc_safe_uint()
Christian Brauner [Sat, 29 Oct 2016 10:23:39 +0000 (12:23 +0200)] 
tools/lxc_stop: use lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotools/lxc_execute: use lxc_safe_uint()
Christian Brauner [Sat, 29 Oct 2016 10:22:17 +0000 (12:22 +0200)] 
tools/lxc_execute: use lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf: use lxc_safe_{u}int()
Christian Brauner [Sat, 29 Oct 2016 10:20:14 +0000 (12:20 +0200)] 
conf: use lxc_safe_{u}int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agostart: use lxc_safe_int()
Christian Brauner [Sat, 29 Oct 2016 10:08:00 +0000 (12:08 +0200)] 
start: use lxc_safe_int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agolxc_monitord: use lxc_safe_int() && use exit()
Christian Brauner [Sat, 29 Oct 2016 10:03:49 +0000 (12:03 +0200)] 
lxc_monitord: use lxc_safe_int() && use exit()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: use lxc_safe_int()
Christian Brauner [Sat, 29 Oct 2016 10:00:06 +0000 (12:00 +0200)] 
utils: use lxc_safe_int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: avoid atoi() in config_no_new_privs()
Christian Brauner [Fri, 28 Oct 2016 18:26:51 +0000 (20:26 +0200)] 
conf/ile: avoid atoi() in config_no_new_privs()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: avoid atoi() in config_ephemeral()
Christian Brauner [Fri, 28 Oct 2016 18:24:17 +0000 (20:24 +0200)] 
conf/ile: avoid atoi() in config_ephemeral()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_uint() in config_autodev()
Christian Brauner [Fri, 28 Oct 2016 18:22:35 +0000 (20:22 +0200)] 
conf/ile: use lxc_safe_uint() in config_autodev()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: avoid atoi in config_lsm_aa_incomplete()
Christian Brauner [Fri, 28 Oct 2016 18:10:25 +0000 (20:10 +0200)] 
conf/ile: avoid atoi in config_lsm_aa_incomplete()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_uint() in config_kmsg()
Christian Brauner [Fri, 28 Oct 2016 18:08:12 +0000 (20:08 +0200)] 
conf/ile: use lxc_safe_uint() in config_kmsg()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_uint() in config_tty()
Christian Brauner [Fri, 28 Oct 2016 18:06:40 +0000 (20:06 +0200)] 
conf/ile: use lxc_safe_uint() in config_tty()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_uint() in config_monitor()
Christian Brauner [Fri, 28 Oct 2016 18:05:07 +0000 (20:05 +0200)] 
conf/ile: use lxc_safe_uint() in config_monitor()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_u/int() in config_start()
Christian Brauner [Fri, 28 Oct 2016 18:01:21 +0000 (20:01 +0200)] 
conf/ile: use lxc_safe_u/int() in config_start()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: use lxc_safe_uint() in config_pts()
Christian Brauner [Fri, 28 Oct 2016 17:58:10 +0000 (19:58 +0200)] 
conf/ile: use lxc_safe_uint() in config_pts()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconfile: use lxc_safe_u/int in config_init_{u,g}id
Christian Brauner [Fri, 28 Oct 2016 17:53:19 +0000 (19:53 +0200)] 
confile: use lxc_safe_u/int in config_init_{u,g}id

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf/ile: get ip prefix via lxc_safe_uint()
Christian Brauner [Fri, 28 Oct 2016 17:41:42 +0000 (19:41 +0200)] 
conf/ile: get ip prefix via lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotests: add unit tests for lxc_safe_int()
Christian Brauner [Wed, 7 Sep 2016 15:51:33 +0000 (17:51 +0200)] 
tests: add unit tests for lxc_safe_int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: add lxc_safe_int()
Christian Brauner [Wed, 7 Sep 2016 15:47:50 +0000 (17:47 +0200)] 
utils: add lxc_safe_int()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agotests: add unit tests for lxc_safe_uint()
Christian Brauner [Tue, 6 Sep 2016 15:41:34 +0000 (17:41 +0200)] 
tests: add unit tests for lxc_safe_uint()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: add lxc_safe_uint()
Christian Brauner [Tue, 6 Sep 2016 15:32:47 +0000 (17:32 +0200)] 
utils: add lxc_safe_uint()

This function safely parses an unsigned integer. On success it returns 0 and
stores the unsigned integer in @converted. On error it returns a negative
errno.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1309 from brauner/2016-11-21/cgfsng_improve_isolcpus_handling
Serge Hallyn [Mon, 21 Nov 2016 23:57:05 +0000 (17:57 -0600)] 
Merge pull request #1309 from brauner/2016-11-21/cgfsng_improve_isolcpus_handling

cgroup: improve isolcpus handling

8 years agocgroups: handle non-existent isolcpus file 1309/head
Christian Brauner [Mon, 21 Nov 2016 21:31:39 +0000 (22:31 +0100)] 
cgroups: handle non-existent isolcpus file

If the file "/sys/devices/system/cpu/isolated" doesn't exist, we can't just
simply bail. We still need to check whether we need to copy the parents cpu
settings.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agocgroup: improve isolcpus handling
Christian Brauner [Mon, 21 Nov 2016 17:11:32 +0000 (18:11 +0100)] 
cgroup: improve isolcpus handling

- add more logging
- only write to cpuset.cpus if we really have to
- simplify cleanup on error and success

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1308 from brauner/2016-11-20/use_ns_info_struct
Stéphane Graber [Sun, 20 Nov 2016 06:11:24 +0000 (01:11 -0500)] 
Merge pull request #1308 from brauner/2016-11-20/use_ns_info_struct

use ns info struct and always attach to user namespace first

8 years agonamespace: always attach to user namespace first 1308/head
Christian Brauner [Sun, 20 Nov 2016 05:20:07 +0000 (06:20 +0100)] 
namespace: always attach to user namespace first

Move the user namespace at the first position in the array so that we always
attach to it first when iterating over the struct and using setns() to switch
namespaces. This especially affects lxc_attach(): Suppose you cloned a new user
namespace and mount namespace as an unprivileged user on the host and want to
setns() to the mount namespace. This requires you to attach to the user
namespace first otherwise the kernel will fail this check:

    if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) ||
        !ns_capable(current_user_ns(), CAP_SYS_CHROOT) ||
        !ns_capable(current_user_ns(), CAP_SYS_ADMIN))
     return -EPERM;

in

    linux/fs/namespace.c:mntns_install().

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoattach: use ns_info[LXC_NS_MAX] struct
Christian Brauner [Sun, 20 Nov 2016 05:17:53 +0000 (06:17 +0100)] 
attach: use ns_info[LXC_NS_MAX] struct

Using custom structs in attach.c risks getting out of sync with the commonly
used ns_info[LXC_NS_MAX] struct and thus attaching to wrong namespaces. Switch
to using ns_info[LXC_NS_MAX].

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1255 from brauner/2016-10-27/cleanup_netdevs_lxd#2439_lxc#1253
Serge Hallyn [Sat, 19 Nov 2016 18:17:11 +0000 (12:17 -0600)] 
Merge pull request #1255 from brauner/2016-10-27/cleanup_netdevs_lxd#2439_lxc#1253

remove veth device from host

8 years agoattach, utils: bugfixes 1255/head
Christian Brauner [Sat, 19 Nov 2016 04:45:01 +0000 (05:45 +0100)] 
attach, utils: bugfixes

- simply check /proc/self/ns
- improve SYSERROR() report
- use #define to prevent gcc & clang to use a VLA

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agostart, namespace: move ns_info to namespace.{c,h}
Christian Brauner [Mon, 31 Oct 2016 14:54:42 +0000 (15:54 +0100)] 
start, namespace: move ns_info to namespace.{c,h}

It's much more appropriate there and makes start.{c,h} cleaner and leaner.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agostart, error: improve log + non-functional changes
Christian Brauner [Sat, 29 Oct 2016 15:27:49 +0000 (17:27 +0200)] 
start, error: improve log + non-functional changes

Improve log and comments in a bunch of places to make it easier for us on bug
reports.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agostart, utils: improve preserve_ns()
Christian Brauner [Sat, 29 Oct 2016 14:58:48 +0000 (16:58 +0200)] 
start, utils: improve preserve_ns()

- Allocating an error message that the caller must free seems pointless. We can
  just print the error message in preserve_ns() itself. This also allows us to
  avoid using the GNU extension asprintf().
- Improve lxc_preserve_ns(): By passing in NULL or "" as the second argument
  the function can now also be used to check whether namespaces are supported
  by the kernel.
- Use lxc_preserve_ns() in preserve_ns().

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf, start: be smarter when deleting networks
Christian Brauner [Fri, 28 Oct 2016 11:40:44 +0000 (13:40 +0200)] 
conf, start: be smarter when deleting networks

- So far we blindly called lxc_delete_network() to make sure that we deleted
  all network interfaces. This resulted in pointless netlink calls, especially
  when a container had multiple networks defined. Let's be smarter and have
  lxc_delete_network() return a boolean that indicates whether *all* configured
  networks have been deleted. If so, don't needlessly try to delete them again
  in start.c. This also decreases confusing error messages a user might see.

- When we receive -ENODEV from one of our lxc_netdev_delete_*() functions,
  let's assume that either the network device already got deleted or that it
  got moved to a different network namespace. Inform the user about this but do
  not report an error in this case.

- When we have explicitly deleted the host side of a veth pair let's
  immediately free(priv.veth_attr.pair) and NULL it, or
  memset(priv.veth_attr.pair, ...) the corresponding member so we don't
  needlessly try to destroy them again when we have to call
  lxc_delete_network() again in start.c

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf: explicitly remove veth device from host
Christian Brauner [Thu, 27 Oct 2016 12:41:49 +0000 (14:41 +0200)] 
conf: explicitly remove veth device from host

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf, start: improve log output
Christian Brauner [Thu, 27 Oct 2016 19:09:27 +0000 (21:09 +0200)] 
conf, start: improve log output

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agolxc_user_nic: use lxc_preserve_ns()
Christian Brauner [Fri, 28 Oct 2016 08:48:20 +0000 (10:48 +0200)] 
lxc_user_nic: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoattach: use lxc_preserve_ns()
Christian Brauner [Fri, 28 Oct 2016 10:33:30 +0000 (12:33 +0200)] 
attach: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoconf: use lxc_preserve_ns()
Christian Brauner [Thu, 27 Oct 2016 12:39:45 +0000 (14:39 +0200)] 
conf: use lxc_preserve_ns()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agostart: add netnsfd to lxc_handler
Christian Brauner [Thu, 27 Oct 2016 12:35:26 +0000 (14:35 +0200)] 
start: add netnsfd to lxc_handler

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: add lxc_preserve_ns()
Christian Brauner [Thu, 27 Oct 2016 12:37:24 +0000 (14:37 +0200)] 
utils: add lxc_preserve_ns()

This allows to retrieve a file descriptor referring to a namespace.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1305 from brauner/2016-11-16/cgfsng_debug
Stéphane Graber [Thu, 17 Nov 2016 16:48:06 +0000 (09:48 -0700)] 
Merge pull request #1305 from brauner/2016-11-16/cgfsng_debug

cgroups: prevent segfault in cgfsng

8 years agocgroups: prevent segfault in cgfsng 1305/head
Christian Brauner [Wed, 16 Nov 2016 15:43:20 +0000 (16:43 +0100)] 
cgroups: prevent segfault in cgfsng

When we set LXC_DEBUG_CGFSNG=1 we print out info about detected cgroup
hierarchies. When there's no named cgroup mounted we need to make sure that we
don't try to index an unallocated pointer.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1303 from adrianreber/master
Christian Brauner [Thu, 17 Nov 2016 02:00:19 +0000 (21:00 -0500)] 
Merge pull request #1303 from adrianreber/master

lxc-checkpoint: automatically detect if --external or --veth-pair

8 years agolxc-checkpoint: automatically detect if --external or --veth-pair 1303/head
Adrian Reber [Tue, 15 Nov 2016 15:47:31 +0000 (15:47 +0000)] 
lxc-checkpoint: automatically detect if --external or --veth-pair

With the criu release 2.8 criu deprecated the --veth-pair command-line
option in favor of --external:

f2037e6 veth: Make --external support --veth-pair

git tag --contains f2037e6d3445fc400
v2.8

With this commit lxc-checkpoint will automatically switch between
the new and old command-line option dependent on the detected
criu version.

For criu version older than 2.8 something like this will be used:

  --veth-pair eth0=vethYOK6RW@lxcbr0

and starting with criu version 2.8 it will look like this:

  --external veth[eth0]:vethCRPEYL@lxcbr0

Signed-off-by: Adrian Reber <areber@redhat.com>
8 years agoMerge pull request #1301 from brauner/2016-11-15/isolcpus
Stéphane Graber [Tue, 15 Nov 2016 16:03:21 +0000 (09:03 -0700)] 
Merge pull request #1301 from brauner/2016-11-15/isolcpus

cgroups: use %zu format specifier to print size_t

8 years agoMerge pull request #1299 from adrianreber/master
Stéphane Graber [Tue, 15 Nov 2016 15:56:55 +0000 (08:56 -0700)] 
Merge pull request #1299 from adrianreber/master

lxc-checkpoint: enable dirty memory tracking in criu

8 years agolxc-checkpoint: enable dirty memory tracking in criu 1299/head
Adrian Reber [Mon, 14 Nov 2016 14:44:04 +0000 (14:44 +0000)] 
lxc-checkpoint: enable dirty memory tracking in criu

CRIU supports dirty memory tracking to take incremental checkpoints.
Incremental checkpoints are one way of reducing downtime during
migration. The first checkpoint dumps all the memory pages and the
second (and third, and fourth, ...) only dumps pages which have changed.

Most of the necessary code has already been implemented. This just adds
the existing functionality to lxc-checkpoint:

  -p, --pre-dump            Only pre-dump the memory of the container.
                            Container keeps on running and following
                            checkpoints will only dump the changes.
  --predump-dir=DIR         path to images from previous dump (relative to -D)

The following is an example from a container running CentOS 7 with psql
and tomcat:

 # lxc-checkpoint -n c7 -D /tmp/cp -p
Container keeps on running
 # du -h /tmp/cp
 229M /tmp/cp
Sync initial checkpoint to destination
 # rsync -a /tmp/cp host2:/tmp/
Sync file-system
 # rsync -a /var/lib/lxc/c7 host2:/var/lib/lxc/
Final dump; container is stopped
 # lxc-checkpoint -n c7 -D /tmp/cp --predump-dir=../cp -s
 # du -h /tmp/cp2
 90M /tmp/cp2

After transferring the second (incremental checkpoint) and the changes
to the container's file system the container can be restored on the
second host by pointing lxc-checkpoint to the second checkpoint
directory:

 # lxc-checkpoint -n c7 -D /tmp/cp2 -r

Signed-off-by: Adrian Reber <areber@redhat.com>
8 years agocgroups: use %zu format specifier to print size_t 1301/head
Christian Brauner [Tue, 15 Nov 2016 05:19:55 +0000 (06:19 +0100)] 
cgroups: use %zu format specifier to print size_t

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1282 from brauner/2016-11-03/isolcpus
Serge Hallyn [Mon, 14 Nov 2016 19:53:56 +0000 (13:53 -0600)] 
Merge pull request #1282 from brauner/2016-11-03/isolcpus

cgroups: remove isolated cpus from cpuset.cpus  …

8 years agoMerge pull request #1300 from stgraber/master
Serge Hallyn [Mon, 14 Nov 2016 17:17:52 +0000 (11:17 -0600)] 
Merge pull request #1300 from stgraber/master

debian: Don't depend on libui-dialog-perl

8 years agodebian: Don't depend on libui-dialog-perl 1300/head
Stéphane Graber [Mon, 14 Nov 2016 16:53:07 +0000 (11:53 -0500)] 
debian: Don't depend on libui-dialog-perl

This package doesn't exist in stretch anymore, and it's unclear why we
were depending on a library to begin with (as opposed to having it
brought by whatever needs it).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #1297 from brauner/2016-11-13/fix_tmpfile_errno
Serge Hallyn [Mon, 14 Nov 2016 06:33:40 +0000 (00:33 -0600)] 
Merge pull request #1297 from brauner/2016-11-13/fix_tmpfile_errno

conf: do not use %m format specifier

8 years agoconf: do not use %m format specifier 1297/head
Christian Brauner [Sun, 13 Nov 2016 16:10:41 +0000 (17:10 +0100)] 
conf: do not use %m format specifier

This is a GNU extension and some libcs might be missing it.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1293 from evgeni/always-stop-lxc-net
Christian Brauner [Sat, 12 Nov 2016 16:13:25 +0000 (11:13 -0500)] 
Merge pull request #1293 from evgeni/always-stop-lxc-net

also stop lxc-net in runlevels 0 and 6

8 years agoMerge pull request #1294 from evgeni/ignore-lxc.egg-info
Christian Brauner [Sat, 12 Nov 2016 16:13:18 +0000 (11:13 -0500)] 
Merge pull request #1294 from evgeni/ignore-lxc.egg-info

add lxc.egg-info to gitignore

8 years agoMerge pull request #1295 from evgeni/bash-completion-pkg-config
Christian Brauner [Sat, 12 Nov 2016 16:13:10 +0000 (11:13 -0500)] 
Merge pull request #1295 from evgeni/bash-completion-pkg-config

install bash completion where pkg-config tells us to

8 years agoinstall bash completion where pkg-config tells us to 1295/head
Evgeni Golov [Sat, 12 Nov 2016 13:44:40 +0000 (14:44 +0100)] 
install bash completion where pkg-config tells us to

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agoadd lxc.egg-info to gitignore 1294/head
Evgeni Golov [Sat, 12 Nov 2016 13:47:33 +0000 (14:47 +0100)] 
add lxc.egg-info to gitignore

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agoalso stop lxc-net in runlevels 0 and 6 1293/head
Evgeni Golov [Sat, 12 Nov 2016 11:29:26 +0000 (12:29 +0100)] 
also stop lxc-net in runlevels 0 and 6

there is no reason to not do this :)

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agoMerge pull request #1290 from brauner/2016-11-09/named_controllers
Serge Hallyn [Fri, 11 Nov 2016 02:40:23 +0000 (20:40 -0600)] 
Merge pull request #1290 from brauner/2016-11-09/named_controllers

cgroups: skip v2 hierarchy entry

8 years agocgroups: skip v2 hierarchy entry 1290/head
Christian Brauner [Thu, 10 Nov 2016 23:29:15 +0000 (00:29 +0100)] 
cgroups: skip v2 hierarchy entry

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1289 from Cypresslin/ubuntu-cloud-squashfs
Christian Brauner [Thu, 10 Nov 2016 14:29:23 +0000 (09:29 -0500)] 
Merge pull request #1289 from Cypresslin/ubuntu-cloud-squashfs

templates: add squashfs support to lxc-ubuntu-cloud.in

8 years agotemplates: add squashfs support to lxc-ubuntu-cloud.in 1289/head
Po-Hsu Lin [Thu, 10 Nov 2016 08:48:29 +0000 (16:48 +0800)] 
templates: add squashfs support to lxc-ubuntu-cloud.in

Add squashfs format file support for lxc-ubuntu-cloud.in

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
8 years agoMerge pull request #1288 from Cypresslin/known-release-zesty
Christian Brauner [Thu, 10 Nov 2016 05:22:05 +0000 (00:22 -0500)] 
Merge pull request #1288 from Cypresslin/known-release-zesty

Update Ubuntu release name: add zesty

8 years agoUpdate Ubuntu release name: add zesty and remove wily 1288/head
Po-Hsu Lin [Wed, 9 Nov 2016 11:13:28 +0000 (19:13 +0800)] 
Update Ubuntu release name: add zesty and remove wily

Add zesty to KNOWN_RELEASES
Remove EOL wily from KNOWN_RELEASES

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
8 years agocgroups: remove isolated cpus from cpuset.cpus 1282/head
Christian Brauner [Sun, 6 Nov 2016 18:50:54 +0000 (19:50 +0100)] 
cgroups: remove isolated cpus from cpuset.cpus

In case the system was booted with

    isolcpus=n_i-n_j,n_k,n_m

we cannot simply copy the cpuset.cpus file from our parent cgroup. For example,
in the root cgroup cpuset.cpus will contain all of the cpus including the
isolated cpus. Copying the values of the root cgroup into a child cgroup will
lead to a wrong view in /proc/self/status: For the root cgroup
/sys/fs/cgroup/cpuset /proc/self/status will correctly show

    Cpus_allowed_list:      0-1,3

even though cpuset.cpus will show

    0-3

However, initializing a subcgroup in the cpuset controller by copying the
cpuset.cpus setting from the root cgroup will cause /proc/self/status to
incorrectly show

    Cpus_allowed_list:      0-3

Hence, we need to make sure to remove the isolated cpus from cpuset.cpus. Seth
has argued that this is not a kernel bug but by design. So let us be the smart
guys and fix this in liblxc.

The solution is straightforward: To avoid having to work with raw cpulist
strings we create cpumasks based on uint32_t bit arrays.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoutils: add lxc_append_string()
Christian Brauner [Sun, 6 Nov 2016 18:48:58 +0000 (19:48 +0100)] 
utils: add lxc_append_string()

lxc_append_string() appends strings without separator. This is mostly useful
for reading in whole files line-by-line.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1286 from mgariepy/patch-1
Stéphane Graber [Wed, 9 Nov 2016 12:18:11 +0000 (05:18 -0700)] 
Merge pull request #1286 from mgariepy/patch-1

create symlink for /var/run

8 years agocreate symlink for /var/run 1286/head
mgariepy [Tue, 8 Nov 2016 16:42:34 +0000 (11:42 -0500)] 
create symlink for /var/run

this patch create /var/run link to point to /run.

This will fix various issue present when /var/run is persistent.

Signed-off-by: Marc Gariepy <gariepy.marc@gmail.com>
8 years agoMerge pull request #1262 from brauner/2016-10-29/lxc_free_cgroup_sigsegv
Serge Hallyn [Mon, 7 Nov 2016 17:09:06 +0000 (10:09 -0700)] 
Merge pull request #1262 from brauner/2016-10-29/lxc_free_cgroup_sigsegv

cgfs: various fixes

8 years agoMerge pull request #1275 from brauner/2016-11-04/unshare_cgroup_after_clone
Stéphane Graber [Thu, 3 Nov 2016 21:27:37 +0000 (15:27 -0600)] 
Merge pull request #1275 from brauner/2016-11-04/unshare_cgroup_after_clone

start: CLONE_NEWCGROUP after we have setup cgroups

8 years agostart: CLONE_NEWCGROUP after we have setup cgroups 1275/head
Christian Brauner [Thu, 3 Nov 2016 20:24:31 +0000 (21:24 +0100)] 
start: CLONE_NEWCGROUP after we have setup cgroups

If we do it earlier we end up with a wrong view of /proc/self/cgroup. For
example, assume we unshare(CLONE_NEWCGROUP) first, and then create the cgroup
for the container, say /sys/fs/cgroup/cpuset/lxc/c, then /proc/self/cgroup
would show us:

     8:cpuset:/lxc/c

whereas it should actually show

     8:cpuset:/

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1274 from tych0/check-state-before-checkpoint
Christian Brauner [Thu, 3 Nov 2016 20:38:42 +0000 (14:38 -0600)] 
Merge pull request #1274 from tych0/check-state-before-checkpoint

c/r: check state before doing a checkpoint/restore

8 years agoc/r: check state before doing a checkpoint/restore 1274/head
Tycho Andersen [Thu, 3 Nov 2016 18:01:09 +0000 (12:01 -0600)] 
c/r: check state before doing a checkpoint/restore

This would already fail, but with a not-as-good error message. Let's make
the error better.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoMerge pull request #1273 from Blub/trivial/bin-bash-consistency
Christian Brauner [Thu, 3 Nov 2016 12:54:06 +0000 (06:54 -0600)] 
Merge pull request #1273 from Blub/trivial/bin-bash-consistency

cleanup: /usr/bin/bash vs /bin/bash consistency

8 years agocleanup: /usr/bin/bash vs /bin/bash consistency 1273/head
Wolfgang Bumiller [Thu, 3 Nov 2016 08:07:05 +0000 (09:07 +0100)] 
cleanup: /usr/bin/bash vs /bin/bash consistency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 years agoMerge pull request #1058 from hallyn/2016-06-24/eric.cgns
Christian Brauner [Thu, 3 Nov 2016 01:56:28 +0000 (19:56 -0600)] 
Merge pull request #1058 from hallyn/2016-06-24/eric.cgns

container start: clone newcgroup immediately

8 years agoMerge pull request #1269 from Blub/phynet-rename-2
Christian Brauner [Wed, 2 Nov 2016 20:05:33 +0000 (14:05 -0600)] 
Merge pull request #1269 from Blub/phynet-rename-2

conf: merge network namespace move & rename on shutdown

8 years agoMerge pull request #1270 from tych0/save-dump-state-too
Christian Brauner [Wed, 2 Nov 2016 18:05:15 +0000 (12:05 -0600)] 
Merge pull request #1270 from tych0/save-dump-state-too

c/r: save dump stdout too

8 years agoc/r: fix off-by-one error 1270/head
Tycho Andersen [Wed, 2 Nov 2016 15:59:00 +0000 (15:59 +0000)] 
c/r: fix off-by-one error

When we read sizeof(buf) bytes here, we'd write off the end of the array,
which is bad :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoc/r: remove extra \ns from logs
Tycho Andersen [Wed, 2 Nov 2016 15:10:13 +0000 (15:10 +0000)] 
c/r: remove extra \ns from logs

The macros put a \n in for us, so let's not put another one in.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoc/r: save criu's stdout during dump too
Tycho Andersen [Tue, 1 Nov 2016 23:07:26 +0000 (17:07 -0600)] 
c/r: save criu's stdout during dump too

This also allows us to commonize some bits of the dup2 code.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoconf: merge network namespace move & rename on shutdown 1269/head
Wolfgang Bumiller [Wed, 17 Aug 2016 09:36:39 +0000 (11:36 +0200)] 
conf: merge network namespace move & rename on shutdown

On shutdown we move physical network interfaces back to the
host namespace and rename them afterwards as well as in the
later lxc_network_delete() step. However, if the device had
a name which already exists in the host namespace then the
moving fails and so do the subsequent rename attempts. When
the namespace ceases to exist the devices finally end up
in the host namespace named 'dev<ID>' by the kernel.

In order to avoid this, we do the moving and renaming in a
single step (lxc_netdev_move_by_*()'s move & rename happen
in a single netlink transaction).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 years agoMerge pull request #1266 from tych0/do-mount-rewriting
Stéphane Graber [Mon, 31 Oct 2016 21:34:57 +0000 (17:34 -0400)] 
Merge pull request #1266 from tych0/do-mount-rewriting

Do mount rewriting

8 years agolog: bump LXC_LOG_BUFFER_SIZE to 4096 1266/head
Tycho Andersen [Mon, 31 Oct 2016 19:48:38 +0000 (19:48 +0000)] 
log: bump LXC_LOG_BUFFER_SIZE to 4096

We need to log longer lines due to CRIU arguments.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoc/r: explicitly emit bind mounts as criu arguments
Tycho Andersen [Mon, 31 Oct 2016 16:07:25 +0000 (10:07 -0600)] 
c/r: explicitly emit bind mounts as criu arguments

We switched to --ext-mount-map auto because of "system" (liblxc) added
mounts like the cgmanager socket that weren't in the config file. This had
the added advantage that we could drop all the mount processing code,
because we no longer needed an --ext-mount-map argument.

The problem here is that mounts can move between hosts. While
--ext-mount-map auto does its best to detect this situation, it explicitly
disallows moves that change the path name. In LXD, we bind mount
/var/lib/lxd/shmounts/$container to /dev/.lxd-mounts for each container,
and so when a container is renamed in a migration, the name changes.
--ext-mount-map auto won't detect this, and so the migration fails.

We *could* implement mount rewriting in CRIU, but my experience with cgroup
and apparmor rewriting is that this is painful and error prone. Instead, it
is much easier to go back to explicitly listing --ext-mount-map arguments
from the config file, and allow the source of the bind to change. We leave
--ext-mount-map auto to catch any stragling (or future) system added
mounts.

I believe this should fix Launchpad Bug 1580765

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>