]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 years agolxc-fedora: Show usage when no name is passed
Stéphane Graber [Wed, 2 Oct 2013 17:11:24 +0000 (13:11 -0400)] 
lxc-fedora: Show usage when no name is passed

Reported-by: Anatoly Techtonik
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc_init: Use sig_atomic_t for was_interrupted
Stéphane Graber [Wed, 2 Oct 2013 16:32:52 +0000 (12:32 -0400)] 
lxc_init: Use sig_atomic_t for was_interrupted

Suggested-by: Markus Elfring
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoAvoid ldconfig due to cross-compilation problems.
Andrey Mazo [Fri, 18 May 2012 17:11:22 +0000 (21:11 +0400)] 
Avoid ldconfig due to cross-compilation problems.

Otherwise, it cases problems on cbuild endianness != ctarget endianness
setups because /sbin/ldconfig expects elf header in the wrong endianness.

Signed-off-by: Andrey Mazo <ahippo@yandex.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agofix lxc-info segv on stopped container
Dwight Engen [Wed, 2 Oct 2013 16:14:58 +0000 (12:14 -0400)] 
fix lxc-info segv on stopped container

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agofedora: Use consistent tab/space indent
Stéphane Graber [Wed, 2 Oct 2013 15:47:12 +0000 (11:47 -0400)] 
fedora: Use consistent tab/space indent

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoUpdate lxc-fedora.in
Renich Bon Ciric [Wed, 25 Sep 2013 03:45:17 +0000 (22:45 -0500)] 
Update lxc-fedora.in

Fedora 19's release has no -1 revision; it's a -2 revision actually:
ftp://mirrors.kernel.org/fedora/releases/19/Fedora/x86_64/os/Packages/f/

Signed-off-by: Renich Bon Ciric <renich@woralelandia.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodoc: Fix some typos
KATOH Yasufumi [Tue, 1 Oct 2013 04:19:43 +0000 (13:19 +0900)] 
doc: Fix some typos

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodoc: Remove unnecessary Diagnostic entry in lxc-stop(1)
KATOH Yasufumi [Tue, 1 Oct 2013 04:16:42 +0000 (13:16 +0900)] 
doc: Remove unnecessary Diagnostic entry in lxc-stop(1)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodoc: Update lxc-monitor(1) man page
KATOH Yasufumi [Wed, 2 Oct 2013 07:02:15 +0000 (16:02 +0900)] 
doc: Update lxc-monitor(1) man page

- Update to commit 'fbf050e4c211030eb343008583f76605dfaaef38'
- Improve translation

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agolxc-monitor default name to .* to monitor all containers
Dwight Engen [Tue, 1 Oct 2013 15:25:46 +0000 (11:25 -0400)] 
lxc-monitor default name to .* to monitor all containers

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agogitignore doc/ja/legacy/*.1
Dwight Engen [Tue, 1 Oct 2013 14:04:18 +0000 (10:04 -0400)] 
gitignore doc/ja/legacy/*.1

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Update Japanese lxc.conf(5) man page
KATOH Yasufumi [Mon, 30 Sep 2013 08:30:45 +0000 (17:30 +0900)] 
doc: Update Japanese lxc.conf(5) man page

Add description of automatic mounting options

11 years agodoc: Update Japanese lxc-info(1) man page
KATOH Yasufumi [Mon, 30 Sep 2013 08:29:24 +0000 (17:29 +0900)] 
doc: Update Japanese lxc-info(1) man page

Add description of '-i' option

11 years agodoc: Update Japanese man pages translation
KATOH Yasufumi [Fri, 27 Sep 2013 07:09:57 +0000 (16:09 +0900)] 
doc: Update Japanese man pages translation

* sync current English man pages on master branch
* delete lxc-shutdown.sgml.in
* add lxc-snapshot.sgml.in
* update FSF address (same as 250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77)
* remove trailing whitespaces in legacy/lxc-ls.sgml.in (same as 8900b9eb2514c07047541833286428572493a9fd)

11 years agorefactor string conf items into common function
Dwight Engen [Mon, 30 Sep 2013 15:17:06 +0000 (11:17 -0400)] 
refactor string conf items into common function

- When doing the selinux change, I noticed that there was a lot of
  duplication of code in handing string configuration items, so I
  refactored this into a common function.

- Added a config_string_max that can be passed a maximum acceptable
  length, used to limit ttydir to NAME_MAX.

- The behavior of config_seccomp was different than other strings: if the
  item was already defined, then the second attempt to set it would fail
  instead of just replacing the value. Changed to just replace the value.

- Remove unused key and lxc_conf arguments to config_path_item().

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoRFC: lxclock: drop the chown+chmod of lockdir
Serge Hallyn [Mon, 30 Sep 2013 21:23:34 +0000 (16:23 -0500)] 
RFC: lxclock: drop the chown+chmod of lockdir

The original rationale for this was to make sure that if
lxcpath was /home/serge/lxcbase, then then lockdir
(/run/user/serge/lock/lxc/home/serge/lxcbase) would be
owned by the same user as /home/serge/lxcbase.

The only user who can chown to other uids (without CAP_CHOWN
added to fP) is root, who shouldn't be mucking with non-root
owned containers anyway.  In the meantime this causes a bunch
of noise for arguably no benefit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agotests/getkeys: return 0 on success
Serge Hallyn [Mon, 30 Sep 2013 20:52:49 +0000 (15:52 -0500)] 
tests/getkeys: return 0 on success

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoadd c->may_control
Serge Hallyn [Sat, 28 Sep 2013 02:01:07 +0000 (21:01 -0500)] 
add c->may_control

This is an api function which will return false if the container
is running, and the caller may not talk to its monitor over its
command socket.  Otherwise - if the container is not running, or
the caller may access it - it returns true.

We can use this in several tools early on to prevent the segvs
etc which we currently get.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoFix crasher in get_ips
Stéphane Graber [Sun, 29 Sep 2013 23:41:52 +0000 (19:41 -0400)] 
Fix crasher in get_ips

Check that the interface structure is not NULL before trying to access
its members.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoFix typo
Stéphane Graber [Fri, 27 Sep 2013 20:00:40 +0000 (16:00 -0400)] 
Fix typo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agovalgrind: fix small leak in cgroup
Dwight Engen [Fri, 27 Sep 2013 16:14:05 +0000 (12:14 -0400)] 
valgrind: fix small leak in cgroup

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAutomatic mounting: document options in lxc.conf(5) manpage
Christian Seiler [Tue, 24 Sep 2013 20:45:09 +0000 (22:45 +0200)] 
Automatic mounting: document options in lxc.conf(5) manpage

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAutomatic mounting: add more ways to mount the cgroup filesystem
Christian Seiler [Tue, 24 Sep 2013 20:45:08 +0000 (22:45 +0200)] 
Automatic mounting: add more ways to mount the cgroup filesystem

This adds quite a few more ways to mount the cgroup filesystem
automatically:

 - Specify ro/rw/mixed:
       - ro: everything mounted read-only
       - rw: everything mounted read-write
       - mixed: only container's own cgroup is rw, rest ro
                (default)
 - Add cgroup-full that mounts the entire cgroup tree to the
   corresponding directories. ro/rw/mixed also apply here.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAutomatic mounting: write lxc.mount.auto in write_config
Christian Seiler [Tue, 24 Sep 2013 20:45:07 +0000 (22:45 +0200)] 
Automatic mounting: write lxc.mount.auto in write_config

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAutomatic mounts: improvements for /proc and /sys
Christian Seiler [Tue, 24 Sep 2013 20:45:06 +0000 (22:45 +0200)] 
Automatic mounts: improvements for /proc and /sys

Improve lxc.mount.auto code: allow the user to specify whether to mount
certain things read-only or read-write. Also make the code much more
easily extensible for the future.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agolxc-info: Allow printing IP addresses
Stéphane Graber [Fri, 27 Sep 2013 04:23:09 +0000 (00:23 -0400)] 
lxc-info: Allow printing IP addresses

This adds a new -i flag to lxc-info to print the container's IP
addresses using get_ips().

Example:
$ lxc-info -n lxc-dev -s -p -i
state:  RUNNING
pid:    21331
ip:     10.0.3.165
ip:     2607:f2c0:f00f:2751:e9ca:842f:efa9:97d1
ip:     2607:f2c0:f00f:2751:216:3eff:fe3a:f1c1

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agolxc-info: Port to LXC API
Stéphane Graber [Fri, 27 Sep 2013 04:07:23 +0000 (00:07 -0400)] 
lxc-info: Port to LXC API

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agodrop now-useless have_tpath bool
Serge Hallyn [Thu, 26 Sep 2013 13:14:50 +0000 (08:14 -0500)] 
drop now-useless have_tpath bool

(Which will also break failure-to-build in the !HAVE_LIBGNUTLS
case)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agofix segfault on lxc-create with bad template name
Dwight Engen [Wed, 25 Sep 2013 22:18:28 +0000 (18:18 -0400)] 
fix segfault on lxc-create with bad template name

- change get_template_path() to only return NULL or non-NULL since one of
  the callers was doing a free(-1) which caused the segfault. Handle the
  NULL template case in the lxcapi_create() caller.

- make sure to free(tpath) in the sha1sum_file() failure case

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agorefactor AppArmor into LSM backend, add SELinux support
Dwight Engen [Tue, 24 Sep 2013 15:13:02 +0000 (11:13 -0400)] 
refactor AppArmor into LSM backend, add SELinux support

Currently, a maximum of one LSM within LXC will be initialized and
used. If in the future stacked LSMs become a reality, we can support it
without changing the configuration syntax and add support for more than
a single LSM at a time to the lsm code.

Generic LXC code should note that lsm_process_label_set() will take
effect "now" for AppArmor, and upon exec() for SELinux.

- fix Oracle template mounting of proc and sysfs, needed when using SELinux

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agofree kernel_subsystems in success case
Serge Hallyn [Wed, 25 Sep 2013 20:23:49 +0000 (15:23 -0500)] 
free kernel_subsystems in success case

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoREALLY always free(line)
Serge Hallyn [Wed, 25 Sep 2013 20:05:52 +0000 (15:05 -0500)] 
REALLY always free(line)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agofix up a few snafu's in forward-port of last commit
Serge Hallyn [Wed, 25 Sep 2013 20:01:54 +0000 (15:01 -0500)] 
fix up a few snafu's in forward-port of last commit

Make sure to free line.

Don't free 'info' when freeing base_info will later free info.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agofix some larger memory leaks in cgroup code
Dwight Engen [Tue, 24 Sep 2013 23:46:44 +0000 (18:46 -0500)] 
fix some larger memory leaks in cgroup code

Don't worry about saved_errno since none of the *_free routines will set it

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agosplit up lxc_cgroup_load_meta2
Serge Hallyn [Tue, 24 Sep 2013 23:45:56 +0000 (18:45 -0500)] 
split up lxc_cgroup_load_meta2

This one's easier to review by looking at the before and after files.  It
splits up lxc_cgroup_load_meta2() by adding 3 helpers.

The result seems easier to reason about.  A question I had, is, should
the kernel_subsystems ** be freed in the success case?  I assumed it was
being used elsewhere but I can't find where.  Currently it is only being
freed in the error case.  I suspect we want to free it in the success
case as well.

Cc: Christian Seiler <christian@iwakd.de>
Cc: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Japanese man pages is not generated when docbook-utils is used
KATOH Yasufumi [Wed, 25 Sep 2013 10:36:30 +0000 (19:36 +0900)] 
doc: Japanese man pages is not generated when docbook-utils is used

Character encoding of Japanese man pages is UTF-8. But docbook-utils
can't treat it (and don't have --encoding option that use in
Makefile). So change to Japanese man pages is not generated when
docbook-utils is used.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoutils: move remove_trailing_slashes to utils
Qiang Huang [Tue, 24 Sep 2013 07:27:53 +0000 (15:27 +0800)] 
utils: move remove_trailing_slashes to utils

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoarguments: remove trailing slashes for the input lxcpath
Qiang Huang [Tue, 24 Sep 2013 07:27:55 +0000 (15:27 +0800)] 
arguments: remove trailing slashes for the input lxcpath

In lxc_cmd(), we use
snprintf(path, len, "%s/%s/command", lxcpath ? lxcpath : inpath, name);
to fill sock name, this assume lxcpath have no trailing slashes, so
if we use
lxc-info -n test -P /usr/local/var/lib/lxc_anon/
to get a running container's state, we will get state: STOPPED which
is wrong, because we combine a wrong sock name.

To fix this, just remove trailing slashes when parsing arguments.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Fixed my first name
Stéphane Graber [Sat, 21 Sep 2013 22:43:48 +0000 (17:43 -0500)] 
doc: Fixed my first name

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Make everything use the @docdtd@ variable
Stéphane Graber [Sat, 21 Sep 2013 22:43:47 +0000 (17:43 -0500)] 
doc: Make everything use the @docdtd@ variable

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAdd some missing comments to configure.ac
Stéphane Graber [Sat, 21 Sep 2013 22:43:46 +0000 (17:43 -0500)] 
Add some missing comments to configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoConsistently use <lxc/lxccontainer.h> for the API
Stéphane Graber [Sat, 21 Sep 2013 22:43:45 +0000 (17:43 -0500)] 
Consistently use <lxc/lxccontainer.h> for the API

The API header was included in a variety of ways before, standardize
those to "include <lxc/lxccontainer.h>" as this will always work both in
tree and on a system with the headers installed.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoWhen callback of one config line fail, we'd better give the exactly
Qiang Huang [Mon, 23 Sep 2013 16:23:27 +0000 (11:23 -0500)] 
When callback of one config line fail, we'd better give the exactly
info to help users locate the misconfig.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoreturn the result of the lxcapi_want_close_all_fds call to the caller
S.Çağlar Onur [Sat, 21 Sep 2013 17:00:15 +0000 (13:00 -0400)] 
return the result of the lxcapi_want_close_all_fds call to the caller

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoExpose underlying close_all_fds config value via API
S.Çağlar Onur [Fri, 20 Sep 2013 22:45:21 +0000 (18:45 -0400)] 
Expose underlying close_all_fds config value via API

Being able to set close_all_fds via API would be usefull for the
situations like running an application (let's say web server)
that controls the lifecycle of the container using the LXC API.
We don't want forked process to inherit parent's resource (file, socket, ...)

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agofix console deadlocks
Serge Hallyn [Fri, 20 Sep 2013 19:24:36 +0000 (21:24 +0200)] 
fix console deadlocks

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-create: add -P to --lxcpath option help text
Serge Hallyn [Wed, 18 Sep 2013 19:00:02 +0000 (14:00 -0500)] 
lxc-create: add -P to --lxcpath option help text

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoRemove trailing whitespaces
Stéphane Graber [Wed, 18 Sep 2013 19:40:20 +0000 (14:40 -0500)] 
Remove trailing whitespaces

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoAdd get_interfaces to the API
S.Çağlar Onur [Wed, 18 Sep 2013 19:13:22 +0000 (15:13 -0400)] 
Add get_interfaces to the API

get_ips accepts an interface name as a parameter but there was no
way to get the interfaces names from the container. This patch
introduces a new get_interfaces call to the API so that users
can obtain the name of the interfaces.

Support for python bindings also introduced as a part of this version.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agomake heavier use of process_lock (v2)
Serge Hallyn [Mon, 16 Sep 2013 23:28:41 +0000 (18:28 -0500)] 
make heavier use of process_lock (v2)

pthread_mutex_lock() will only return an error if it was set to
PTHREAD_MUTEX_ERRORCHECK and we are recursively calling it (and
would otherwise have deadlocked).  If that's the case then log a
message for future debugging and exit.  Trying to "recover" is
nonsense at that point.

process_lock() was held over too long a time in lxcapi_start()
in the daemonize case.  (note the non-daemonized case still needs a
check to enforce that it must NOT be called while threaded).  Add
process_lock() at least across all open/close/socket() calls.

Anything done after a fork() doesn't need the locks as it is no
longer threaded - so some open/close/dups()s are not locked for
that reason.  However, some common functions are called from both
threaded and non-threaded contexts.  So after doing a fork(), do
a possibly-extraneous process_unlock() to make sure that, if we
were forked while pthread mutex was held, we aren't deadlocked by
nobody.

Tested that lp:~serge-hallyn/+junk/lxc-test still works with this
patch.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoadd arguments with getopt to concurrent tester
Dwight Engen [Mon, 16 Sep 2013 20:17:54 +0000 (16:17 -0400)] 
add arguments with getopt to concurrent tester

- add ability to run for multiple iterations
- can also run non-threaded for comparison to threaded case

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>