]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
9 years agochange version to 2.0.4 in configure.ac lxc-2.0.4
Stéphane Graber [Tue, 16 Aug 2016 02:37:38 +0000 (22:37 -0400)] 
change version to 2.0.4 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoautotools: fix tests
Christian Brauner [Mon, 15 Aug 2016 23:42:38 +0000 (01:42 +0200)] 
autotools: fix tests

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotests: add unit tests for lxc_string_in_array()
Christian Brauner [Sun, 14 Aug 2016 20:42:17 +0000 (22:42 +0200)] 
tests: add unit tests for lxc_string_in_array()

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotests: add unit tests for lxc_string_replace()
Christian Brauner [Sat, 13 Aug 2016 20:38:52 +0000 (22:38 +0200)] 
tests: add unit tests for lxc_string_replace()

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotools: add missing newline in lxc-create output
Christian Brauner [Sat, 13 Aug 2016 14:04:44 +0000 (16:04 +0200)] 
tools: add missing newline in lxc-create output

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotools: use correct runtime path for lxc-ls
Christian Brauner [Fri, 12 Aug 2016 22:56:33 +0000 (00:56 +0200)] 
tools: use correct runtime path for lxc-ls

So far we've simply been using RUNTIME_PATH for the privileged and unprivileged
case. We should actually use XDG_RUNTIME_DIR for the unprivileged case.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agobdev: be smarter about btrfs subvolume detection
Christian Brauner [Fri, 12 Aug 2016 19:07:34 +0000 (21:07 +0200)] 
bdev: be smarter about btrfs subvolume detection

When a container c is on a btrfs filesystem but is directory backed, copying
the container will default to snapshot. This is because of
should_default_to_snapshot() returning true in this case because c is on a
btrfs filesystem. We should make sure that should_default_to_snapshot() only
returns true, when c itself is a btrfs subvolume.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agodoc: Update Japanese lxc-attach(1)
KATOH Yasufumi [Fri, 12 Aug 2016 08:29:55 +0000 (17:29 +0900)] 
doc: Update Japanese lxc-attach(1)

* Add undocumented options (-v/--set-var, --keep-var, -f/--rcfile)
* Change order of option in SYNOPSIS (-L that is placed after "command")
* Add long options in SYNOPSIS

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
9 years agodoc: Update lxc-attach(1)
KATOH Yasufumi [Fri, 12 Aug 2016 08:04:15 +0000 (17:04 +0900)] 
doc: Update lxc-attach(1)

* Add undocumented options (-v/--set-var, --keep-var, -f/--rcfile)
* Change order of option in SYNOPSIS (-L that is placed after "command")
* Add long options in SYNOPSIS

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
9 years agotemplates: make shellcheck (Ubuntu: 0.3.7-5 amd64) most possible happy
Andreas Freudenberg [Fri, 15 Jul 2016 14:59:01 +0000 (16:59 +0200)] 
templates: make shellcheck (Ubuntu: 0.3.7-5 amd64) most possible happy

Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
9 years agotemplates: add more quotes to variables (at least $rootfs should now be covered)
Andreas Freudenberg [Tue, 12 Jul 2016 15:53:08 +0000 (17:53 +0200)] 
templates: add more quotes to variables (at least $rootfs should now be covered)

Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
9 years agotree-wide: replace readdir_r() with readdir()
Christian Brauner [Tue, 9 Aug 2016 19:05:19 +0000 (21:05 +0200)] 
tree-wide: replace readdir_r() with readdir()

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotemplates: add support for new arch on Alpine Linux
Carlo Landmeter [Sun, 7 Aug 2016 09:21:05 +0000 (09:21 +0000)] 
templates: add support for new arch on Alpine Linux

Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
9 years agowhitespace cleanup
Wolfgang Bumiller [Thu, 4 Aug 2016 09:28:37 +0000 (11:28 +0200)] 
whitespace cleanup

The rest of this block uses spaces instead of tabs already.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 years agoadd -f option to lxc-attach
Wolfgang Bumiller [Thu, 4 Aug 2016 09:23:54 +0000 (11:23 +0200)] 
add -f option to lxc-attach

Otherwise a container with a non-standard configuration file
can be started but not attached to.
Fixes the following case:
 # lxc-start -n ct -f /different/path/my.config
 # lxc-attach -n ct
 Error: container ct is not defined

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 years agotools, tests: reorganize repo
Christian Brauner [Sun, 31 Jul 2016 10:40:49 +0000 (12:40 +0200)] 
tools, tests: reorganize repo

- tools: move lxc commands to common subfolder
- tests: adapt include search path

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agocgroups: move cgroup files to common subfolder
Christian Brauner [Sun, 31 Jul 2016 10:21:58 +0000 (12:21 +0200)] 
cgroups: move cgroup files to common subfolder

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agobdev: add subdirectories to search path
Christian Brauner [Sun, 31 Jul 2016 10:04:28 +0000 (12:04 +0200)] 
bdev: add subdirectories to search path

This allows us to avoid using relative includes which is cleaner in the long
run when we create subdirectories for other components of liblxc.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agocriu: replace tmpnam() with mkstemp()
Christian Brauner [Thu, 28 Jul 2016 22:53:53 +0000 (00:53 +0200)] 
criu: replace tmpnam() with mkstemp()

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agoconf: set pty_info to NULL after free
Wolfgang Bumiller [Thu, 28 Jul 2016 09:52:18 +0000 (11:52 +0200)] 
conf: set pty_info to NULL after free

This fixes a double free corruption on container-requested
reboots when lxc_spawn() fails before receiving the ttys, as
lxc_fini() (part of __lxc_start()'s cleanup) calls
lxc_delete_tty().

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 years agoattach: setns instead of unshare in lxc-attach
oc [Wed, 27 Jul 2016 14:43:58 +0000 (22:43 +0800)] 
attach: setns instead of unshare in lxc-attach

lxc-checkpoint will fail because process createdy by lxc-attach has
incorrect cgroup ns. It needs to use "setns" instead of "unshare"
to set cgroup ns.

Signed-off-by: Chen Haiquan <oc@yunify.com>
9 years agoAdd a prefix to the lxc.pc
Sergio Schvezov [Tue, 26 Jul 2016 07:41:47 +0000 (09:41 +0200)] 
Add a prefix to the lxc.pc

This allows installing to different locations and using
the lxc.pc to build using the generated includedir and
libdir.

Signed-off-by: Sergio Schvezov <sergio.schvezov@ubuntu.com>
9 years agocgfsng: fix is_lxcfs() and is_cgroupfs()
Christian Brauner [Mon, 25 Jul 2016 15:10:47 +0000 (17:10 +0200)] 
cgfsng: fix is_lxcfs() and is_cgroupfs()

Both functions advertise that they return true when strncmp() == 0 and false
when strncmp() != 0 but so far they returned the exact opposite.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agolxc-alpine: mount tmpfs under /run
Jakub Jirutka [Sat, 23 Jul 2016 17:57:36 +0000 (19:57 +0200)] 
lxc-alpine: mount tmpfs under /run

When running under grsecurity kernel or userns, it can't be mounted from inside.

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
9 years agoc/r: use PRIu64 format specifier
Christian Brauner [Fri, 22 Jul 2016 09:14:24 +0000 (11:14 +0200)] 
c/r: use PRIu64 format specifier

Fixes build failures on arm:

criu.c: In function ‘exec_criu’:
criu.c:310:4: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
    ret = sprintf(ghost_limit, "%lu", opts->user->ghost_limit);
    ^
In file included from criu.c:42:0:
log.h:285:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
criu.c:312:5: note: in expansion of macro ‘ERROR’
     ERROR("failed to print ghost limit %lu", opts->user->ghost_limit);
     ^

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agotemplates: avoid noisy perl warnings caused by missing locales
Andreas Freudenberg [Tue, 12 Jul 2016 15:51:06 +0000 (17:51 +0200)] 
templates: avoid noisy perl warnings caused by missing locales

Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
9 years agoc/r: add support for ghost-limit in CRIU
Tycho Andersen [Tue, 19 Jul 2016 20:27:26 +0000 (14:27 -0600)] 
c/r: add support for ghost-limit in CRIU

This is an old option that we probably should have exposed long ago :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agolxccontainer: detect if we should send SIGRTMIN+3
Christian Brauner [Mon, 18 Jul 2016 20:21:56 +0000 (22:21 +0200)] 
lxccontainer: detect if we should send SIGRTMIN+3

This is required by systemd to cleanly shutdown. Other init systems should not
have SIGRTMIN+3 in the blocked signals set.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agoSet up MTU for vlan-type interfaces.
Vitaly Lavrov [Thu, 30 Jun 2016 17:04:49 +0000 (20:04 +0300)] 
Set up MTU for vlan-type interfaces.

Signed-off-by: Vitaly Lavrov <vel21ripn@gmail.com>
9 years agoc/r: make local function static
Adrian Reber [Fri, 15 Jul 2016 08:54:30 +0000 (10:54 +0200)] 
c/r: make local function static

This is a minimal commit which makes the function 'do_restore()' static
as it is not used anywhere else in the code. This also removes a
trailing space my editor complained about.

Signed-off-by: Adrian Reber <areber@redhat.com>
9 years agoc/r: drop in-flight connections during CRIU dump
Adrian Reber [Mon, 4 Jul 2016 14:58:09 +0000 (16:58 +0200)] 
c/r: drop in-flight connections during CRIU dump

Shortly after CRIU 2.3 has been released a patch has been added to skip
in-flight TCP connections. In-flight connections are not completely
established connections (SYN, SYN-ACK). Skipping in-flight TCP
connections means that the client has to re-initiate the connection
establishment.

This patch stores the CRIU version detected during version check, so
that during dump/checkpoint options can be dynamically enabled depending
on the available CRIU version.

v2:
   * use the newly introduced criu version interface
   * add an option to disable skipping in-flight connections

Signed-off-by: Adrian Reber <areber@redhat.com>
9 years agoadd missing cgroup namespace to ns_info struct
Christian Brauner [Mon, 11 Jul 2016 20:48:48 +0000 (22:48 +0200)] 
add missing cgroup namespace to ns_info struct

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agoc/r: initialize migrate_opts properly
Adrian Reber [Mon, 11 Jul 2016 19:55:43 +0000 (21:55 +0200)] 
c/r: initialize migrate_opts properly

The commit "c/r: add support for CRIU's --action-script" breaks
lxc-checkpoint on the command-line. It produces errors like:

 sh: $'\260\366\b\001': command not found

and then it fails. src/lxc/criu.c expects migrate_opts->action_script to
be either NULL, then it is ignored, or to actually contain the name of
an action scripts.

As the struct migrate_opts has not static storage is has to be explicitly
initialized or the value of the structure's members is indeterminate.

Signed-off-by: Adrian Reber <areber@redhat.com>
9 years agoc/r: add support for CRIU's --action-script
Tycho Andersen [Wed, 6 Jul 2016 23:45:15 +0000 (23:45 +0000)] 
c/r: add support for CRIU's --action-script

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agostore criu version
Christian Brauner [Tue, 5 Jul 2016 14:52:21 +0000 (16:52 +0200)] 
store criu version

- If version != NULL criu_version_ok() stores the detected criu version in
  version. Allocates memory for version which must be freed by caller.
- If version == NULL criu_version_ok() will return true when the version
  matches, false in all other cases.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
9 years agocgfsng: don't pre-calculate path
Serge Hallyn [Sat, 2 Jul 2016 02:18:38 +0000 (21:18 -0500)] 
cgfsng: don't pre-calculate path

First, we're doing this so long a there is any cgroup config item -
even if no devices ones.  Then if devices is not available we fail.
This was leading to Rob E's mysterious startup failures.

Secondly, we're not even using this info.  The user was removed
awhile back.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
9 years agoAdd flag in mount_entry to skip NODEV in case of a persistent dev entry
Rodrigo Vaz [Sat, 2 Jul 2016 01:34:11 +0000 (18:34 -0700)] 
Add flag in mount_entry to skip NODEV in case of a persistent dev entry

Signed-off-by: Rodrigo Vaz <rodrigo@heroku.com>
9 years agoFix typo found by lintian
Stéphane Graber [Wed, 29 Jun 2016 20:56:41 +0000 (16:56 -0400)] 
Fix typo found by lintian

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-debian: fix regression when creating wheezy containers
Antonio Terceiro [Wed, 29 Jun 2016 17:58:35 +0000 (14:58 -0300)] 
lxc-debian: fix regression when creating wheezy containers

The regression was introduced by commit
3c39b0b7a2b445e08d2e2aecb05566075f4f3423 which makes it possible to
create working stretch containers by forcinig `init` to be in the
included package list.

However, `init` didn't exit before jessie, so now for wheezy we
explicitly include `sysvinit`; sysvinit on wheezy is essential,
so it would already be included anyway.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
9 years agochange version to 2.0.3 in configure.ac lxc-2.0.3
Stéphane Graber [Tue, 28 Jun 2016 19:38:30 +0000 (15:38 -0400)] 
change version to 2.0.3 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoapparmor: Refresh generated file
Stéphane Graber [Tue, 28 Jun 2016 19:35:58 +0000 (15:35 -0400)] 
apparmor: Refresh generated file

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agochange version to 2.0.2 in configure.ac lxc-2.0.2
Stéphane Graber [Tue, 28 Jun 2016 18:17:55 +0000 (14:17 -0400)] 
change version to 2.0.2 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoInclude all lxcmntent.h function declarations on Bionic
Preetam D'Souza [Tue, 28 Jun 2016 03:12:12 +0000 (23:12 -0400)] 
Include all lxcmntent.h function declarations on Bionic

Newer versions of Android (5.0+, aka API Level 21+) include mntent.h,
which declares setmntent and endmntent. This hits an edge
case with the preprocessor checks in lxcmntent.h because HAVE_SETMNTENT
and HAVE_ENDMNTENT are both defined (in Bionic's mntent.h), but conf.c
always includes lxcmntent.h on Bionic! As a result, we get compiler
warnings of implicit function declarations for setmntent endmntent.

This patch always includes setmntent/endmntent/hasmntopt function
declarations on Bionic, which gets rid of these warnings.

Signed-off-by: Preetam D'Souza <preetamjdsouza@gmail.com>
9 years agoc/r: use criu's "full" mode for cgroups
Tycho Andersen [Mon, 27 Jun 2016 22:24:09 +0000 (22:24 +0000)] 
c/r: use criu's "full" mode for cgroups

A while ago cgroup modes were introduced to CRIU, which slightly changed
the behavior w.r.t. cgroups under the hood. What we're really after is
criu's --full mode, i.e. even if a particular cgroup directory exists
(in particular /lxc/$container[-$number] will, since we create it), we
should restore perms on that cgroup.

Things worked just fine for actual properties (except "special" properties
as criu refers to them, which I've just sent a patch for) because liblxc
creates no subdirectories, just the TLD.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agoAppArmor: add make-rslave to usr.bin.lxc-start
Wolfgang Bumiller [Mon, 27 Jun 2016 20:20:00 +0000 (16:20 -0400)] 
AppArmor: add make-rslave to usr.bin.lxc-start

The profile already contains
  mount options=(rw, make-slave) -> **,

Which allows going through all mountpoints with make-slave,
so it seems to make sense to also allow the directly
recursive variant with "make-rslave".

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoapparmor: Update mount states handling
Stéphane Graber [Mon, 27 Jun 2016 19:15:15 +0000 (15:15 -0400)] 
apparmor: Update mount states handling

Properly list all of the states and the right apparmor stanza for them,
then comment them all as actually enabling this would currently let the
user bypass apparmor entirely.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoapparmor: allow mount move
Stéphane Graber [Mon, 27 Jun 2016 19:11:16 +0000 (15:11 -0400)] 
apparmor: allow mount move

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoForce lxc-instance to behave like a good Upstart client
AnrDaemon [Fri, 24 Jun 2016 03:19:51 +0000 (06:19 +0300)] 
Force lxc-instance to behave like a good Upstart client

Remove unnecessary shell wrap around job start.
Force foreground execution to allow job monitoring and control.

Signed-off-by Andrey Repin <anrdaemon@yandex.ru>

9 years agoapparmor: Allow bind-mounts and {r}shared/{r}private
Stéphane Graber [Thu, 23 Jun 2016 20:01:29 +0000 (16:01 -0400)] 
apparmor: Allow bind-mounts and {r}shared/{r}private

Bind-mounts aren't harmful in containers, so long as they're not used to
bypass MAC policies.

This change allows bind-mounting of any path which isn't a dangerous
filesystem that's otherwise blocked by apparmor.

This also allows switching paths {r}shared or {r}private.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoplamo: Improve Plamo template
KATOH Yasufumi [Tue, 21 Jun 2016 02:06:25 +0000 (11:06 +0900)] 
plamo: Improve Plamo template

* configure to start only the minimum of service
* add ntp, kmod to ignore packages

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
9 years agolxc-debian: make sure init is installed
Antonio Terceiro [Fri, 17 Jun 2016 22:00:56 +0000 (19:00 -0300)] 
lxc-debian: make sure init is installed

init 1.34 is not "Essential" anymore, in order to make it not required
on minimal chroots, docker containers, etc. Because of that we now need
to manually include it on systems that are expected to boot.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
9 years agoUnable to login via console in OL7.2
Thomas Tanaka [Thu, 9 Jun 2016 20:41:02 +0000 (13:41 -0700)] 
Unable to login via console in OL7.2

There is container-getty.service with OL7.2 systemd, it
is also used for managing the getty service, use that
instead and not manually create it.

Signed-off-by: Thomas Tanaka <thomas.tanaka@oracle.com>
9 years agoDrop lxc-devsetup as unneeded by current autodev
Stéphane Graber [Tue, 7 Jun 2016 19:10:24 +0000 (15:10 -0400)] 
Drop lxc-devsetup as unneeded by current autodev

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoMove apt-transport-https to global packages_template
Jesse Pretorius [Fri, 3 Jun 2016 15:33:25 +0000 (16:33 +0100)] 
Move apt-transport-https to global packages_template

In many environments the preference is to configure containers with
apt mirrors that are SSL-secured.

When building containers using the download template this can't be
done unless an insecure mirror is first used to install the
apt-transport-https package, then the sources reconfigured to
use the https URL.

When building containers without using the download template this
can't be done unless the container creator specifically includes
this package in the package list at build time. It seems more
intuitive to me to have the package installed by default.

Commit 396f75abb3d319adc7d871b94b08bc6bb9c49585 added the package
to the minbase variant, but this variant is not used by the download
template build process. The build process instead specifies no
variant, so this patch moves the package from the packages_template
package list in the minbase variant to the global packages_template
package list, ensuring that this package is included in all Ubuntu
build images that use the lxc-ubuntu template.

Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
9 years agostart containers in foreground when using the lxc@.service
Evgeni Golov [Thu, 2 Jun 2016 13:38:47 +0000 (15:38 +0200)] 
start containers in foreground when using the lxc@.service

lxc-start started to default to daemonize the container when starting
this conflicts with type=simple of the systemd unit

call lxc-start with -F and thus force execution in foreground
that way we can feed the log to journald properly and keep type=simple

Debian-Bug: https://bugs.debian.org/826100
Signed-off-by: Evgeni Golov <evgeni@golov.de>
9 years agotravis: ensure 'make install' doesn't fail
Aleksandr Mezin [Fri, 27 May 2016 15:40:13 +0000 (21:40 +0600)] 
travis: ensure 'make install' doesn't fail

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
9 years agotravis: test VPATH builds
Aleksandr Mezin [Fri, 27 May 2016 12:47:23 +0000 (18:47 +0600)] 
travis: test VPATH builds

It looks like VPATH (split source and build directories) builds
are frequently broken. So let's test them on travis-ci.

Personally I use VPATH build in my deployment scripts.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
9 years agoFix redefinition of struct in6_addr
Jörg Krause [Thu, 19 May 2016 19:51:27 +0000 (21:51 +0200)] 
Fix redefinition of struct in6_addr

struct in6_addr is both defined in the C library header <netinet/in.h>
and the Linux kernel header <linux/in6.h>.

lxc_user_nic.c includes both <netinet/in.h> and <linux/if_bridge.h>. The
later one includes <linux/in6.h>.

This breaks build with the musl libc:
  error: redefinition of ‘struct in6_addr’

As lxc_user_nic.c does not use any references from <linux/if_bridge.h> it
is safe to remove this header.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
9 years agochange version to 2.0.1 in configure.ac lxc-2.0.1
Stéphane Graber [Mon, 16 May 2016 20:25:28 +0000 (16:25 -0400)] 
change version to 2.0.1 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFix hostname in interface config for apline template
Andrey Kostin [Wed, 11 May 2016 20:32:40 +0000 (23:32 +0300)] 
Fix hostname in interface config for apline template

Signed-off-by: Andrey Kostin <andrey@kostin.email>
9 years agoAdd apt-transport-https to minbase variant packages_template
Jesse Pretorius [Wed, 11 May 2016 17:17:58 +0000 (18:17 +0100)] 
Add apt-transport-https to minbase variant packages_template

In many environments the preference is to configure containers with
apt mirrors that are SSL-secured.

When building containers using the download template this can't be
done unless an insecure mirror is first used to install the
apt-transport-https package, then the sources reconfigured to
use the https URL.

When building containers without using the download template this
can't be done unless the container creator specifically includes
this package in the package list at build time.

It seems more intuitive to me to have the package installed by
default. This patch includes the required package for the minbase
variant only as this is the default.

Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
9 years agoAlso allow fstype=fuse for fuse filesystems
Stéphane Graber [Wed, 11 May 2016 16:59:23 +0000 (12:59 -0400)] 
Also allow fstype=fuse for fuse filesystems

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoc/r: add an option to use faster inotify support in CRIU
Tycho Andersen [Wed, 11 May 2016 13:51:11 +0000 (07:51 -0600)] 
c/r: add an option to use faster inotify support in CRIU

The idea here is that criu can use open_by_handle on a configuration which
will preserve inodes on moves across hosts, but shouldn't do that on
configurations which won't preserve inodes. Before, we forced it to always
be slow, but we don't have to do this.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agoc/r: rearrange things to pass struct migrate_opts all the way down
Tycho Andersen [Fri, 6 May 2016 18:19:16 +0000 (18:19 +0000)] 
c/r: rearrange things to pass struct migrate_opts all the way down

If we don't do this, we'll end up changing the function signatures for the
internal __criu_* functions each time we add a new parameter, which will
get very annoying very quickly. Since we already have the user's arguments
struct, let's just pass that all the way down.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agolog: remove duplicate definitons and bump buffer size
Tycho Andersen [Mon, 9 May 2016 21:37:26 +0000 (21:37 +0000)] 
log: remove duplicate definitons and bump buffer size

When writing out the CRIU exec command, we're bumping up against the buffer
size limit. Let's increase it so we can avoid:

lxc 20160509213229.921 WARN     lxc_log - log.c:log_append_logfile:111 - truncated next event from 523 to 512 bytes

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agoAllow configuration file values to be quoted
Stewart Brodie [Tue, 10 May 2016 12:57:00 +0000 (13:57 +0100)] 
Allow configuration file values to be quoted

If the value starts and ends with matching quote characters, those
characters are stripped automatically.   Quote characters are the
single quote (') or double quote (").  The quote removal is done after
the whitespace trimming.

This is needed particularly in order that lxc.environment values may
have trailing spaces.  However, the quote removal is done for all values
in the parse_line function, as it has non-const access to the value.

Signed-off-by: Stewart Brodie <stewart@metahusky.net>
9 years agoAdded `type` to keys in lxc_list_nicconfigs
Aron Podrigal [Sun, 1 May 2016 16:13:39 +0000 (12:13 -0400)] 
Added `type` to keys in lxc_list_nicconfigs

Signed-off-by: Aron Podrigal <aronp@guaranteedplus.com>
9 years agoUnshare netns after setting the userns mappings
Serge Hallyn [Mon, 9 May 2016 20:30:46 +0000 (15:30 -0500)] 
Unshare netns after setting the userns mappings

so that there is a root uid mapping for the /proc/net files.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdded OR statement for cases of ID = rhel in RHEL 7+
Hartnell Foster [Mon, 9 May 2016 11:42:56 +0000 (12:42 +0100)] 
Added OR statement for cases of ID = rhel in RHEL 7+

Signed-off-by: Hartnell Foster <hartnell.foster@bbc.co.uk>
9 years agosync.c: use correct types
Christian Brauner [Sat, 7 May 2016 05:40:33 +0000 (07:40 +0200)] 
sync.c: use correct types

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoChange sys_resources to sys_resource.
Karl-Johan Karlsson [Sun, 8 May 2016 08:38:31 +0000 (10:38 +0200)] 
Change sys_resources to sys_resource.

gentoo.moresecure.conf tries to drop the capability CAP_SYS_RESOURCES.
However, that capability doesn't exist, so the container doesn't start.
Change it to CAP_SYS_RESOURCE, according to capabilities(7).

Also correct the same typo in a comment in slackware.common.conf.

Signed-off-by: Karl-Johan Karlsson <creideiki@ferretporn.se>
9 years agosync: fail on unexpected message sizes
Tycho Andersen [Fri, 6 May 2016 16:21:39 +0000 (11:21 -0500)] 
sync: fail on unexpected message sizes

I think (?) this may be related to our hanging monitor bug. Let's do this
anyway, as it's probably a good idea.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agoForce DHCP client to send hostname
Lisio [Thu, 5 May 2016 04:35:36 +0000 (08:35 +0400)] 
Force DHCP client to send hostname

Required for proper applying dnsmasq config entries.

Signed-off-by: Andrey Kostin <andrey@kostin.email>
9 years agoImprove on the case where default networking config is incomplete
Thomas Tanaka [Mon, 2 May 2016 18:30:30 +0000 (11:30 -0700)] 
Improve on the case where default networking config is incomplete

Signed-off-by: Thomas Tanaka <thomas.tanaka@oracle.com>
9 years agodoc: Add logging option to Korean lxc-attach(1)
Sungbae Yoo [Mon, 2 May 2016 09:25:29 +0000 (18:25 +0900)] 
doc: Add logging option to Korean lxc-attach(1)

Update for commit f43d63b

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
9 years agoFixed - set PyErr when Container.__init__ fails
Aron Podrigal [Sun, 1 May 2016 15:06:53 +0000 (11:06 -0400)] 
Fixed - set PyErr when Container.__init__ fails

When container init failed for whatever reason, previously it resulted
in a `SystemError: NULL result without error in PyObject_Call`
This will now result in a RuntimeError with the error message
previously printed to stderr.

Signed-off-by: Aron Podrigal <aronp@guaranteedplus.com>
9 years agoCheck if stdout is a terminal in lxc-checkconfig
walkerning [Sat, 30 Apr 2016 17:06:29 +0000 (01:06 +0800)] 
Check if stdout is a terminal in lxc-checkconfig

Let lxc-checkconfig write to non-tty stdout without color control
characters
Signed-off-by: walkerning <foxdoraame@gmail.com>
9 years agolxc-ls: non-functional changes
Christian Brauner [Thu, 28 Apr 2016 20:58:14 +0000 (22:58 +0200)] 
lxc-ls: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agolxc-ls: use fewer syscalls when doing ipc
Christian Brauner [Wed, 27 Apr 2016 12:27:51 +0000 (14:27 +0200)] 
lxc-ls: use fewer syscalls when doing ipc

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agodoc: Add logging option to Japanese lxc-attach(1)
KATOH Yasufumi [Mon, 25 Apr 2016 10:30:03 +0000 (19:30 +0900)] 
doc: Add logging option to Japanese lxc-attach(1)

Update for commit f43d63b

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
9 years agoUpdate maintainers
Stéphane Graber [Sun, 24 Apr 2016 22:34:15 +0000 (18:34 -0400)] 
Update maintainers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoInitialize a pointer in split_init_cmd() to avoid gcc warnings
Leonid Isaev [Thu, 21 Apr 2016 19:20:39 +0000 (13:20 -0600)] 
Initialize a pointer in split_init_cmd() to avoid gcc warnings

gcc -Wall warns about uninitialized variables (-Wmaybe-uninitialized), and
-Werror makes it fatal. This change allows the build to succeed by NULL'ifying
the pointer passed to strtok_r().

Note that strtok_r(3) anyway ignores a non-NULL arg3 pointer on the 1st call
with non-NULL arg1 string.

Signed-off-by: Leonid Isaev <leonid.isaev@jila.colorado.edu>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agouse raw settings of ssh for pty
Christian Brauner [Tue, 19 Apr 2016 13:17:19 +0000 (15:17 +0200)] 
use raw settings of ssh for pty

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoSwitch console pty to raw mode. Without this some ncurses-based programs behave incor...
Andrey Jr. Melnikov [Mon, 18 Apr 2016 16:16:08 +0000 (19:16 +0300)] 
Switch console pty to raw mode. Without this some ncurses-based programs behave incorrectly

Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
9 years agodon't make sysv init scripts dependant on distribution specifics
Evgeni Golov [Fri, 15 Apr 2016 18:45:09 +0000 (20:45 +0200)] 
don't make sysv init scripts dependant on distribution specifics

- /etc(/rc.d)?/init.d/functions does not exist on all distributions
- LSB does not define a message function without an explicit status
- Debian-derived systems add a log_daemon_msg for that

lets define an own log_daemon_msg as echo and try to load LSB init
functions afterwards, which might overload it with a nicer version

that way the init scripts should work on any system, without hard
dependencies on neither LSB nor /etc/init.d/functions

Closes #309 #310 #311

Signed-off-by: Evgeni Golov <evgeni@debian.org>
9 years agodrop obsolete syslog.target from lxc.service.in
Evgeni Golov [Thu, 14 Apr 2016 16:03:29 +0000 (18:03 +0200)] 
drop obsolete syslog.target from lxc.service.in

the target is obsolete since systemd v38 which everybody should have.

original patch by Daniel Baumann

Signed-off-by: Evgeni Golov <evgeni@debian.org>
9 years agoFixed python-lxc reference to var before assignment
Aron Podrigal [Thu, 14 Apr 2016 04:21:08 +0000 (00:21 -0400)] 
Fixed python-lxc reference to var before assignment

```
>>> c = lxc.Container('ct')
>>> c.create('debian', args=('-r', 'jessie'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/lxc/__init__.py", line 229, in
create
    template_args['args'] = tuple(tmp_args)
UnboundLocalError: local variable 'tmp_args' referenced before
assignment
```

Signed-off-by: Aron Podrigal <aronp@guaranteedplus.com>
9 years agoadd missing lsb headers to sysvinit scripts
Evgeni Golov [Wed, 13 Apr 2016 15:54:55 +0000 (17:54 +0200)] 
add missing lsb headers to sysvinit scripts

original patch by Daniel Baumann

closes #308

Signed-off-by: Evgeni Golov <evgeni@debian.org>
9 years agoonly execute last test when we are a pty
Christian Brauner [Wed, 13 Apr 2016 13:41:58 +0000 (15:41 +0200)] 
only execute last test when we are a pty

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agolxc-attach: error on -L/--pty-log + redirection
Christian Brauner [Wed, 13 Apr 2016 13:23:35 +0000 (15:23 +0200)] 
lxc-attach: error on -L/--pty-log + redirection

pty logging only works correctly when stdout and stderr refer to a pty. If they
do not, we do not dup2() them and lxc_console_cb_con() will never write to the
corresponding log file descriptor.

When redirection on stdout and stderr is used we can safely assume that the user
is already logging to a file or /dev/null and creating an additional pty log
doesn't seem to make sense.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agocgfsng: don't require that systemd subsystem be mounted
Serge Hallyn [Tue, 12 Apr 2016 17:34:28 +0000 (12:34 -0500)] 
cgfsng: don't require that systemd subsystem be mounted

Note that is_crucial_subsystem still lists name=systemd.  That is
used in cgfs and cgmanager.  Cgmanager is typically setup to create
name=systemd, so it is ok.  cgfs uses is_crucial_subsystem() only
to decide whether failure to create or chown a directory should be
terminal.  That's ok, because (a) if name=systemd is not mounted then
we won't hit that, and (b) if name=systemd is mounted, then we'd
really still like to set it up for containers.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agonicer date format and support for SOURCE_DATE_EPOCH in LXC_GENERATE_DATE
Evgeni Golov [Tue, 12 Apr 2016 17:20:10 +0000 (19:20 +0200)] 
nicer date format and support for SOURCE_DATE_EPOCH in LXC_GENERATE_DATE

Using $(date) for LXC_GENERATE_DATE has various flaws:
* formating depends on the locale of the system we execute configure on
* the output is not really a date but more a timestamp

Let's use $(date --utc '+%Y-%m-%d') instead.

While at it, also support SOURCE_DATE_EPOCH [1] to make the build
reproducible

[1] https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Evgeni Golov <evgeni@debian.org>
9 years agolxc-destroy: avoid double print
Christian Brauner [Mon, 11 Apr 2016 21:57:29 +0000 (23:57 +0200)] 
lxc-destroy: avoid double print

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agolxc-attach: add logging option to manpage
Christian Brauner [Mon, 11 Apr 2016 16:13:09 +0000 (18:13 +0200)] 
lxc-attach: add logging option to manpage

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agolxc-create: fix -B best option
Christian Brauner [Mon, 11 Apr 2016 15:13:16 +0000 (17:13 +0200)] 
lxc-create: fix -B best option

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoUse size_t as an iteration point over int
staticfox [Mon, 11 Apr 2016 14:36:37 +0000 (10:36 -0400)] 
Use size_t as an iteration point over int

This cleans up some sign-compare warnings as well as avoids any
possibilities of unintended signed offsets for indices during
iteration.

Signed-off-by: Matt Ullman <staticfox@staticfox.net>
9 years agoIgnore temporary files generated by doxygen
staticfox [Mon, 11 Apr 2016 14:54:44 +0000 (10:54 -0400)] 
Ignore temporary files generated by doxygen

Signed-off-by: Matt Ullman <staticfox@staticfox.net>
9 years agoadapt lxc-attach tests & add test for pty logging
Christian Brauner [Fri, 8 Apr 2016 20:43:51 +0000 (22:43 +0200)] 
adapt lxc-attach tests & add test for pty logging

The current tests for lxc-attach pty allocation and I/O redirection rely on the
standard file descriptors of the test script to refer to a pty. If they do not
the tests are effectively useless with respect to pty allocation. We need a test
environment with the standard file descriptors refering to a pty as well. One
solution is to run this test under the script command.

This commit also adds a test whether pty logging works. This test is only
executed when all standard file descriptors refer to a pty.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agocgfsng: defer to cgfs if needed subsystems are not available
Serge Hallyn [Fri, 8 Apr 2016 21:18:04 +0000 (16:18 -0500)] 
cgfsng: defer to cgfs if needed subsystems are not available

This requires us to check that at cgfsng_ops_init, rather than
cgfs_init.  Cache the hierarchy and cgroup.use info globally
rather than putting it into the per-container info, as cgmanager
does.  This is ok as both cgroup.use and the list of usable
hierarchies are in fact global to a lxc run.

Closes #952

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agofix lxc_console_cb_tty_*()
Christian Brauner [Fri, 8 Apr 2016 18:38:49 +0000 (20:38 +0200)] 
fix lxc_console_cb_tty_*()

Clean exit when read() == -1 && errno != EINTR or read() == 0.

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