]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
10 years agounnamed semaphores should be destroyed not closed
S.Çağlar Onur [Mon, 28 Oct 2013 19:37:22 +0000 (15:37 -0400)]
unnamed semaphores should be destroyed not closed

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agorpm spec: fix "warning: bogus date in %changelog"
Dwight Engen [Fri, 25 Oct 2013 23:01:54 +0000 (19:01 -0400)]
rpm spec: fix "warning: bogus date in %changelog"

Mar 24 2009 was actually a Tuesday, maybe Daniel was still recovering
from Monday ;) Stranger still that RPM actually checks this!?

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoUse actual length of socket's name for abstract sockets (v3)
S.Çağlar Onur [Fri, 25 Oct 2013 22:04:52 +0000 (18:04 -0400)]
Use actual length of socket's name for abstract sockets (v3)

The addrlen parameter should be the actual length of socket's name for abstract sockets. Otherwise socket gets padded with NULLs.

cat /proc/net/unix | grep lxc
[...]
000000000000000000000003 00000000 00000000 0001 03 226548 @lxc/ad055575fe28ddd5//var/lib/lxc^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
[...]

with this patch;

cat /proc/net/unix | grep lxc
[...]
000000000000000000000002 00000000 00010000 0001 01 109563 @lxc/ad055575fe28ddd5//var/lib/lxc
[...]

Changes since v1:
    * check the length of passed-in string
Changes since v2:
    * remove non-abstract socket code path to simplify functions
    * rename lxc_af_unix_* family to lxc_abstract_unix_*

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoEliminate duplicate entries from list_active_containers (v2)
S.Çağlar Onur [Thu, 24 Oct 2013 04:02:37 +0000 (00:02 -0400)]
Eliminate duplicate entries from list_active_containers (v2)

list_active_containers parses /proc/net/unix which can contain multiple entries for the same container;

000000000000000000000002 00000000 00010000 0001 01 273672 @/var/lib/lxc/6/command
000000000000000000000002 00000000 00010000 0001 01 274395 @/var/lib/lxc/5/command
000000000000000000000002 00000000 00010000 0001 01 273890 @/var/lib/lxc/4/command
000000000000000000000002 00000000 00010000 0001 01 273141 @/var/lib/lxc/3/command
000000000000000000000002 00000000 00010000 0001 01 273915 @/var/lib/lxc/2/command
000000000000000000000002 00000000 00010000 0001 01 273683 @/var/lib/lxc/1/command
000000000000000000000002 00000000 00010000 0001 01 273074 @/var/lib/lxc/0/command
000000000000000000000002 00000000 00010000 0001 01 273931 @/var/lib/lxc/9/command
000000000000000000000002 00000000 00010000 0001 01 273110 @/var/lib/lxc/8/command
000000000000000000000002 00000000 00010000 0001 01 273390 @/var/lib/lxc/7/command
000000000000000000000003 00000000 00000000 0001 03 275903 @/var/lib/lxc/8/command
000000000000000000000003 00000000 00000000 0001 03 276043 @/var/lib/lxc/1/command
000000000000000000000003 00000000 00000000 0001 03 273301 @/var/lib/lxc/0/command
000000000000000000000003 00000000 00000000 0001 03 275650 @/var/lib/lxc/4/command

On this system list_active_containers returns 14 containers while only 10 containers are running.

Following patch;

* Introduces array_contains function to do a binary search on given array,
* Starts to sort arrays inside the add_to_clist and add_to_names functions,
* Consumes array_contains in list_active_containers to eliminate duplicates,
* Replaces the linear search code in lxcapi_get_interfaces with the new function.

Changes since v1:
* Do not load containers if a if a container list is not passed in
* Fix possible memory leaks in lxcapi_get_ips and lxcapi_get_interfaces if realloc fails

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: enable 4 consoles by default
Natanael Copa [Thu, 24 Oct 2013 11:30:15 +0000 (13:30 +0200)]
lxc-alpine: enable 4 consoles by default

We allow 4 consoles in the LXC config file so we can enable 4 in the
inittab as well.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: run bootmisc and syslog at boot runlevel
Natanael Copa [Thu, 24 Oct 2013 11:30:14 +0000 (13:30 +0200)]
lxc-alpine: run bootmisc and syslog at boot runlevel

The bootmisc script is needed to clean up various temp dirs like /tmp
and migrate /var/run to /run if needed.

The syslog service is started in 'boot' runlevel when running on real
hardware so we do the same for containers.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroup: set memory.use_hierarchy
Serge Hallyn [Fri, 25 Oct 2013 05:16:17 +0000 (00:16 -0500)]
cgroup: set memory.use_hierarchy

But don't fail the container start if that fails.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ls: Rewrite nesting code to use the attach API
Stéphane Graber [Thu, 24 Oct 2013 18:45:34 +0000 (14:45 -0400)]
lxc-ls: Rewrite nesting code to use the attach API

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agostart: use lxc-user-nic if we are not root
Serge Hallyn [Wed, 23 Oct 2013 15:52:37 +0000 (10:52 -0500)]
start: use lxc-user-nic if we are not root

Note this results in nics named things like 'lxcuser-0p'.  We'll
likely want to pass the requested name to lxc-user-nic, but let's
do that in a separate patch.

If we're not root, we can't create new network itnerfaces to pass
into the container.  Instead wait until the container is started,
and call lxc-user-nic to create and assign the nics.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-busybox: if in userns, don't try to mknod
Serge Hallyn [Wed, 23 Oct 2013 01:02:59 +0000 (01:02 +0000)]
lxc-busybox: if in userns, don't try to mknod

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix chowning of tty and console uids
Serge Hallyn [Wed, 23 Oct 2013 01:02:58 +0000 (01:02 +0000)]
fix chowning of tty and console uids

It needs to be done from the handler, not the container, since
the container may not have the rights.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Changelog:
    Jul 22: remove hardcoded path for /bin/chown
    Jul 22: use new lxc-usernsexec

Conflicts:
src/lxc/lxccontainer.c

10 years agocontainer creation: support unpriv container creation in user namespaces
Serge Hallyn [Wed, 23 Oct 2013 01:02:57 +0000 (01:02 +0000)]
container creation: support unpriv container creation in user namespaces

1. lxcapi_create: don't try to unshare and mount for dir backed containers

It's unnecessary, and breaks unprivileged lxc-create (since unpriv users
cannot yet unshare(CLONE_NEWNS)).

2. api_create: chown rootfs

chown rootfs to the host uid to which container root will be mapped

3. create: run template in a mapped user ns

4. use (setuid-root) newxidmap to set id_map if we are not root

This is needed to be able to set userns mappings as an unprivileged
user, for unprivileged lxc-start.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agostrtoul: check errno
Serge Hallyn [Thu, 24 Oct 2013 16:35:55 +0000 (11:35 -0500)]
strtoul: check errno

In a few places we checked for LONG_MIN or LONG_MAX as indication
that strtoul failed.  That's not reliable.  As suggested in the
manpage, switch to checking errno value.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoclang: Remaining changes
Stéphane Graber [Thu, 24 Oct 2013 01:50:43 +0000 (21:50 -0400)]
clang: Remaining changes

Those are a bit less obvious than those I pushed directly to master.
All those changes were required to build LXC under clang here.

With this, gcc can be replaced by clang to build LXC so long as you're
not using the python3 binding (as python extensions can't be built under
clang at the moment).

For reference, the clang output for those is: http://paste.ubuntu.com/6292460/

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix build failure on sparc
Stéphane Graber [Thu, 24 Oct 2013 02:04:52 +0000 (22:04 -0400)]
Fix build failure on sparc

Signed-off-by: Thomas Nemeth <thomas.nemeth@laposte.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoapparmor: cache the are-we-enabled decision
Serge Hallyn [Thu, 24 Oct 2013 01:54:13 +0000 (20:54 -0500)]
apparmor: cache the are-we-enabled decision

Since we check /sys/kernel/security/ files when deciding whether
apparmor is enabled, and that might not be mounted in the container,
we cannot re-make the decision at apparmor_process_label_set() time.
Luckily we don't have to - just cache the decision made at
lsm_apparmor_drv_init().

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agooracle template: restrict writeability in /proc and /sys
Dwight Engen [Wed, 23 Oct 2013 21:03:40 +0000 (17:03 -0400)]
oracle template: restrict writeability in /proc and /sys

Note that since we don't drop CAP_SYS_ADMIN, root in the container can
remount proc or sys however they want to, however this at least improves
the default situation.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoclang: Fix some simple issues
Stéphane Graber [Thu, 24 Oct 2013 01:42:42 +0000 (21:42 -0400)]
clang: Fix some simple issues

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: Add hwaddr handling logic
Stéphane Graber [Wed, 23 Oct 2013 23:59:22 +0000 (19:59 -0400)]
lxc-debian: Add hwaddr handling logic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Update Japanese lxc-create(1) for default thin pool name
KATOH Yasufumi [Tue, 22 Oct 2013 08:59:30 +0000 (17:59 +0900)]
doc: Update Japanese lxc-create(1) for default thin pool name

Update for commit 055af165efb08f4dd54608896893bb6928fd472f

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotemplate: Fix the container configuration issue in lxc-plamo
KATOH Yasufumi [Wed, 23 Oct 2013 10:21:52 +0000 (19:21 +0900)]
template: Fix the container configuration issue in lxc-plamo

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix segfault on lxc-create when no template specified
KATOH Yasufumi [Wed, 23 Oct 2013 12:00:53 +0000 (21:00 +0900)]
Fix segfault on lxc-create when no template specified

When no template file is specified on lxc-create, recieve segfault.
So change not to append header in config when no template is specified.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobdev.c: don't free right before exit
Serge Hallyn [Tue, 22 Oct 2013 22:12:01 +0000 (17:12 -0500)]
bdev.c: don't free right before exit

Also log execlp error code if it returns.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoPass through all options with -Bbest.
Sidnei da Silva [Tue, 22 Oct 2013 21:52:30 +0000 (19:52 -0200)]
Pass through all options with -Bbest.

Remove the union in bdev_specs and store all options if -Bbest is passed. Fixes issue #31.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoinstall lua module 0644 instead of 0755
Dwight Engen [Tue, 22 Oct 2013 20:33:34 +0000 (16:33 -0400)]
install lua module 0644 instead of 0755

Fixes rpmlint error "script-without-shebang". Checked other lua modules
and none are installed with execute permission.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoupdate rpm .spec file
Dwight Engen [Tue, 22 Oct 2013 20:33:26 +0000 (16:33 -0400)]
update rpm .spec file

The following changes were made to fix rpmlint warnings/errors
- use %global instead of %define
  http://fedoraproject.org/wiki/PackagingDrafts/global_preferred_over_define
- change Summary to match .deb
- update License
- do not mention the libcap dependency explicitly, rpm will fill it in
- fix Summary, Description for libs and devel packages
- pass -q to %setup
- add %post for libs to run ldconfig
- explicitly name lxc man paths so pkg doesn't "own" /usr/share/man
- mark /etc/lxc/default.conf as a config file

In addition, while I was here:
- split lua bits into seperate lxc-lua package
- change Description to match .deb
- remove "Version" in changelog entries to follow
  http://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-busybox: don't copy temp mounts into mtab
Serge Hallyn [Tue, 22 Oct 2013 16:34:46 +0000 (11:34 -0500)]
lxc-busybox: don't copy temp mounts into mtab

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-alpine: allow /dev/full
Natanael Copa [Tue, 22 Oct 2013 11:23:31 +0000 (13:23 +0200)]
lxc-alpine: allow /dev/full

The template creates /dev/full for the container but needs also give
permission to access it.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoget rid of '${lxcpath}_anon' idea
Serge Hallyn [Mon, 21 Oct 2013 23:44:03 +0000 (18:44 -0500)]
get rid of '${lxcpath}_anon' idea

The idea was simply misguided.

If you provide a custom configuration file, you still should be
putting the command sock into the real lxcpath, not an 'anon' one.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese lxc-create(1) for --thinpool option
tenforward [Sun, 20 Oct 2013 13:37:28 +0000 (22:37 +0900)]
doc: Update Japanese lxc-create(1) for --thinpool option

Update for commit 62c70ee2c1b49e7ecd2bfe156a66cbcfc5ecb502

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFallback lvs comparison to false.
Sidnei da Silva [Mon, 21 Oct 2013 22:16:32 +0000 (20:16 -0200)]
Fallback lvs comparison to false.

If lvs invocation fails or doesn't return any output, then lv flags comparison to false.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoStore fssize and fstype in the right struct.
Sidnei da Silva [Mon, 21 Oct 2013 21:22:58 +0000 (19:22 -0200)]
Store fssize and fstype in the right struct.

When using the -Bloop option, fstype and fssize arguments were copied
into the lvm struct of bdev specs instead of the loop struct.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAssume a default thin pool named 'lxc'.
Sidnei da Silva [Mon, 21 Oct 2013 20:33:02 +0000 (18:33 -0200)]
Assume a default thin pool named 'lxc'.

Will fallback to no thinpool if not present or if thin pool provided on the command line does not exist.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoUpdate maintainers and URLs
Stéphane Graber [Sun, 20 Oct 2013 04:48:48 +0000 (00:48 -0400)]
Update maintainers and URLs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix typos identified by lintian
Stéphane Graber [Sun, 20 Oct 2013 04:34:07 +0000 (00:34 -0400)]
Fix typos identified by lintian

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix following compile error on ubuntu 12.10
S.Çağlar Onur [Sat, 19 Oct 2013 04:45:03 +0000 (00:45 -0400)]
Fix following compile error on ubuntu 12.10

[...]
make[3]: Entering directory `/home/caglar/Projects/lxc/src/tests'
depbase=`echo attach.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        gcc -DHAVE_CONFIG_H -I. -I../../src    -I../../src -DLXCROOTFSMOUNT=\"/usr/lib/x86_64-linux-gnu/lxc/rootfs\" -DLXCPATH=\"/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/etc/lxc/lxc.conf\" -DLXCINITDIR=\"/usr/libexec\" -DLXC_DEFAULT_CONFIG=\"/etc/lxc/default.conf\"   -g -O2 -Wall -Werror -MT attach.o -MD -MP -MF $depbase.Tpo -c -o attach.o attach.c &&\
        mv -f $depbase.Tpo $depbase.Po
attach.c: In function ‘main’:
attach.c:380:2: error: implicit declaration of function ‘test_lsm_detect’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[3]: *** [attach.o] Error 1
[...]

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agouse snapshot_destroy in tests/snapshot.c and clean up containers after the test run
S.Çağlar Onur [Sat, 19 Oct 2013 04:51:21 +0000 (00:51 -0400)]
use snapshot_destroy in tests/snapshot.c and clean up containers after the test run

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agointroduce snapshot_destroy
S.Çağlar Onur [Sat, 19 Oct 2013 04:49:20 +0000 (00:49 -0400)]
introduce snapshot_destroy

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocall lxc_container_put when needed in lxc_destroy.c
S.Çağlar Onur [Sat, 19 Oct 2013 04:48:08 +0000 (00:48 -0400)]
call lxc_container_put when needed in lxc_destroy.c

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agochange version to 1.0.0.alpha2 in configure.ac
Stéphane Graber [Fri, 18 Oct 2013 22:11:53 +0000 (18:11 -0400)]
change version to 1.0.0.alpha2 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxccontainer.c: Replace rindex by strrchr (bionic)
Stéphane Graber [Fri, 18 Oct 2013 22:00:24 +0000 (18:00 -0400)]
lxccontainer.c: Replace rindex by strrchr (bionic)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolsm.h: Fix inline definition
Stéphane Graber [Fri, 18 Oct 2013 21:59:43 +0000 (17:59 -0400)]
lsm.h: Fix inline definition

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAllocate cmd string with alloca instead of malloc, close popen handle if fgets fails.
Sidnei da Silva [Fri, 18 Oct 2013 19:35:55 +0000 (16:35 -0300)]
Allocate cmd string with alloca instead of malloc, close popen handle if fgets fails.

10 years agoDocument the new --thinpool option
Sidnei da Silva [Fri, 18 Oct 2013 19:15:31 +0000 (16:15 -0300)]
Document the new --thinpool option

10 years agoAdd a --thinpool argument to lxc-create, to use thin pool backed lvm when creating...
Sidnei da Silva [Mon, 19 Aug 2013 22:34:19 +0000 (19:34 -0300)]
Add a --thinpool argument to lxc-create, to use thin pool backed lvm when creating the container. When cloning a container backed by a thin pool, the clone will default to the same thin pool.

10 years agouse proper config item depending on which lsm is enabled
Dwight Engen [Fri, 18 Oct 2013 18:31:53 +0000 (14:31 -0400)]
use proper config item depending on which lsm is enabled

On a system with AppArmor enabled, if lxc.se_context is configured but
lxc.aa_profile is not (because the user just wants to use the default
AppArmor profile) lxc was passing the lxc.se_context to be set as the
new AppArmor profile. Determine which configuration item to use based
on which lsm is enabled.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agosupport setting lsm label at exec or immediately
Dwight Engen [Thu, 17 Oct 2013 17:02:49 +0000 (13:02 -0400)]
support setting lsm label at exec or immediately

- Add attach test cases

- Moved setting of LSM label later to avoid failure of IPC between parent
  and child during attach

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd lsm op for getting name of enabled lsm
Dwight Engen [Fri, 18 Oct 2013 17:44:56 +0000 (13:44 -0400)]
add lsm op for getting name of enabled lsm

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: enable loopback interface by default
Natanael Copa [Wed, 16 Oct 2013 12:55:31 +0000 (14:55 +0200)]
lxc-alpine: enable loopback interface by default

It was probably disabled by a mistake

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-start-ephemeral: Fix broken mount logic
Stéphane Graber [Fri, 18 Oct 2013 17:27:46 +0000 (13:27 -0400)]
lxc-start-ephemeral: Fix broken mount logic

This reworks the mount logic for lxc-start-ephemeral to be as follow:
 - Any real (non-bind) entry gets copied to the target fstab
 - Any bind-mount from a virtual fs gets copied to the target fstab
 - Any remaining bind-mount if confirmed to be valid gets setup as an
   overlay.

Extra bind-mounts passed through the -b option are mounted by the
pre-mount script and don't need processing by the fstab generator.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-test-ubuntu: also allow the standard non-nested apparmor policy
Serge Hallyn [Fri, 18 Oct 2013 15:42:14 +0000 (10:42 -0500)]
lxc-test-ubuntu: also allow the standard non-nested apparmor policy

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoparse.c: don't print error message on callback rv > 0
Serge Hallyn [Fri, 18 Oct 2013 15:31:27 +0000 (10:31 -0500)]
parse.c: don't print error message on callback rv > 0

A callback return value < 0 means there was an error, so print
out an error message.  But a rv > 0 is used by the mount_unknown_fs
functions to say "we found the one we want, stop here."

Document this, and only print an error message if rv < 0.  Otherwise,

lxc-create -B lvm --fstype ext3 -t ubuntu -n u1

will print an (innocuous) error message about being unable to parse
the config value 'ext3'.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoChange configure, replacing mandriva by openmandriva
Alexander Khryukin [Fri, 18 Oct 2013 12:41:02 +0000 (16:41 +0400)]
Change configure, replacing mandriva by openmandriva

The latest Mandriva distro release was in 2011 and nowadays distro named
OpenMandriva Lx.

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: Remove perl, use sed instead
Laurent Vallar [Wed, 16 Oct 2013 20:46:57 +0000 (22:46 +0200)]
lxc-debian: Remove perl, use sed instead

Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: Force locales generation
Laurent Vallar [Wed, 16 Oct 2013 16:04:15 +0000 (18:04 +0200)]
lxc-debian: Force locales generation

Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-attach: fixed typo: privleges -> privileges
Dmitry Yu Okunev [Wed, 16 Oct 2013 09:41:45 +0000 (13:41 +0400)]
lxc-attach: fixed typo: privleges -> privileges

Signed-off-by: Dmitry Yu Okunev <dyokunev@ut.mephi.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd lsm op for checking if an lsm is present/enabled
Dwight Engen [Tue, 15 Oct 2013 17:51:20 +0000 (13:51 -0400)]
add lsm op for checking if an lsm is present/enabled

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofix busybox template for use with AppArmor
Dwight Engen [Tue, 15 Oct 2013 17:51:14 +0000 (13:51 -0400)]
fix busybox template for use with AppArmor

Ensure /proc and /sys are mounted in the container, otherwise
apparmor_enabled() will fail to find
/sys/module/apparmor/parameters/enabled

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agooracle template: fix selinux context on symlinks in /dev
Dwight Engen [Thu, 17 Oct 2013 15:09:36 +0000 (11:09 -0400)]
oracle template: fix selinux context on symlinks in /dev

This fixes sshd getting an avc on traversing the /dev/ptmx symlink
(was default_t)

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoImproper pty permissions - missing mode=0620, gid=5
Stéphane Graber [Tue, 15 Oct 2013 18:54:41 +0000 (14:54 -0400)]
Improper pty permissions - missing mode=0620, gid=5

This fix is coming from Debian bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720122

The reason for the hardcoded gid= and mode= is because of the fix for
CVE-2013-2207 which removes pt_chown from glibc and so requires proper
write access to devpts.

It looks like the "tty" group is guaranteed to be gid=5 on at least all
RedHat based and Debian based systems. So this hardcode gid shouldn't be
a big problem. If we however support any distro where that's not the
case, we'll need to implement an extra lxc.conf option and matching
template changes.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd more detail in automount error message
Dwight Engen [Tue, 15 Oct 2013 17:50:58 +0000 (13:50 -0400)]
add more detail in automount error message

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoMake 'make dist' match git content
Stéphane Graber [Tue, 15 Oct 2013 15:17:55 +0000 (11:17 -0400)]
Make 'make dist' match git content

This fixes a few obvious issues when comparing the make dist output with
the git tree.

 - Make all templates non-executable in git
 - Remove unused files:
   - src/lxc/list.c (empty, only includes the list.h header)
   - src/lxc/lxc-destroy.in (replace by lxc_destroy.c)
 - Add missing files to dist tarball:
   - src/python-lxc/examples/pyconsole.py
   - src/python-lxc/examples/pyconsole-vte.py
 - Mark all the python API tests executable
 - Mark lxc-test-ubuntu executable

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-debian: Add --arch option
Laurent Vallar [Mon, 14 Oct 2013 15:23:47 +0000 (17:23 +0200)]
lxc-debian: Add --arch option

Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: Add support for --release
Laurent Vallar [Wed, 9 Oct 2013 12:57:51 +0000 (14:57 +0200)]
lxc-debian: Add support for --release

Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Improve Japanese lxc.conf(5) to be easy to read
KATOH Yasufumi [Fri, 11 Oct 2013 10:49:06 +0000 (19:49 +0900)]
doc: Improve Japanese lxc.conf(5) to be easy to read

Change the location of linefeed for improving to be read lxc.conf(5) in
Japanese environment.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodefine list container api (v2)
Serge Hallyn [Fri, 11 Oct 2013 15:44:39 +0000 (10:44 -0500)]
define list container api (v2)

Two new commands are defined: list_defined_containers() and
list_active_containers().  Both take an lxcpath (NULL means
use the default lxcpath) and return the number of containers
found.  If a lxc_container ** is passed in, then an array of
lxc_container's is returned, one for each container found.
The caller must then lxc_container_put() each container and
free the array, as shown in the new list testcase.
If a char ** is passed in, then an array of container names
is returned, after which the caller must free all the names
and the name array, as showsn in the testcase.

Changelog:
Check for the container config file before trying to
create an lxc_container *, to save some work. [ per
stgraber comments]
Add names ** argument to return only container names.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix clone prototype
Dwight Engen [Thu, 10 Oct 2013 16:59:04 +0000 (12:59 -0400)]
fix clone prototype

gcc was complaining with:
reboot.c:33: error: conflicting types for ‘clone’
/usr/include/bits/sched.h:83: note: previous declaration of ‘clone’ was here

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd $arch to cache path
Alexander Khryukin [Thu, 10 Oct 2013 15:01:43 +0000 (19:01 +0400)]
add $arch to cache path

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix typo and minor cleanup
Alexander Khryukin [Thu, 10 Oct 2013 14:46:53 +0000 (18:46 +0400)]
fix typo and minor cleanup

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agominor cleanup in template and add systemd_configure function with openmandriva-relate...
Alexander Khryukin [Thu, 10 Oct 2013 14:31:10 +0000 (18:31 +0400)]
minor cleanup in template and add systemd_configure function with openmandriva-related tricks

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix .gitignore file and add a little improvements to openmandriva template
Alexander Khryukin [Thu, 10 Oct 2013 09:59:54 +0000 (13:59 +0400)]
fix .gitignore file and add a little improvements to openmandriva template

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd an OpenMandriva distro lxc-openmandriva template
Alexander Khryukin [Wed, 9 Oct 2013 09:55:57 +0000 (13:55 +0400)]
Add an OpenMandriva distro lxc-openmandriva template

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotemplate: Improved lxc-plamo template
KATOH Yasufumi [Thu, 10 Oct 2013 06:54:54 +0000 (15:54 +0900)]
template: Improved lxc-plamo template

lxc-plamo now work with any distribution other than Plamo Linux.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotemplate: Add Plamo Linux template
KATOH Yasufumi [Wed, 9 Oct 2013 10:00:32 +0000 (19:00 +0900)]
template: Add Plamo Linux template

This template allows to create Plamo Linux container on Plamo
Linux. Plamo Linux is Japanese distribution, which is originally based
on Slackware Linux.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd lxc-test-ubuntu to the dist tarball
Stéphane Graber [Wed, 9 Oct 2013 22:09:56 +0000 (18:09 -0400)]
Add lxc-test-ubuntu to the dist tarball

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoubuntu-cloud-prep hook: fix debug helper to not inappropriately fail
Serge Hallyn [Wed, 9 Oct 2013 18:01:18 +0000 (13:01 -0500)]
ubuntu-cloud-prep hook: fix debug helper to not inappropriately fail

Bug found by Vincent Ladeuil <vila+ci@canonical.com>
Fix suggested by Scott Moser <smoser@ubuntu.com>

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoensure gnutls is initialized before use
Dwight Engen [Tue, 8 Oct 2013 16:22:57 +0000 (12:22 -0400)]
ensure gnutls is initialized before use

Section 7.1.2 of the gnutls info manual states that it must be
initialized with a call to gnutls_global_init before use. This
fixes the syslog warning I was seeing:

  lxc-create: Libgcrypt warning: missing initialization -
              please fix the application

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Fix Japanese lxc.conf(5) man page
KATOH Yasufumi [Tue, 8 Oct 2013 07:40:20 +0000 (16:40 +0900)]
doc: Fix Japanese lxc.conf(5) man page

Same as the commit 3157e673952bb857caf98666983eb5c0aec831a9

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Generate Japanese lxc-snapshot(1) man page
KATOH Yasufumi [Tue, 8 Oct 2013 07:15:05 +0000 (16:15 +0900)]
doc: Generate Japanese lxc-snapshot(1) man page

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ubuntu-cloud: Cope with spaces in paths
Stéphane Graber [Tue, 8 Oct 2013 14:51:53 +0000 (10:51 -0400)]
lxc-ubuntu-cloud: Cope with spaces in paths

Reported-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ubuntu-cloud: pass --numeric-owner and -p to untar
Scott Moser [Tue, 8 Oct 2013 00:41:23 +0000 (20:41 -0400)]
lxc-ubuntu-cloud: pass --numeric-owner and -p to untar

Just following up here, Serge raised the question of whether or not the
other two invocations of 'tar' in this script need '--numeric-owner'.
They probably should have it, although its of little concern because the
'build_root_tgz' path is only taken if there is no '-root.tar.gz' file for
download, and the only supported ubuntu release without the -root.tar.gz
download is 10.04 at this point.

Anyway, below is a more complete diff, also including a fix as
'--numeric-uid' is not a valid option to tar.  The name is
'--numeric-owner'.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocoverity: free dent_buf on error path (cgroup.c)
Serge Hallyn [Mon, 7 Oct 2013 19:10:29 +0000 (14:10 -0500)]
coverity: free dent_buf on error path (cgroup.c)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofree cgroup_tasks_fn after use
Serge Hallyn [Mon, 7 Oct 2013 19:07:43 +0000 (14:07 -0500)]
free cgroup_tasks_fn after use

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: closedir on error path
Serge Hallyn [Mon, 7 Oct 2013 19:03:20 +0000 (14:03 -0500)]
coverity: closedir on error path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoalways include the ja manpage sources in make dist
Dwight Engen [Fri, 4 Oct 2013 17:45:59 +0000 (13:45 -0400)]
always include the ja manpage sources in make dist

These need to be in the dist tarball even if the host packaging system
doesn't have docbook2x, otherwise configure will fail to find them. Also,
the build system may have docbook2x, even if the packaging system does not.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofix errors when using docbook2man
Dwight Engen [Fri, 4 Oct 2013 17:46:05 +0000 (13:46 -0400)]
fix errors when using docbook2man

docbook2man picks up some errors that docbook2x does not, fixing them
isn't harmful to docbook2x. The only real change is adding <para> and
<citerefentry> tags.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agooracle template: add openssh-clients to enable scp in/out of container
Dwight Engen [Fri, 4 Oct 2013 17:45:53 +0000 (13:45 -0400)]
oracle template: add openssh-clients to enable scp in/out of container

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agotemplates/lxc-fedora Network startup w/o Network Manager
Michael H. Warfield [Fri, 4 Oct 2013 17:39:05 +0000 (13:39 -0400)]
templates/lxc-fedora Network startup w/o Network Manager

This patches the Fedora template to insure that the legacy network
startup scripts are enabled when NetworkManager has not been installed
in the container (default).

It also fixes a login problem with pam_loginuid.so in a container.
https://bugzilla.redhat.com/show_bug.cgi?id=966807

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
--
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agotrivial: remove trailing whitespce from lxc-fedora
Serge Hallyn [Fri, 4 Oct 2013 19:54:54 +0000 (14:54 -0500)]
trivial: remove trailing whitespce from lxc-fedora

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-fedora: remove 4:0 and 4:1 from devices whitelist
Serge Hallyn [Fri, 4 Oct 2013 15:53:21 +0000 (10:53 -0500)]
lxc-fedora: remove 4:0 and 4:1 from devices whitelist

They are the real /dev/tty{0,1}, which are physical consoles.  Lxc
bind-mounts over them.  Don't let the container use these!

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocall lxc_container_put when appropriate
S.Çağlar Onur [Fri, 4 Oct 2013 03:54:50 +0000 (23:54 -0400)]
call lxc_container_put when appropriate

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-ubuntu: Remove trim option
Stéphane Graber [Fri, 4 Oct 2013 02:41:59 +0000 (22:41 -0400)]
lxc-ubuntu: Remove trim option

Container trimming is a bad idea in general, Ubuntu since 12.04 allows
standard systems to run in containers and we've got separate code to
deal with 10.04, so let's just drop trim.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agotemplates/lxc-fedora Rework for distro independence.
Michael H. Warfield [Wed, 2 Oct 2013 20:22:45 +0000 (16:22 -0400)]
templates/lxc-fedora Rework for distro independence.

This patch reworks the Fedora template to operate in the most "distro
agnostic" manner possible.  It should even run on distros where rpm and
yum are not present and not available or may be incompatible.  It
depends on the most basic set of system facilities like rsync but does
require squashfs support also be available to mount a LiveOS runtime.

Based on comments at Linux Plumbers, what I had been referring to as a
"run time environment" or RTE has been renamed in the code to refer to
it as a "bootstrap".  It has been tested on Fedora (of course),
OpenSuse, Ubuntu, and Oracle (latest host versions of each) building
Fedora containers of F19 back through F9.  Varying levels of database
problems were encountered from F11 and back and are "will not fix" due
to versions being long EOL.  F15 and F16 build but do not run "out of
the box" due to systemd version issues and those are also "will not fix"
for the same reasons.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoadd basic lxc-test-ubuntu (v3)
Serge Hallyn [Thu, 3 Oct 2013 03:30:31 +0000 (22:30 -0500)]
add basic lxc-test-ubuntu (v3)

Some features of lxc - networking and LSM configuration for instance -
are generally configured by the distro packages.  This program
tests the Ubuntu configuration.

changelog v2:
  Switch to lxc-info -i to detect ip address as stgraber suggested
  Don't look for 'expect' as I'm not using it yet.
changelog v3:
  Make sure to only read one ip address from container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoconfile.c: cast size_t to prevent compile failure on 386
Serge Hallyn [Thu, 3 Oct 2013 17:10:07 +0000 (12:10 -0500)]
confile.c: cast size_t to prevent compile failure on 386

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoImprove behaviour for unprivileged users
Stéphane Graber [Wed, 2 Oct 2013 22:25:37 +0000 (18:25 -0400)]
Improve behaviour for unprivileged users

This mostly changes two things:
 - Only log to the container's logfile on start/stop/restart/execute
 - Call may_control() every time we use the API and return
   "Insufficient privileges" on failure.

NOTE: I didn't test every single one of those but I'm fairly confident
      in my copy/paste abilities and I confirmed they all build fine at least.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoadd new tests to .gitignore
Serge Hallyn [Wed, 2 Oct 2013 04:15:36 +0000 (23:15 -0500)]
add new tests to .gitignore

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoadd reboot test
Serge Hallyn [Wed, 2 Oct 2013 04:15:01 +0000 (23:15 -0500)]
add reboot test

It's really more of a kernel check, but worth having.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agolxc-checkconfig: suggest modprobe configs
Stéphane Graber [Wed, 2 Oct 2013 21:22:52 +0000 (17:22 -0400)]
lxc-checkconfig: suggest modprobe configs

 give hint to user to modprobe configs (altho could just modprobe it?)

Signed-off-by: Elan Ruusamäe <glen@delfi.ee>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoCheck return value of ifa_get_local_ip
Stéphane Graber [Wed, 2 Oct 2013 21:18:48 +0000 (17:18 -0400)]
Check return value of ifa_get_local_ip

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>