]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
10 years agobdev: Rename mount_unknow_fs to mount_unknown_fs
Stéphane Graber [Thu, 30 Jan 2014 12:18:55 +0000 (12:18 +0000)]
bdev: Rename mount_unknow_fs to mount_unknown_fs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoupstart: Make sure FORWARD is allowed for containers
Stéphane Graber [Thu, 30 Jan 2014 14:29:58 +0000 (14:29 +0000)]
upstart: Make sure FORWARD is allowed for containers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager chown: close socketpair on error paths
Serge Hallyn [Wed, 29 Jan 2014 17:31:49 +0000 (17:31 +0000)]
cgmanager chown: close socketpair on error paths

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years ago[PATCH cgmanager chown: don't do a gratuitous fork
Serge Hallyn [Wed, 29 Jan 2014 16:17:09 +0000 (16:17 +0000)]
[PATCH cgmanager chown: don't do a gratuitous fork

userns_exec_1() clones a new task to manipulate.  We don't
need to fork before calling that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoInclude config.h early for _GNU_SOURCE with uClibc
Natanael Copa [Wed, 29 Jan 2014 14:23:50 +0000 (14:23 +0000)]
Include config.h early for _GNU_SOURCE with uClibc

This fixes the following compile errors with uClibc:

lxc_snapshot.c: In function 'print_file':
lxc_snapshot.c:71:2: error: implicit declaration of function 'getline' [-Werror=implicit-function-declaration]
  while (getline(&line, &sz, f) != -1) {
  ^
cc1: all warnings being treated as errors

lxc_usernsexec.c: In function 'read_default_map':
lxc_usernsexec.c:181:2: error: implicit declaration of function 'getline' [-Werror=implicit-function-declaration]
  while (getline(&line, &sz, fin) != -1) {
  ^
cc1: all warnings being treated as errors

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoInclude config.h early for _GNU_SOURCE with musl libc
Natanael Copa [Wed, 29 Jan 2014 14:23:49 +0000 (14:23 +0000)]
Include config.h early for _GNU_SOURCE with musl libc

This fixes various compile errors when building with musl libc. For
example:

In file included from start.c:66:0:
monitor.h:38:12: error: 'NAME_MAX' undeclared here (not in a function)
  char name[NAME_MAX+1];
            ^
start.c: In function 'setup_signal_fd':
start.c:202:2: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
  if (sigfillset(&mask) ||
  ^

...

In file included from freezer.c:36:0:
monitor.h:39:12: error: 'NAME_MAX' undeclared here (not in a function)
  char name[NAME_MAX+1];
            ^
...

In file included from cgroup.c:45:0:
conf.h:87:13: error: 'IFNAMSIZ' undeclared here (not in a function)
  char veth1[IFNAMSIZ]; /* needed for deconf */
             ^
cgroup.c: In function 'find_cgroup_subsystems':
cgroup.c:230:3: error: implicit declaration of function 'strdup' [-Werror=implicit-function-declaration]
   (*kernel_subsystems)[kernel_subsystems_count] = strdup(line);
   ^
...

In file included from conf.c:65:0:
conf.h:87:13: error: 'IFNAMSIZ' undeclared here (not in a function)
  char veth1[IFNAMSIZ]; /* needed for deconf */
             ^
In file included from conf.c:66:0:
conf.c: In function 'run_buffer':
log.h:263:9: error: implicit declaration of function 'strsignal' [-Werror=implicit-function-declaration]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
...

af_unix.c: In function 'lxc_abstract_unix_send_credential':
af_unix.c:208:9: error: variable 'cred' has initializer but incomplete type
  struct ucred cred = {
         ^
af_unix.c:209:3: error: unknown field 'pid' specified in initializer
   .pid = getpid(),
   ^
af_unix.c:209:3: error: excess elements in struct initializer [-Werror]
af_unix.c:209:3: error: (near initialization for 'cred') [-Werror]
af_unix.c:210:3: error: unknown field 'uid' specified in initializer
   .uid = getuid(),
   ^
af_unix.c:210:3: error: excess elements in struct initializer [-Werror]
af_unix.c:210:3: error: (near initialization for 'cred') [-Werror]
af_unix.c:211:3: error: unknown field 'gid' specified in initializer
   .gid = getgid(),
   ^

and more...

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoCheck for non-posix utmpxname in configure
Natanael Copa [Wed, 29 Jan 2014 14:23:48 +0000 (14:23 +0000)]
Check for non-posix utmpxname in configure

utmpx.h is specified in POSIX but utmpxname is not so we check for
utmpxname in configure script.

This fixes the following compile error with musl libc:
lxcutmp.c: In function 'utmp_get_runlevel':
lxcutmp.c:249:2: error: implicit declaration of function 'utmpxname' [-Werror=implicit-function-declaration]
  if (!access(path, F_OK) && !utmpxname(path))
    ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoDon't include linux/if_bridge.h
Natanael Copa [Wed, 29 Jan 2014 14:23:47 +0000 (14:23 +0000)]
Don't include linux/if_bridge.h

Instead rely on struct ethhdr from net/ethernet.h

This fixes build error with musl libc:
In file included from /usr/include/linux/if_bridge.h:17:0,
                 from network.c:47:
/usr/include/linux/if_ether.h:133:8: error: redefinition of 'struct ethhdr'
 struct ethhdr {
        ^
In file included from /usr/include/net/ethernet.h:10:0,
                 from network.c:42:
/usr/include/netinet/if_ether.h:93:8: note: originally defined here
 struct ethhdr {
        ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoInclude limits.h for NAME_MAX
Natanael Copa [Wed, 29 Jan 2014 14:23:46 +0000 (14:23 +0000)]
Include limits.h for NAME_MAX

This fixes compile error with musl libc:
In file included from start.c:66:0:
monitor.h:38:12: error: 'NAME_MAX' undeclared here (not in a function)
  char name[NAME_MAX+1];
            ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoInclude strings.h for strcasecmp
Natanael Copa [Wed, 29 Jan 2014 14:23:45 +0000 (14:23 +0000)]
Include strings.h for strcasecmp

This fixes the following error with musl libc:
In file included from start.c:59:0:
log.h: In function 'lxc_log_priority_to_int':
log.h:136:2: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoUse the standard 'unsigned int' instead or non-standard 'uint'
Natanael Copa [Wed, 29 Jan 2014 14:23:44 +0000 (14:23 +0000)]
Use the standard 'unsigned int' instead or non-standard 'uint'

This fixes compile error when build with musl libc:
conf.h:92:2: error: unknown type name 'uint'
  uint   fmask;
  ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoInclude poll.h instead of sys/poll.h
Natanael Copa [Wed, 29 Jan 2014 14:23:43 +0000 (14:23 +0000)]
Include poll.h instead of sys/poll.h

poll.h is defined in POSIX:
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html

This fixes a compile warning when building with musl libc:
In file included from start.c:46:0:
/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys
/poll.h> to <poll.h> [-Werror=cpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
  ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agouserns_exec_1: catch errors in the spawned process.
Serge Hallyn [Wed, 29 Jan 2014 15:17:06 +0000 (15:17 +0000)]
userns_exec_1: catch errors in the spawned process.

lxc_map_ids can call system(3), which on error from the
spawned process returns > 0.  No path should return > 0
when it meant success.  So check the lxc_map_ids() value
to be != rather than just < 0.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoTwo further cgroup cleanups:
Robert Vogelgesang [Wed, 29 Jan 2014 13:52:35 +0000 (14:52 +0100)]
Two further cgroup cleanups:

Move the test of mp->need_cpuset_init to a logically better place.
Avoid misleading error messages.

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: disable sys_admin by default
Natanael Copa [Wed, 29 Jan 2014 13:00:48 +0000 (13:00 +0000)]
lxc-alpine: disable sys_admin by default

It is normally not needed.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoubuntu/ubuntu-cloud: Add support for arm64 and ppc64el
Stéphane Graber [Tue, 28 Jan 2014 18:01:17 +0000 (18:01 +0000)]
ubuntu/ubuntu-cloud: Add support for arm64 and ppc64el

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-monitord.log should not be created with mode 0666
Robert Vogelgesang [Tue, 28 Jan 2014 11:01:54 +0000 (12:01 +0100)]
lxc-monitord.log should not be created with mode 0666

lxc_monitord_spawn() in src/lxc/monitor.c contained "umask(0);", and
because of this, lxc-monitord created lxc-monitord.log with mode 0666.
World-writeable log files are bad, so remove this umask(0).

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-alpine: mount tmpfs on /dev/shm
Kaarle Ritvanen [Tue, 28 Jan 2014 17:03:27 +0000 (19:03 +0200)]
lxc-alpine: mount tmpfs on /dev/shm

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_container_new: fail on config file parse error
Serge Hallyn [Tue, 28 Jan 2014 13:28:19 +0000 (13:28 +0000)]
lxc_container_new: fail on config file parse error

If we have a bad config file entry, fail.  Otherwise lxc-start
will proceed with a partial configuration.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroups: adjust previous commit
Serge Hallyn [Wed, 29 Jan 2014 09:40:39 +0000 (09:40 +0000)]
cgroups: adjust previous commit

Remove a memory leak on error path.

Only try to initialize cpuset if cgroup.clonechildren does not exist.

Bump the max value we read from cpuset.{cpus,mems} to 1024.

If cpuset.cpus or .mems is already initialized but is too long, don't fail.

If parent's cpuset.cpus or .mems is too long, record an error and fail.
If anyone actually runs into this, we can simply allocate the required
length as needed, but we don't expect anyone to run into this.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroupfs: cpuset support for kernels without cgroup.clone_children
Robert Vogelgesang [Mon, 27 Jan 2014 17:35:23 +0000 (18:35 +0100)]
cgroupfs: cpuset support for kernels without cgroup.clone_children

Hi,

as promised last week, here's my patch for cpuset cgroup support for
kernels without the cgroup.clone_children feature.

My initial patch used "#include <linux/version.h>" and the macros defined
there to decide if cgroup.clone_children should be used or not.  After
having seen Serge Hallyn's patch which he posted to the list last Wednesday,
where he used stat() to check if the cgroup.clone_children file is there,
I rewrote my patch to do the same.

The patch is against 1.0.0.beta3, and it is tested successfully with
RHEL-6's kernel version 2.6.32-431.3.1.el6, compiled without cgmanager
(I've so far not tried to use cgmanager in RHEL-6).

In addition to fixing the cpuset cgroup setup, this patch also fixes a
wrong argument in a call to handle_cgroup_settings() in the same context.

Robert

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agogentoo: Fix /dev/tun generation
Stéphane Graber [Tue, 28 Jan 2014 12:22:06 +0000 (12:22 +0000)]
gentoo: Fix /dev/tun generation

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agogentoo: Add basic userns config
Stéphane Graber [Tue, 28 Jan 2014 09:56:37 +0000 (09:56 +0000)]
gentoo: Add basic userns config

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agogentoo: fix comments about hardened
gza [Tue, 28 Jan 2014 08:34:11 +0000 (09:34 +0100)]
gentoo: fix comments about hardened

Signed-off-by: gza <github.guillaume@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agogentoo: template rework
gza [Sun, 26 Jan 2014 19:55:23 +0000 (20:55 +0100)]
gentoo: template rework

Now splited config 2 settings available
* common
** featureful oriented settings
* moresecure
** security oriented

Signed-off-by: gza <github.guillaume@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agogentoo: fix typo, may break host init system
gza [Sat, 25 Jan 2014 06:02:12 +0000 (07:02 +0100)]
gentoo: fix typo, may break host init system

Signed-off-by: gza <github.guillaume@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoexport lxc_cmd_get_config_item via API and use in lxc-info
S.Çağlar Onur [Mon, 27 Jan 2014 22:57:37 +0000 (17:57 -0500)]
export lxc_cmd_get_config_item via API and use in lxc-info

This allows external users to query network related config items
from the running containers.

changes since v1:
- function name change

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agochange version to 1.0.0.beta3 in configure.ac
Stéphane Graber [Mon, 27 Jan 2014 13:52:20 +0000 (13:52 +0000)]
change version to 1.0.0.beta3 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoattach test: always flush stdout
Serge Hallyn [Mon, 27 Jan 2014 11:05:15 +0000 (05:05 -0600)]
attach test: always flush stdout

Otherwise, after a fork, both pids may be flushing.  When
redirecting output to a file, this causes duplicate (or really
far worse) output.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-download: Tweak cache location
Stéphane Graber [Sun, 26 Jan 2014 11:47:48 +0000 (11:47 +0000)]
lxc-download: Tweak cache location

 - Also include the variant in the path
 - Fix invalid LXC_CACHE_BASE
 - Drop redundant code

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxccontainer: fix whitespaces
Luka Perkov [Sun, 26 Jan 2014 00:26:56 +0000 (00:26 +0000)]
lxccontainer: fix whitespaces

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: fix the SEE ALSO section of Japanese lxc-user-nic(1)
KATOH Yasufumi [Mon, 27 Jan 2014 06:39:40 +0000 (15:39 +0900)]
doc: fix the SEE ALSO section of Japanese lxc-user-nic(1)

* update for commit e43157b4b2410a99096576dbdac831cf438133b7

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoIgnore lxc-test-usernic
Stéphane Graber [Sun, 26 Jan 2014 05:17:25 +0000 (00:17 -0500)]
Ignore lxc-test-usernic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxccontainer: remove PID file after lxc_start return
Qiang Huang [Fri, 24 Jan 2014 03:41:27 +0000 (11:41 +0800)]
lxccontainer: remove PID file after lxc_start return

Make the way symmetric. This also fix the file leak in
daemon model.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoclose the fd on error
S.Çağlar Onur [Sat, 25 Jan 2014 05:46:04 +0000 (00:46 -0500)]
close the fd on error

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxcapi_clone: exit early on snapshot clones
Serge Hallyn [Sat, 25 Jan 2014 22:28:24 +0000 (16:28 -0600)]
lxcapi_clone: exit early on snapshot clones

If the user explicitly asks for a snapshot clone (in which
case maybe_snap is not set), we cannot abide this currently.
Rather than exit later with more cryptic error messages, exit
out early.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-alpine: copy /etc/TZ to container if present
Kaarle Ritvanen [Sat, 25 Jan 2014 21:09:54 +0000 (23:09 +0200)]
lxc-alpine: copy /etc/TZ to container if present

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-download: Fix to work without mktemp
Stéphane Graber [Fri, 24 Jan 2014 23:23:28 +0000 (18:23 -0500)]
lxc-download: Fix to work without mktemp

mktemp isn't always available in busybox.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgmanager: chown cgroups to the container root
Serge Hallyn [Fri, 24 Jan 2014 05:56:15 +0000 (23:56 -0600)]
cgmanager: chown cgroups to the container root

After this patch, starting an unprivileged container using
cgmanager gets the cgroup chown to the container root, so
that it can install the cgmanager (proxy) and make cgroup
requests.

(Still desirable and not in this patch is the automatic setup of
/sys/fs/cgroup/manager/sock, which you can currently do with
two lxc.mount.entries)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Fix startone
Stéphane Graber [Fri, 24 Jan 2014 20:51:27 +0000 (15:51 -0500)]
tests: Fix startone

 - Fix cgroup test to work on multi-core systems
 - Drop user interaction

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconf: Fix clear_config_item on lxc.network entries
Stéphane Graber [Fri, 24 Jan 2014 20:20:04 +0000 (15:20 -0500)]
conf: Fix clear_config_item on lxc.network entries

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Fix lxc-user-nic path
Stéphane Graber [Fri, 24 Jan 2014 17:51:01 +0000 (12:51 -0500)]
tests: Fix lxc-user-nic path

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Fix python3 API test
Stéphane Graber [Fri, 24 Jan 2014 19:00:02 +0000 (14:00 -0500)]
tests: Fix python3 API test

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Don't require user interaction in containertests
Stéphane Graber [Fri, 24 Jan 2014 18:49:47 +0000 (13:49 -0500)]
tests: Don't require user interaction in containertests

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix previous change to use defined()
Stéphane Graber [Fri, 24 Jan 2014 18:42:37 +0000 (13:42 -0500)]
Fix previous change to use defined()

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoSupport __NR_set_ns as well.
Stéphane Graber [Fri, 24 Jan 2014 18:27:26 +0000 (13:27 -0500)]
Support __NR_set_ns as well.

Apparently some older systems didn't have __NR_setns but had __NR_set_ns.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: fix See Also lxc-usernet.conf -> lxc-usernet
Dwight Engen [Fri, 24 Jan 2014 18:00:59 +0000 (13:00 -0500)]
doc: fix See Also lxc-usernet.conf -> lxc-usernet

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoUpdate CentOS and Fedora templates to support archtectures option.
Michael H. Warfield [Thu, 23 Jan 2014 20:58:16 +0000 (15:58 -0500)]
Update CentOS and Fedora templates to support archtectures option.

Added code to the CentOS and Fedora templates so that x86 32 bit containers
may be built on x86_64 platforms.  Like archectectures may also be trivially
used as well.

Option added is "-a {arch}".

Additionally cleaned up some bash specific logic.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoidmap_add_id: fix broken behavior
Serge Hallyn [Fri, 24 Jan 2014 04:23:24 +0000 (22:23 -0600)]
idmap_add_id: fix broken behavior

The geteuid() addition is being made the first element of the lxc_list,
but the first element is just a head whose entry is ignored.  Therefore
userns_exec_1() was starting its tasks without the caller's uid mapped
into the namespace.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd lua-alt-getopt dependency
Dwight Engen [Fri, 24 Jan 2014 15:06:38 +0000 (10:06 -0500)]
add lua-alt-getopt dependency

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Add Japanese lxc-config(1)
KATOH Yasufumi [Fri, 24 Jan 2014 09:37:22 +0000 (18:37 +0900)]
doc: Add Japanese lxc-config(1)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Fix createtest
Stéphane Graber [Fri, 24 Jan 2014 04:30:14 +0000 (23:30 -0500)]
tests: Fix createtest

Drop 60s delay and clear config before loading it.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Remove containers after running clonetest
Stéphane Graber [Fri, 24 Jan 2014 04:20:48 +0000 (23:20 -0500)]
tests: Remove containers after running clonetest

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Drop 60s delay in shutdowntest
Stéphane Graber [Fri, 24 Jan 2014 02:58:50 +0000 (21:58 -0500)]
tests: Drop 60s delay in shutdowntest

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix destroy() crash when no config is loaded
Stéphane Graber [Fri, 24 Jan 2014 02:41:28 +0000 (21:41 -0500)]
Fix destroy() crash when no config is loaded

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Fix lxc-test-saveconfig cleanup
Stéphane Graber [Fri, 24 Jan 2014 02:25:49 +0000 (21:25 -0500)]
tests: Fix lxc-test-saveconfig cleanup

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Fix shutdown test
Stéphane Graber [Fri, 24 Jan 2014 02:16:48 +0000 (21:16 -0500)]
tests: Fix shutdown test

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Speed up lxc-test-usernic
Stéphane Graber [Fri, 24 Jan 2014 01:45:27 +0000 (20:45 -0500)]
tests: Speed up lxc-test-usernic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Tweak lxc-test-ubuntu to be faster
Stéphane Graber [Fri, 24 Jan 2014 01:43:51 +0000 (20:43 -0500)]
tests: Tweak lxc-test-ubuntu to be faster

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Rework lxc-test-usernic
Stéphane Graber [Fri, 24 Jan 2014 01:08:37 +0000 (20:08 -0500)]
tests: Rework lxc-test-usernic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Fix cleanup in lxc-test-unpriv
Stéphane Graber [Fri, 24 Jan 2014 01:04:39 +0000 (20:04 -0500)]
tests: Fix cleanup in lxc-test-unpriv

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Update lxc-test-unpriv
Stéphane Graber [Thu, 23 Jan 2014 22:56:59 +0000 (17:56 -0500)]
tests: Update lxc-test-unpriv

Update lxc-test-unpriv to be a bit simpler and more reliable.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoget_mapped_rootid: fix description
Serge Hallyn [Thu, 23 Jan 2014 20:51:36 +0000 (14:51 -0600)]
get_mapped_rootid: fix description

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoget_mapped_rootid: avoid using (uid_t) -1
Serge Hallyn [Thu, 23 Jan 2014 20:48:28 +0000 (14:48 -0600)]
get_mapped_rootid: avoid using (uid_t) -1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-clone: support unprivileged use
Serge Hallyn [Thu, 23 Jan 2014 00:18:04 +0000 (18:18 -0600)]
lxc-clone: support unprivileged use

This also fixes unprivileged use of lxc-snapshot and lxc-rename.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgm_get: support NULL value
Serge Hallyn [Thu, 23 Jan 2014 19:35:50 +0000 (13:35 -0600)]
cgm_get: support NULL value

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoDrop runapitests.sh
Stéphane Graber [Thu, 23 Jan 2014 18:51:36 +0000 (13:51 -0500)]
Drop runapitests.sh

This script is outdated and unused.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRevert "cgroupfs: support older kernels without cgroup.clone_children"
Serge Hallyn [Thu, 23 Jan 2014 19:03:11 +0000 (13:03 -0600)]
Revert "cgroupfs: support older kernels without cgroup.clone_children"

This reverts commit 0a4d93787d4be78dc5e2873cf7c605c01d383792.

10 years agoRevert "bionic: Replace rindex by strrchr"
Serge Hallyn [Thu, 23 Jan 2014 19:03:05 +0000 (13:03 -0600)]
Revert "bionic: Replace rindex by strrchr"

This reverts commit 86f0eb65a0abc651c656ff602b823ba693f675c5.

10 years agoRevert "cgroup.c: clean up for handle_cgroup_settings"
Serge Hallyn [Thu, 23 Jan 2014 19:02:25 +0000 (13:02 -0600)]
Revert "cgroup.c: clean up for handle_cgroup_settings"

This reverts commit 032e28b7675fd03dc19c7af0182ddb93807c2f96.

10 years agoRevert "cgroupfs: get rid of the redundant error info"
Serge Hallyn [Thu, 23 Jan 2014 19:02:15 +0000 (13:02 -0600)]
Revert "cgroupfs: get rid of the redundant error info"

This reverts commit a8117b3361c9caf1397f4dc9bbb5e6de3af3cdff.

10 years agoRevert "cgroupfs: need the full path to setup cpuset"
Serge Hallyn [Thu, 23 Jan 2014 19:02:08 +0000 (13:02 -0600)]
Revert "cgroupfs: need the full path to setup cpuset"

This reverts commit 47f5ede0ec09b393779a7755aa36dc665e2e8fa5.

10 years agodoc: Add manpage for lxc-config
Stéphane Graber [Thu, 23 Jan 2014 16:38:47 +0000 (11:38 -0500)]
doc: Add manpage for lxc-config

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroupfs: need the full path to setup cpuset
Qiang Huang [Thu, 23 Jan 2014 06:56:54 +0000 (14:56 +0800)]
cgroupfs: need the full path to setup cpuset

Function file_exists() needs a absolute full path, but we are using
current_entire_path which is not. It will get the wrong result from
file_exists() and case Segmentation fault when we fopen a non-exist
file and try to fscanf from it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroupfs: get rid of the redundant error info
Qiang Huang [Thu, 23 Jan 2014 07:16:25 +0000 (15:16 +0800)]
cgroupfs: get rid of the redundant error info

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Add Japanese lxc.container.conf(5), lxc.system.conf(5) and update lxc.conf(5)
KATOH Yasufumi [Thu, 23 Jan 2014 10:56:41 +0000 (19:56 +0900)]
doc: Add Japanese lxc.container.conf(5), lxc.system.conf(5) and update lxc.conf(5)

* update for commit 55fc19a1042bca36ae431cb4a51c2abc0ca4d801
* fix typo in English lxc.system.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.coM>
10 years agocgroup.c: clean up for handle_cgroup_settings
Qiang Huang [Mon, 20 Jan 2014 08:37:06 +0000 (16:37 +0800)]
cgroup.c: clean up for handle_cgroup_settings

Clean up the nesting if, make the logic similar for memory
and cpuset, and the error message should sent from inside,
for better extendibility.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Try to clear some confusion about lxc.conf
Stéphane Graber [Wed, 22 Jan 2014 21:13:24 +0000 (16:13 -0500)]
doc: Try to clear some confusion about lxc.conf

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start-ephemeral: require root
Stéphane Graber [Thu, 23 Jan 2014 01:33:21 +0000 (20:33 -0500)]
lxc-start-ephemeral: require root

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_init: don't fail on bad signals
Serge Hallyn [Thu, 23 Jan 2014 02:49:55 +0000 (20:49 -0600)]
lxc_init: don't fail on bad signals

Changelog: Jan 22: as Michael Warfield pointed out, we should only
ignore EINVAL, since EFAULT points to a more serious problem.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobionic: Replace rindex by strrchr
Stéphane Graber [Thu, 23 Jan 2014 02:25:05 +0000 (21:25 -0500)]
bionic: Replace rindex by strrchr

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgroupfs: support older kernels without cgroup.clone_children
Serge Hallyn [Wed, 22 Jan 2014 16:49:00 +0000 (10:49 -0600)]
cgroupfs: support older kernels without cgroup.clone_children

When creating a cgroup, detect whether cgroup.clone_children
exists.  If not, then manually copy the parent's cpuset.cpus
and cpuset.mems values.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoplamo: Improve template
KATOH Yasufumi [Wed, 22 Jan 2014 17:29:42 +0000 (02:29 +0900)]
plamo: Improve template

allow not to specify a variable that is related installed packages

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodaemon: fix the wrong pid in daemon model
Qiang Huang [Wed, 22 Jan 2014 04:11:38 +0000 (12:11 +0800)]
daemon: fix the wrong pid in daemon model

When you start a container in daemon model, you have at least
3 processes:
 1. The command the user start (lxc-start -d)
 2. The backgrounded fork of that command after start() is done
 3. The container init process

In PID file, we need (2), but currently we are writing (1),
this is wrong because (1) exits as soon as the container is
started, it's complately useless.

So we write pid after daemonize, so that we'll always write
the right pid to PID file.

Reported-by: Stephane Graber <stgraber@ubuntu.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start: store PID file to lxc_container
Qiang Huang [Wed, 22 Jan 2014 04:11:37 +0000 (12:11 +0800)]
lxc-start: store PID file to lxc_container

So we can remove PID file untill lxc_container_free.

This also fix bug: https://github.com/lxc/lxc/issues/89

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoapi_start: don't get a container reference for the daemonized case
Serge Hallyn [Sun, 19 Jan 2014 18:17:42 +0000 (12:17 -0600)]
api_start: don't get a container reference for the daemonized case

In the daemonized case we will fork, so the anonymous container memlock
will not be shared between parent and child.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix handling of empty config keys
Stéphane Graber [Wed, 22 Jan 2014 22:14:10 +0000 (17:14 -0500)]
Fix handling of empty config keys

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: cgm_set: return the length we found
Serge Hallyn [Wed, 22 Jan 2014 19:53:04 +0000 (13:53 -0600)]
cgmanager: cgm_set: return the length we found

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc.spec: package bash completion, lxc-monitord move
Dwight Engen [Wed, 22 Jan 2014 19:56:21 +0000 (14:56 -0500)]
lxc.spec: package bash completion, lxc-monitord move

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxcapi_get_interfaces and lxcapi_get_ips: stricter read check
Serge Hallyn [Wed, 22 Jan 2014 19:16:59 +0000 (13:16 -0600)]
lxcapi_get_interfaces and lxcapi_get_ips: stricter read check

Coverity warns of the danger of a short read otherwise.

(Untested, but should be correct; Tossing over to you :)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Cc: S.Çağlar Onur <caglar@10ur.org>
Acked-by: S.Çağlar Onur <caglar@10ur.org>
10 years agolxc-download: Add interactive mode
Stéphane Graber [Wed, 22 Jan 2014 19:18:01 +0000 (14:18 -0500)]
lxc-download: Add interactive mode

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: free gw when not used
Serge Hallyn [Wed, 22 Jan 2014 19:04:42 +0000 (13:04 -0600)]
coverity: free gw when not used

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: close userns file when done
Serge Hallyn [Wed, 22 Jan 2014 19:02:42 +0000 (13:02 -0600)]
coverity: close userns file when done

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: close netns file when done
Serge Hallyn [Wed, 22 Jan 2014 18:57:53 +0000 (12:57 -0600)]
coverity: close netns file when done

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: setup_limits: return true if there are no settings
Serge Hallyn [Wed, 22 Jan 2014 18:36:18 +0000 (12:36 -0600)]
cgmanager: setup_limits: return true if there are no settings

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-info: Limit information when not running
Stéphane Graber [Wed, 22 Jan 2014 18:09:51 +0000 (13:09 -0500)]
lxc-info: Limit information when not running

Don't try to print the PID, IP addresses or statistics for a container
that's not current running.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRemove lxc-version, lxc-ps and lxc-netstat
Stéphane Graber [Tue, 21 Jan 2014 17:16:04 +0000 (12:16 -0500)]
Remove lxc-version, lxc-ps and lxc-netstat

lxc-ps and lxc-netstat have an unfortunate tendency to break every so
often, produce mostly unreadable output and should be replaced by a
lxc-attach call in 99% of the cases.

In an effort to cleanup the lxc-* namespace, I think those two should
go, so this patch gets rid of them as well as any reference to them in
our documentation.

I also think that lxc-version should disappear as it's only a one line
shell script printing the version string, so having a whole command just
for that seems to be a bit of a waste.

Instead, this patch introduces a new --version common option which all
binaries will automatically inherit and that'll print LXC_VERSION on
stdout and exit 0.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd bash auto completion
Stéphane Graber [Tue, 21 Jan 2014 04:49:19 +0000 (23:49 -0500)]
Add bash auto completion

This adds a basic bash auto-completion profile.

It supports 3 things at this time:
 - Auto-complete of container name (-n or -o)
 - Auto-complete of template name (-t)
 - Auto-complete of state names (-s)

It's configured in a way to be as little disruptive as possible, any
argument that's not explicitly handled by the profile will fallack to
bash's default completion.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoUnset lxc.devttydir for userns CentOS
Stéphane Graber [Wed, 22 Jan 2014 16:38:59 +0000 (11:38 -0500)]
Unset lxc.devttydir for userns CentOS

Without this, the container entirely fails to start.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoUpdate Fedora and CentOS templates for common conf includes.
Michael H. Warfield [Tue, 21 Jan 2014 16:56:56 +0000 (11:56 -0500)]
Update Fedora and CentOS templates for common conf includes.

This updates the Fedora and CentOS templates to utilize a common
included config.  This is largely based on the changes in the Oracle
template with some exceptions.

Dropping of setpcap (present in the Oracle template) is commented out in
the Fedora template.  It seems to cause problems, such as large login
delays with Fedora 20 containers (but not Fedora 19 - strange).

The Fedora template is further modified to disable systemd-journald.service
as it is unnecessary in a container and causes serious problems when
running in a Fedora 20 container.

The Fedora template is also updated to default to Fedora 20 when running
on a non-Fedora host.

Regards,
Mike

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>