]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
11 years agocoverity: fix mix of bool and int
Serge Hallyn [Thu, 12 Dec 2013 19:47:24 +0000 (13:47 -0600)] 
coverity: fix mix of bool and int

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agocoverity: avoid deref of explicitly NULL variable on error path
Serge Hallyn [Thu, 12 Dec 2013 18:57:21 +0000 (12:57 -0600)] 
coverity: avoid deref of explicitly NULL variable on error path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agocoverity: fix use before null check
Serge Hallyn [Thu, 12 Dec 2013 18:51:35 +0000 (12:51 -0600)] 
coverity: fix use before null check

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agocoverity: change flow to safely free in all exit paths
Serge Hallyn [Thu, 12 Dec 2013 18:47:14 +0000 (12:47 -0600)] 
coverity: change flow to safely free in all exit paths

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agocoverity: fix memleak in userns_exec_1
Serge Hallyn [Thu, 12 Dec 2013 18:30:13 +0000 (12:30 -0600)] 
coverity: fix memleak in userns_exec_1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agocoverity : fix memleak on error path
Serge Hallyn [Thu, 12 Dec 2013 18:23:34 +0000 (12:23 -0600)] 
coverity : fix memleak on error path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agodon't run lxc-user-nic for empty netns
Serge Hallyn [Thu, 12 Dec 2013 18:12:06 +0000 (12:12 -0600)] 
don't run lxc-user-nic for empty netns

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agotypo fix: create $rootfs/dev/pts
Serge Hallyn [Thu, 12 Dec 2013 18:07:36 +0000 (12:07 -0600)] 
typo fix: create $rootfs/dev/pts

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Support unpriv containers
Stéphane Graber [Wed, 11 Dec 2013 19:46:34 +0000 (14:46 -0500)] 
python3: Support unpriv containers

This removes any existing uid check in the python3 binding and tools,
replacing those by .controllable where appropriate.

Extra checks are also added to make lxc-ls work as a user, returning as
much information as can possibly be retrieved.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoinitialize stopped at top of lxc_cmd
Serge Hallyn [Wed, 11 Dec 2013 21:15:31 +0000 (15:15 -0600)] 
initialize stopped at top of lxc_cmd

and don't do it at all the callers

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoFix uninitialized value in lxc_try_cmd
Stéphane Graber [Wed, 11 Dec 2013 20:51:14 +0000 (15:51 -0500)] 
Fix uninitialized value in lxc_try_cmd

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ls: Detect missing setns support
Stéphane Graber [Wed, 11 Dec 2013 19:02:20 +0000 (14:02 -0500)] 
lxc-ls: Detect missing setns support

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoplamo: Update because rc script of plamo was updated
KATOH Yasufumi [Wed, 11 Dec 2013 07:19:23 +0000 (16:19 +0900)] 
plamo: Update because rc script of plamo was updated

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>
11 years agoubuntu: Make vim part of base template
Stéphane Graber [Tue, 10 Dec 2013 23:04:07 +0000 (18:04 -0500)] 
ubuntu: Make vim part of base template

This moves vim back to the default list of packages, drops the duplicate
ssh entry which means that unless extra packages are passed through
--packages, container creation won't invoke apt-get anymore.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoMake public API string method parameters const where possible.
James Hunt [Tue, 10 Dec 2013 10:29:59 +0000 (10:29 +0000)] 
Make public API string method parameters const where possible.

Signed-off-by: James Hunt <james.hunt@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-test-concurrent: initialize saveptr before use
Qiang Huang [Tue, 10 Dec 2013 11:37:46 +0000 (19:37 +0800)] 
lxc-test-concurrent: initialize saveptr before use

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoubuntu: Add comment about the mounting profile
Stéphane Graber [Mon, 9 Dec 2013 22:05:26 +0000 (17:05 -0500)] 
ubuntu: Add comment about the mounting profile

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoubuntu: add comments about running unconfined or nested containers
S.Çağlar Onur [Sat, 7 Dec 2013 23:04:10 +0000 (18:04 -0500)] 
ubuntu: add comments about running unconfined or nested containers

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agouse $LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release as lock filename
S.Çağlar Onur [Sat, 7 Dec 2013 22:52:14 +0000 (17:52 -0500)] 
use $LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release as lock filename

Otherwise one cannot create two containers with different releases
(let's say saucy [cached] and raring [not caced]) if both are not
cached on the local filesystem already. The lock blocks cached
one to move forward until not cached one finishes it's downloads.

Fix that by seperating locks using release names

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agouse /var/lock/subsys/lxc-centos instead of /var/lock/subsys/lxc as a lock name
S.Çağlar Onur [Sat, 7 Dec 2013 22:46:22 +0000 (17:46 -0500)] 
use /var/lock/subsys/lxc-centos instead of /var/lock/subsys/lxc as a lock name

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agocall fclose() for pid_fp on failure
S.Çağlar Onur [Sat, 7 Dec 2013 19:16:46 +0000 (14:16 -0500)] 
call fclose() for pid_fp on failure

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-busybox: make securityfs bind-mount optional
Bogdan Purcareata [Mon, 9 Dec 2013 12:10:15 +0000 (14:10 +0200)] 
lxc-busybox: make securityfs bind-mount optional

Prevent container start from failing when running Busybox containers on hosts without securityfs support.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-clone: proper type for getopt_long result
Bogdan Purcareata [Mon, 9 Dec 2013 14:39:46 +0000 (16:39 +0200)] 
lxc-clone: proper type for getopt_long result

While char is a signed type and should have no trouble
storing a "-1" value, getopt_long() will return a value of 255
instead of -1. This has been noticed on powerpc; there's also
some upstream talk about it at [1].

Change variable type from char to int, since it's also the
documented use.

[1] http://stackoverflow.com/questions/17070958/c-why-does-getopt-return-255-on-linux

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodoc: Update Japanese lxc-monitor(1)
KATOH Yasufumi [Mon, 9 Dec 2013 07:45:10 +0000 (16:45 +0900)] 
doc: Update Japanese lxc-monitor(1)

Update for commit 2afd1dc05ba38eacdfe5a9c79addaf3a7d182dbf

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoaltlinux: Use relative paths and fix rootfs variable.
Serge Logvinov [Sun, 8 Dec 2013 12:15:29 +0000 (16:15 +0400)] 
altlinux: Use relative paths and fix rootfs variable.

Change paths in fstab to be relative to the root and fix a wrong
rootfs_path value.

Signed-off-by: Serge Logvinov <serge.logvinov@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoUpdate mailing-list addresses
Stéphane Graber [Sun, 8 Dec 2013 22:51:28 +0000 (17:51 -0500)] 
Update mailing-list addresses

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc_monitor: Add missing include (errno.h)
Stéphane Graber [Fri, 6 Dec 2013 23:24:41 +0000 (18:24 -0500)] 
lxc_monitor: Add missing include (errno.h)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc_monitor: Check return value of write
Stéphane Graber [Fri, 6 Dec 2013 22:19:23 +0000 (17:19 -0500)] 
lxc_monitor: Check return value of write

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agobusybox template: set mode when creating device nodes
Dwight Engen [Fri, 6 Dec 2013 21:47:26 +0000 (16:47 -0500)] 
busybox template: set mode when creating device nodes

Ensure mode 666 is set for tty1 and tty5

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolet lxc-monitor command ask a lxc-monitord instance to quit
Dwight Engen [Fri, 6 Dec 2013 20:36:50 +0000 (15:36 -0500)] 
let lxc-monitor command ask a lxc-monitord instance to quit

Once lxc-monitord receives a quit request from lxc-monitor, it will then
return from the mainloop every time an event occurs on any of its fds and
check if it has any clients left. When there are no more it exits. This
allows lxc-monitord to quit immediately instead of waiting the normal 30
seconds for more clients, potentially freeing up lxcpath for unmounting.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoadd epoll events to mainloop callback handlers
Dwight Engen [Fri, 6 Dec 2013 20:36:44 +0000 (15:36 -0500)] 
add epoll events to mainloop callback handlers

Adding the epoll events allows the handler to determine what events
happened on the fd.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agooracle: fix chcon warning when selinux disabled
Dwight Engen [Fri, 6 Dec 2013 14:46:19 +0000 (09:46 -0500)] 
oracle: fix chcon warning when selinux disabled

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoconfile: Fix invalid lxc.network.ipv6 address
Stéphane Graber [Fri, 6 Dec 2013 20:28:55 +0000 (15:28 -0500)] 
confile: Fix invalid lxc.network.ipv6 address

The writer code was using AF_INET instead of AF_INET6 when converting
the address to ascii.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoMove some common Ubuntu config
Stéphane Graber [Sat, 30 Nov 2013 00:19:09 +0000 (19:19 -0500)] 
Move some common Ubuntu config

This introduces a new /usr/share/lxc/config directory containing common
configuration snippets.

The two Ubuntu templates are then simplified to just include the
relevant entries avoiding a whole lot of hardcoded cgroup, capabilities
and mount points configuration.

An extra comment is also added at the top of all generated configuration
files telling the user to look at lxc.conf(5) for more information.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoAdd support for new create=(dir,file) mount option
Stéphane Graber [Thu, 5 Dec 2013 20:37:56 +0000 (15:37 -0500)] 
Add support for new create=(dir,file) mount option

Just like we already had "optional", this adds two new LXC-specific
mount flags:
 - create=dir (will do a mkdir_p on the path)
 - create=file (will do a mkdir_p on the dirname + a fopen on the path)

This was motivated by some of the needed bind-mounts for the
unprivileged containers.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoconffile.c: Also clear text entries with no value
Stéphane Graber [Thu, 5 Dec 2013 22:13:18 +0000 (17:13 -0500)] 
conffile.c: Also clear text entries with no value

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Update Japanese lxc.conf(5)
KATOH Yasufumi [Fri, 6 Dec 2013 06:08:10 +0000 (15:08 +0900)] 
doc: Update Japanese lxc.conf(5)

translate the untranslated paragraph

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoMake lxc-user-nic use mkifname
Stéphane Graber [Thu, 5 Dec 2013 19:29:37 +0000 (14:29 -0500)] 
Make lxc-user-nic use mkifname

NetworkManager at least expects all veth devices to be called veth*
otherwise it'll consider them as physical interface and try to do DHCP
on them.

This change makes lxc-user-nic use the same function that we use for LXC
itself which will give us standard vethXXXXX kind of interfaces.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoadd destroy option to lxc-snapshot
S.Çağlar Onur [Tue, 3 Dec 2013 20:13:22 +0000 (15:13 -0500)] 
add destroy option to lxc-snapshot

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoFix Makefile.am to produce usable dist tarball
Stéphane Graber [Tue, 3 Dec 2013 22:04:03 +0000 (17:04 -0500)] 
Fix Makefile.am to produce usable dist tarball

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agopython3: Drop duplicate add_device_node function
Stéphane Graber [Tue, 3 Dec 2013 21:45:13 +0000 (16:45 -0500)] 
python3: Drop duplicate add_device_node function

It is now natively implemented in C, the new function takes the same
arguments (same order, different names) and has been confirmed to work
with lxc-device.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agopython3: Fix PEP8 and avoid crash when listing
Stéphane Graber [Tue, 3 Dec 2013 21:39:46 +0000 (16:39 -0500)] 
python3: Fix PEP8 and avoid crash when listing

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ubuntu: Replace the hostname in ssh pubkey
Stéphane Graber [Tue, 3 Dec 2013 20:15:41 +0000 (15:15 -0500)] 
lxc-ubuntu: Replace the hostname in ssh pubkey

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoReduce public API (V2)
Stéphane Graber [Mon, 2 Dec 2013 18:58:02 +0000 (13:58 -0500)] 
Reduce public API (V2)

This removes all but the following headers from our includes:
 - attach_options.h
 - lxccontainer.h
 - version.h

This also removes the duplicate lxc_version function (lxc_get_version
has been preferred for a while).

lxclock.h is now considered private.

As a result quite a lot of files needed addition of extra includes
previously inherited from lxclock.h.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoAdd LXC version information to version.h
S.Çağlar Onur [Mon, 2 Dec 2013 04:14:17 +0000 (23:14 -0500)] 
Add LXC version information to version.h

So that applications can get the LXC version number at compile time.

This can be used to make applications/bindings that support compiling against
multiple versions of LXC.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoSome tweak on previous change (timezone)
Stéphane Graber [Mon, 2 Dec 2013 22:42:48 +0000 (17:42 -0500)] 
Some tweak on previous change (timezone)

This adds the same code to the Debian-based templates (Ubuntu and Ubuntu
Cloud) and also avoids a needless fork.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-debian: Make timezone match the host
funditus [Mon, 25 Nov 2013 15:03:43 +0000 (21:03 +0600)] 
lxc-debian: Make timezone match the host

Set timezone in container as on the host

Signed-off-by: funditus <funditus@mail.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoconfile.c: clear entries if no value
Serge Hallyn [Mon, 2 Dec 2013 19:17:34 +0000 (13:17 -0600)] 
confile.c: clear entries if no value

For list configuration entries like capabilities and cgroups
entries, if there is a 'key =' value (i.e. "lxc.cap.drop =")
then clear any loaded entries.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoubuntu: Actually attempt to remove /dev/shm
Stéphane Graber [Sat, 30 Nov 2013 00:22:53 +0000 (19:22 -0500)] 
ubuntu: Actually attempt to remove /dev/shm

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agodoc: Update Japanese lxc-start(1)
KATOH Yasufumi [Mon, 2 Dec 2013 08:13:25 +0000 (17:13 +0900)] 
doc: Update Japanese lxc-start(1)

Update for commit 7faa7f52004943f339199bcbad1848cdf50d5f4c

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoUpdate doxygen doc for previous change
Stéphane Graber [Fri, 29 Nov 2013 16:31:32 +0000 (11:31 -0500)] 
Update doxygen doc for previous change

Reported-by: James Hunt <james.hunt@ubuntu.com>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAllow unsetting daemonize and close_fds
Stéphane Graber [Fri, 29 Nov 2013 15:53:15 +0000 (10:53 -0500)] 
Allow unsetting daemonize and close_fds

As mentioned in a previous commit, this does two changes:
 - Make want_daemonize return a bool (false on failure, true on success)
 - Make both want_daemonize and want_close_all_fds take a "state"
   argument so the user can choose to unset those flags.

This commit also updates all occurences of those two functions and turns
the daemonize attribute from an int to a bool.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Use FSConverter for all paths
Stéphane Graber [Thu, 28 Nov 2013 20:09:55 +0000 (15:09 -0500)] 
python3: Use FSConverter for all paths

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Allow setting daemonize and close_fds
Stéphane Graber [Thu, 28 Nov 2013 19:32:53 +0000 (14:32 -0500)] 
python3: Allow setting daemonize and close_fds

This extends the list of arguments of start() allowing the user to
request the container be started in the foreground and have control on
whether fds will be closed or not (daemonize=True implies that too).

One problem at the moment however is that while we have functions to set
close_fds and daemonize in the API, we don't have functions to unset
those flags, so those new parameters will only work on the initial call
to start() any further call will use the values of the previous one.

I think it'd make sense to change lxcapi slightly to have daemonize and
close_fds offer a similar interface, both returning booleans and both
accepting a value as a parameter so API users can set the value they
want.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add snapshot_* to the binding
Stéphane Graber [Thu, 28 Nov 2013 19:18:45 +0000 (14:18 -0500)] 
python3: Add snapshot_* to the binding

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agochown_mapped_root: fix assumption that calling uid == gid
Serge Hallyn [Fri, 29 Nov 2013 04:53:13 +0000 (22:53 -0600)] 
chown_mapped_root: fix assumption that calling uid == gid

Because if they are not, then we'll fail trying to map that gid into the
container.

The function doesn't change any gids, but lxc-usernsexec always does
setgid(0), so just map getgid() to 0 in the container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agopython3: Export some missing constants
Stéphane Graber [Thu, 28 Nov 2013 00:19:17 +0000 (19:19 -0500)] 
python3: Export some missing constants

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Allow passing create flags
Stéphane Graber [Thu, 28 Nov 2013 00:12:32 +0000 (19:12 -0500)] 
python3: Allow passing create flags

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add clone() to the binding
Stéphane Graber [Wed, 27 Nov 2013 23:27:27 +0000 (18:27 -0500)] 
python3: Add clone() to the binding

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoubuntu: Fix regression in post-process
Stéphane Graber [Thu, 28 Nov 2013 00:46:18 +0000 (19:46 -0500)] 
ubuntu: Fix regression in post-process

THe recent reorg of lxc-ubuntu introduced some package installation in
post-process but without first disabling service startup.

As a result, if the cache is a bit out of date and a ssh update is
available, post-process will apply that update (as it does apt-get
install ssh vim) which in turn will attemp to start sshd. This will
either lead to ssh on the host being restarted or if there's no sshd on
the host, will fail the container creation as the postinst will get an
error from upstart.

The fix is very simply to add the same policy-rc.d trick when running
post-process.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoFix typo in doxygen comment
Stéphane Graber [Wed, 27 Nov 2013 22:59:35 +0000 (17:59 -0500)] 
Fix typo in doxygen comment

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agopython3: Sort list of exports
Stéphane Graber [Wed, 27 Nov 2013 22:51:09 +0000 (17:51 -0500)] 
python3: Sort list of exports

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agopython3: Add (add|remove)_device_node
Stéphane Graber [Wed, 27 Nov 2013 21:57:58 +0000 (16:57 -0500)] 
python3: Add (add|remove)_device_node

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add controllable property to the binding
Stéphane Graber [Wed, 27 Nov 2013 18:49:03 +0000 (13:49 -0500)] 
python3: Add controllable property to the binding

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add clear_config() to the binding
Stéphane Graber [Wed, 27 Nov 2013 18:46:43 +0000 (13:46 -0500)] 
python3: Add clear_config() to the binding

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Re-order all functions
Stéphane Graber [Wed, 27 Nov 2013 18:42:19 +0000 (13:42 -0500)] 
python3: Re-order all functions

This properly regroups the module functions together and then sorts all
other functions alphabetically to match the function and property lists.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add reboot() to the binding
Stéphane Graber [Wed, 27 Nov 2013 18:31:05 +0000 (13:31 -0500)] 
python3: Add reboot() to the binding

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Sort all method/property lists
Stéphane Graber [Wed, 27 Nov 2013 16:59:16 +0000 (11:59 -0500)] 
python3: Sort all method/property lists

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Code style
Stéphane Graber [Wed, 27 Nov 2013 16:46:44 +0000 (11:46 -0500)] 
python3: Code style

Drop any tab as spaces are preferred, get everything to fit the 80char
limit.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agopython3: Add list_containers to C API
Stéphane Graber [Tue, 26 Nov 2013 20:58:44 +0000 (15:58 -0500)] 
python3: Add list_containers to C API

This adds a new list_containers function to the python3 binding and a
matching override in __init__.py that adds the as_object parameter.

This should be compatible to the previous pure python implementation
with the advantage of also listing active non-defined containers (fixing
github issue #68).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
11 years agoAdded templates/lxc-centos for CentOS containers.
Michael H. Warfield [Mon, 25 Nov 2013 19:34:40 +0000 (14:34 -0500)] 
Added templates/lxc-centos for CentOS containers.

This adds an lxc-centos template for crreating CentOS 5+ templates.  It
does NOT create CentOS 4 or earlier containers as these are way past
end of life and no longer supported.  It is based on the work of
Fajar A. Nugraha <github@fajar.net> who modified an earlier Fedora
template.  His work has been brought LARGELY into congruence with
the current Fedora template.  It still lacks the distro agnostic
bootstrap and systemd code from the Fedora template but those should
only be relevant with CentOS 7 when that can of worms pops open
sometime next year or so.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoSome tweaks to direct route to gateway
Stéphane Graber [Mon, 25 Nov 2013 19:33:15 +0000 (14:33 -0500)] 
Some tweaks to direct route to gateway

The previous patch added code to add a static route prior to adding the
gateway to the interface.

This commit simply changes the logic so that this is only done on
failure to add the gateway.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoAdd gateway as direct route for interface
Guilhem Lettron [Tue, 29 Oct 2013 02:31:49 +0000 (03:31 +0100)] 
Add gateway as direct route for interface

Signed-off-by: Guilhem Lettron <guilhem.lettron@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agousernsexec: Include utils.h for unshare
Stéphane Graber [Mon, 25 Nov 2013 23:24:03 +0000 (18:24 -0500)] 
usernsexec: Include utils.h for unshare

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agousernsexec: Add missing getline.h include
Stéphane Graber [Mon, 25 Nov 2013 23:22:05 +0000 (18:22 -0500)] 
usernsexec: Add missing getline.h include

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoMerge pull request #92 from majek/share-namespaces
hallyn [Mon, 25 Nov 2013 21:55:30 +0000 (13:55 -0800)] 
Merge pull request #92 from majek/share-namespaces

Add options to `lxc-start` to inherit network, ipc and uts namespaces

11 years agolxc-fedora: Fixes for selinux and pam_loginuid.so
Michael H. Warfield [Mon, 25 Nov 2013 17:31:30 +0000 (12:31 -0500)] 
lxc-fedora: Fixes for selinux and pam_loginuid.so

Just some additional catches for disabling selinux and pam_loginuid.so
thanks to Dwight Engen and the Oracle template.

Also add ssh and ssh-server to the default installation.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoFix stupid architecture error.
Michael H. Warfield [Mon, 25 Nov 2013 17:30:38 +0000 (12:30 -0500)] 
Fix stupid architecture error.

From 38cfabdbe0e46f5a0ed20687fcda48424b4a7b6d Mon Sep 17 00:00:00 2001
From: "Michael H. Warfield" <mhw@WittsEnd.com>
Date: Mon, 25 Nov 2013 10:34:48 -0500
Subject: [PATCH 1/2] Fix stupid architecture error.
Organization: Thaumaturgy & Speculums Technology

Fix stupid architecture error.

Stupid error and I did it!  Fixed hard coded x86_64 in several spots.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-user-nic: use common code from network.c
Serge Hallyn [Sat, 23 Nov 2013 02:04:59 +0000 (20:04 -0600)] 
lxc-user-nic: use common code from network.c

This pulls a lot of common code out of lxc_user_nic.c.  It also
moves one function from conf.c that was duplicated in lxc_user_nic.c
(It removes a DEBUG statement because (a) it doesn't seem actually
useful and (b) DEBUG doesn't work in network.c).

Also replace the old test of only parsing code with a skeleton for
a full test.  (Note - the test will need some work, it's just there
as do-what-i-mean code example)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-user-nic: dont risk passing EOF
Serge Hallyn [Sat, 23 Nov 2013 02:26:20 +0000 (20:26 -0600)] 
lxc-user-nic: dont risk passing EOF

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoConvert all files to utf-8
Stéphane Graber [Mon, 25 Nov 2013 17:59:07 +0000 (12:59 -0500)] 
Convert all files to utf-8

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoadd lxc-devsetup to EXTRA_DIST
Dwight Engen [Mon, 25 Nov 2013 17:00:01 +0000 (12:00 -0500)] 
add lxc-devsetup to EXTRA_DIST

fixes rpm build

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoTab/spaces consistency for templates
Stéphane Graber [Mon, 25 Nov 2013 16:57:34 +0000 (11:57 -0500)] 
Tab/spaces consistency for templates

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoDrop trailing white spaces.
Stéphane Graber [Mon, 25 Nov 2013 16:52:43 +0000 (11:52 -0500)] 
Drop trailing white spaces.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoAdd '--enable-api-docs' for doxygen-generated public API docs.
James Hunt [Mon, 25 Nov 2013 13:42:09 +0000 (13:42 +0000)] 
Add '--enable-api-docs' for doxygen-generated public API docs.

Signed-off-by: James Hunt <james.hunt@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ubuntu: Factorize @LOCALSTATEDIR@ variable
Guilhem Lettron [Thu, 14 Nov 2013 09:55:28 +0000 (10:55 +0100)] 
lxc-ubuntu: Factorize @LOCALSTATEDIR@ variable

Signed-off-by: Guilhem Lettron <guilhem.lettron@optiflows.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ubuntu: Add mirror and security-mirror options
Guilhem Lettron [Wed, 13 Nov 2013 13:22:10 +0000 (14:22 +0100)] 
lxc-ubuntu: Add mirror and security-mirror options

Signed-off-by: Guilhem Lettron <guilhem.lettron@optiflows.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ubuntu: Move package install to post-process
Guilhem Lettron [Wed, 13 Nov 2013 11:42:14 +0000 (12:42 +0100)] 
lxc-ubuntu: Move package install to post-process

Signed-off-by: Guilhem Lettron <guilhem.lettron@optiflows.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc-ubuntu: Add extra options
Guilhem Lettron [Thu, 31 Oct 2013 15:54:55 +0000 (16:54 +0100)] 
lxc-ubuntu: Add extra options

This adds support for "packages", "user" and "password"

Signed-off-by: Guilhem Lettron <guilhem.lettron@optiflows.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agouse awk, instead of 'grep | awk'
Elan Ruusamäe [Mon, 18 Nov 2013 23:23:33 +0000 (01:23 +0200)] 
use awk, instead of 'grep | awk'

Signed-off-by: Elan Ruusamäe <glen@delfi.ee>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodoc: Update Japanese lxc-attach(1)
KATOH Yasufumi [Thu, 21 Nov 2013 08:54:24 +0000 (17:54 +0900)] 
doc: Update Japanese lxc-attach(1)

Update for commit 4d69b2939ce09fbe624636dc01734a542e050ef9

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agodon't fail lxc-init if we couldn't mount proc
Serge Hallyn [Fri, 22 Nov 2013 21:43:51 +0000 (15:43 -0600)] 
don't fail lxc-init if we couldn't mount proc

In general proc gets mounted ahead of time, so init shouldn't
have to do it.  Without this patch, you cannot

lxc-execute -n x1 -s lxc.cap.drop=sys_admin /bin/bash

(See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1253669 for
a bug about this)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxcapi_destroy: run in a namespace if we are unprivileged
Serge Hallyn [Fri, 22 Nov 2013 20:39:37 +0000 (14:39 -0600)] 
lxcapi_destroy: run in a namespace if we are unprivileged

This is necessary to have the rights to remove files owned by our subuids.

Also update lxc_rmdir_onedev to return 0 on success, -1 on failure.
Callers were not consistent in using it correctly, and this is more
in keeping with the rest of our code.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoAdd lxc.service to extra_DIST
Stéphane Graber [Fri, 22 Nov 2013 19:35:33 +0000 (14:35 -0500)] 
Add lxc.service to extra_DIST

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoadd lxc-usernsexec to .gitignore
S.Çağlar Onur [Fri, 22 Nov 2013 18:55:16 +0000 (13:55 -0500)] 
add lxc-usernsexec to .gitignore

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoremove HAVE_NEWUIDMAP and NEWUIDMAP
Serge Hallyn [Fri, 22 Nov 2013 04:11:43 +0000 (22:11 -0600)] 
remove HAVE_NEWUIDMAP and NEWUIDMAP

Always build lxc-usernsexec.  Else we require having uidmap
installed on the build host for no good reason.  And we never
actually used the NEWUIDMAP path we detected.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agolxc_usernsexec: fix build breakage
Serge Hallyn [Fri, 22 Nov 2013 03:55:06 +0000 (21:55 -0600)] 
lxc_usernsexec: fix build breakage

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoSupport files for systemd on Fedora.
Michael H. Warfield [Tue, 12 Nov 2013 01:10:29 +0000 (20:10 -0500)] 
Support files for systemd on Fedora.

Added a file "lxc.service" for a systemd service file.

Added a file "lxc-devsetup" to setup /dev/ on startup to support autodev
in containers.

Service file references lxc-devsetup as an ExecStartPre command.  The
lxc-devsetup script is not dependent on systemd or Fedora and can
be used at bootup on any system.

Modified lxc.spec.in to install the two new files on Fedora.  The systemd
specific code in the lxc.spec file may need some review and conditionalize
for systemd on non-systemd rpm-based systems.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agolxcapi_clone: set the right environment variable for mounted fs
Serge Hallyn [Thu, 21 Nov 2013 15:05:59 +0000 (09:05 -0600)] 
lxcapi_clone: set the right environment variable for mounted fs

If the container is dir-backed, we don't actually mount it (to
support unprivileged use).  So always set the LXC_ROOTFS_MOUNT
to bdev->dest, not to the rootfs path specified in the container
configuration.

This should fix bug http://pad.lv/1253573

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
11 years agoSetup devtmpfs and /dev for autodev bind mounts.
Michael H. Warfield [Tue, 12 Nov 2013 01:08:36 +0000 (20:08 -0500)] 
Setup devtmpfs and /dev for autodev bind mounts.

If autodev is not specifically set to 0 or 1, attempts to determine if
systemd is being utilized and forces autodev=1 to prevent host system
conflicts and collisions.

If autodev is enabled and the host /dev is mounted with devtmpfs
or /dev/.lxc is mounted with another file system...

Each container created by a privileged user gets a /dev directory
mapped off the host /dev here:

/dev/.lxc/${name}.$( hash $lxcpath/$name )

Each container created by a non-privileged user gets a /dev/directory
mapped off the host /dev here:

/dev/.lxc/user/${name}.$( hash $lxcpath/$name )

The /dev/.lxc/user is mode 1777 to allow unpriv access.

The /dev/.lxc/{containerdev} is bind mounted into the container /dev.

Fallback on failure is to mount tmpfs into the container /dev.

A symlink is created from $lxcpath/$name/rootfs.dev back to the /dev
relative directory to provid a code consistent reference for updating
container devs.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>