]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
14 years agolxc /cgroup/name/ not removed at container end
Michel Normand [Tue, 3 Nov 2009 10:40:42 +0000 (11:40 +0100)]
lxc /cgroup/name/ not removed at container end

this is a side effect of my previous patch
that removed the LXCPATH/name/nsgroup file.
9f44c57836626d8eb16c7bba4a5f5d88db74df01

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation error when buildir differs from srcdir
Daniel Lezcano [Fri, 23 Oct 2009 09:15:27 +0000 (11:15 +0200)]
fix compilation error when buildir differs from srcdir

Fix the include path for compiling and clean the Makefile.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michel Normand <normand@fr.ibm.com>
14 years agolxc: kill libtool
Cedric Le Goater [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
lxc: kill libtool

This is useless in a Linux only environment. The .so version is
the version of the package.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse config.h to define the lxcpath and co
Daniel Lezcano [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
use config.h to define the lxcpath and co

Instead of passing the LXCPATH definition in the compiler
command line, use configure.ac to define the value in the config.h
file and include this file where it is needed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove test directory
Daniel Lezcano [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
remove test directory

These tests are not relevant now. It would be better to write
some real test cases with some script using the lxc cli in order
to check non regression.
I remove these annoying tests I have to port each time a function
prototype is changed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomount /dev/mqueue
Daniel Lezcano [Thu, 15 Oct 2009 12:17:14 +0000 (14:17 +0200)]
mount /dev/mqueue

Mount always /dev/mqueue with lxc_init.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoclean up and factor out some code
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
clean up and factor out some code

Factor out some code and fix a memory corruption when
dupping the arguments.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix network prefix
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
Fix network prefix

Fix the missing network prefix. When no network prefix is specified,
the prefix is computed from the network class specified.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation error for tests
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
fix compilation error for tests

Fix test program compilation errors.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove configure dead code
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
remove configure dead code

Remove the old configuration remaining code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix tty creation using confdir
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
fix tty creation using confdir

tty_create uses the old conf directory, fixing this.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix netdev structure vs network structure
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
fix netdev structure vs network structure

The netdev vs network structure is not well defined. Fix that.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFactor out some network code
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
Factor out some network code

We can factor out the "ip addr add"

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUse the configuration structure for the network
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
Use the configuration structure for the network

We don't want to use anymore the configuration directory,
let's use the configuration structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoMove configuration info to the structure
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
Move configuration info to the structure

Move configuration informations from the handler structure to
the configuration structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoMove the configuration file to the start function
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
Move the configuration file to the start function

We want to store more information in the configuration structure,
especially the ttys.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration structure for the cgroup
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use the configuration structure for the cgroup

Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove the LXCPATH/<name>/nsgroup file
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
remove the LXCPATH/<name>/nsgroup file

There is no more need of this file so remove it.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the new nsgroup_path_get function in freezer.c
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use the new nsgroup_path_get function in freezer.c

to avoid to use the LXCPATH/<name>/nsgroup

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agonew lxc_cgroup_path_get function
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
new lxc_cgroup_path_get function

remove the usage of LXCPATH/<name>/nsgroup
in get/set function.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoplace nscgroup path in lxc_handler
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
place nscgroup path in lxc_handler

this also avoid to call two times get_cgroup_mount

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration structure for the tty
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use the configuration structure for the tty

Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse configuration structure for the mount points
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use configuration structure for the mount points

Do not use the directory configuration for the mount points.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUse the configuration structure for pts
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
Use the configuration structure for pts

Avoid to use the directory structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration structure to setup the utsname
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
use the configuration structure to setup the utsname

Use the configuration structure, not the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration structure for setting up the rootfs
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
use the configuration structure for setting up the rootfs

use the configuration structure for setting up the rootfs

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration to check if a resource is enabled
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
use the configuration to check if a resource is enabled

Remove the usage of the directory config for the setup and use the
configuration structure instead.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRead the config file at restart
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
Read the config file at restart

This patch makes the configuration to read the configuration
file in order to pass the configuration to the different functions.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomake container to die when parent dies
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
make container to die when parent dies

When the parent of the first process dies, the container stays there
making very difficuly to track it and to kill. We have to use the
lxc-ps --lxc and kill the processes, hoping we kill the init process
of the container. That's not a big deal until we have thousand of
processes in the container :)

We want to keep the parent of the container init always there, this
process is responsible to manage the container, provide tty, notify
the container changing states and ensure self exclusion (eg. avoid
to launch several containers with the same name).

If this process dies, we consider that as a fatal error and we make
the child process to die too. This patch will just add the prctl to
to send a SIGKILL to the container init process when its parent exits
For the point of view of the pid namespace, when the init process dies
all the processes of the namespace are killed too.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoSimplify the mainloop
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
Simplify the mainloop

The number of fds passed to epoll is just a hint for the kernel.
In our case, we know this is often 2, let's remove this parameter
from lxc_mainloop_open and cleanup the code around the caller of
this function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoformat and fix small typos
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
format and fix small typos

Indent and make the code cleaner.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove dead code in monitor.c
Michel Normand [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
remove dead code in monitor.c

This code is not used in lxc.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove src/lxc/lxc_priority.c
Michel Normand [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
remove src/lxc/lxc_priority.c

this was useless since old commit
576f946d784dbe7bf9008565647bde81ed064dc2
that intoduced the cgroup support.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreturns a specific info when we have ECONNREFUSED
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
returns a specific info when we have ECONNREFUSED

When a command can not be send because the connection is refused,
that means the container is stopped. Let's report this specific
case instead of raising an error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agoremove dead state code
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
remove dead state code

Remove old dead code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix the abstract unix socket name
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
fix the abstract unix socket name

Let's use a more sexy name

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agohandle the state command
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
handle the state command

handle the state command.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreturns the state of the container with the af_unix socket
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
returns the state of the container with the af_unix socket

Like the pid, let's store the state in the handler and modify it
at runtime. Return the value of state with a specific command.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodo some cleanup around the old init pid file
Daniel Lezcano [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
do some cleanup around the old init pid file

This file is no longer used, let's remove it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove dead stop code
Daniel Lezcano [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
remove dead stop code

Remove old dead code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agohandle the stop command
Daniel Lezcano [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
handle the stop command

Handle the stop command. The stop command waits for the peer to
disconnect, that means the peer has exited, so it is safe to
return to the user control. By this way, we ensure a stop command
followed by a start or a destroy won't fail with a race condition
because the start command is not yet finised.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agocheck permissions when receiving command
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
check permissions when receiving command

report to command requester the errno if credential failure,
rather than to only close the connection.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agorepackage previous code to new commands.c
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
repackage previous code to new commands.c

move some code of start.c to new commands.c and to console.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd an additionnal abstract socket to prepare for more commands
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
add an additionnal abstract socket to prepare for more commands

Replace the current tty service socket by a general command service
socket and plug for the moment only the existing tty service.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agottyclient_handler is only cleanup on disconnect
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
ttyclient_handler is only cleanup on disconnect

this is only a code split to show the real functionality of this
function that is not expecting any received data on the connection

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange the way tty service is added to mainloop
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
change the way tty service is added to mainloop

Move the tty service handler to use the mainloop for a future
consistent usage.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoaccept commands from root
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
accept commands from root

Commands should be accepted when they are coming from root.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agolxc_af_unix_rcv_credential to report rcvd length
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
lxc_af_unix_rcv_credential to report rcvd length

to have better error reporting done by caller.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agoexport struct lxc_handler from start.c to start.h
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
export struct lxc_handler from start.c to start.h

Will be required by a futur patch

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolocal struct name changed in mainloop.c
Michel Normand [Wed, 7 Oct 2009 14:06:08 +0000 (16:06 +0200)]
local struct name changed in mainloop.c

Two files have each their own structure definition with the same
name. The types name don't conflict but in the name of sanity, let's
rename these structures.

not critical isn't it :)

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agokeep rcfile for lxc-execute as already done for lxc-create
Michel Normand [Wed, 7 Oct 2009 08:05:39 +0000 (10:05 +0200)]
keep rcfile for lxc-execute as already done for lxc-create

The code previously added in lxc-create with
commit d7efa8fcbf0911f93c83dc06a708e7d73833dce3
is also required in lxc-execute.
So make this code common for the two callers.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix lxc-cgroup-get
Daniel Lezcano [Wed, 19 Aug 2009 20:14:17 +0000 (22:14 +0200)]
Fix lxc-cgroup-get

Make lxc_cgroup_get returns the number of bytes read and
use this value to "printf" it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodon't generate Changelog
Daniel Lezcano [Tue, 18 Aug 2009 21:28:42 +0000 (23:28 +0200)]
don't generate Changelog

Do not generate the changelog with the dist tarball.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoinitialize lxc_fd_list before WARN return path
Ken-ichirou MATSUZAWA [Tue, 18 Aug 2009 21:28:42 +0000 (23:28 +0200)]
initialize lxc_fd_list before WARN return path

We should initialize lxc_fd_list before opendir in
__lxc_fd_collect_inherited in case of opendir returns error.

Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.doin.ne.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc build fix for Suse
Jiri Slaby [Tue, 18 Aug 2009 21:28:42 +0000 (23:28 +0200)]
lxc build fix for Suse

Hi,

I have to use the attached patch to allow lxc building in the SUSE build
system. It uses as-needed flag and build thus fails, since -lutil is not
at the appropriate place on the command line.

js
suse labs

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoInclude <sys/socket.h> before checking for netlink
Guido Trotter [Sun, 26 Jul 2009 15:44:12 +0000 (17:44 +0200)]
Include <sys/socket.h> before checking for netlink

With some versions of the compiler/headers linux/netlink.h won't compile
if sys/socket.h is defined before it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
14 years agoDistribute manpages in source tarball
Guido Trotter [Sun, 26 Jul 2009 15:44:11 +0000 (17:44 +0200)]
Distribute manpages in source tarball

Ship the manpages in the source tarball made by 'make dist', and clean
them up only during the 'make maintainer-clean' step. This allows
distributions not to depend on docbook at lxc build time, because the
manpages are already there.

Also update the configure warning message to sound less scary.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove unused --with-kernel-release option
Guido Trotter [Sun, 26 Jul 2009 15:44:11 +0000 (17:44 +0200)]
Remove unused --with-kernel-release option

This was a leftover from the already-removed
network-destruction-on-container shutdown code.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix the document according the current version
Daniel Lezcano [Fri, 24 Jul 2009 14:41:27 +0000 (16:41 +0200)]
fix the document according the current version

Remove the comment about sharing /dev and fix the lxc-ps option
format.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoclose also inherited fd in lxc-execute
Michel Normand [Fri, 24 Jul 2009 13:25:45 +0000 (15:25 +0200)]
close also inherited fd in lxc-execute

This is a complement of previous patches d983b93c3ad860fa22ef760ae27a944d6000e35a
and af795875875de1855ee251ba530fbe2b53463f6e about inherited fd.

Here this is required for the lxc-execute that have a specific
lxc-init procress.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodisplay an explicit warning when netlink headers are missing
Daniel Lezcano [Fri, 24 Jul 2009 13:25:45 +0000 (15:25 +0200)]
display an explicit warning when netlink headers are missing

"netlink headers not found" implicitely means we have to install the
kernel headers. Make this explicit.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd some traces in the code for the logger
Daniel Lezcano [Fri, 24 Jul 2009 13:25:45 +0000 (15:25 +0200)]
add some traces in the code for the logger

Add some traces in the code, so we are able to follow the execution
of the start command with the logger.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix cgroup trace
Daniel Lezcano [Fri, 24 Jul 2009 13:25:44 +0000 (15:25 +0200)]
fix cgroup trace

The trace is displayed either if the setting fails, change that by
displaying the trace when the setting is successful.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange version to 0.6.3
Daniel Lezcano [Fri, 24 Jul 2009 13:25:43 +0000 (15:25 +0200)]
change version to 0.6.3

Increment to the 0.6.3 version.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoSpecify in the debian script an extra fstab file
Daniel Lezcano [Wed, 22 Jul 2009 17:39:18 +0000 (19:39 +0200)]
Specify in the debian script an extra fstab file

Allow the user to specify an extra fstab file to be added in the
debian configuration. So some optimisations can be done for sharing
objects.

eg: /var/cache/apt/archives mounted in <rootfs>/var/cache/apt/archives

Signed-of-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd clone2 for ia64
Daniel Lezcano [Wed, 22 Jul 2009 17:39:18 +0000 (19:39 +0200)]
add clone2 for ia64

Added clone2 for container creation on ia64.
Not tested as I don't have such architecture.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomake use of the logging facility and add some traces
Daniel Lezcano [Wed, 22 Jul 2009 17:39:17 +0000 (19:39 +0200)]
make use of the logging facility and add some traces

Now we have a logging facility, let's use it and add some traces in
the code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoisolate the shmfs for the container
Daniel Lezcano [Mon, 20 Jul 2009 15:57:31 +0000 (17:57 +0200)]
isolate the shmfs for the container

The /dev/shm is not isolated for application container, so mount it in
the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix closed fd when they are inherited
Daniel Lezcano [Mon, 20 Jul 2009 15:57:31 +0000 (17:57 +0200)]
fix closed fd when they are inherited

This patch fix a problem with the commit d983b93c3ad860fa22ef760ae27a944d6000e35a
When the lxc daemonize, it closes fd 0, 1 and 2. But these ones are coming from
inherited fd and they are already in the inherited list of fd. When lxc creates
some file descriptors, they have the number of the previous inherited file
descriptor, so they are closed when we close all the inherited file descriptors.

In order to fix that, the lxc_close_inherited_fd function has been implemented
to close an inherited fd and remove it from the list.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove the a previous cgroup
Daniel Lezcano [Thu, 16 Jul 2009 14:38:15 +0000 (16:38 +0200)]
Remove the a previous cgroup

As a previous run may have created a cgroup but died unexpectedly,
the cgroup can be still there when we try to launch the container
again with the same name. This patch removes the directory if it is
present, if this one is not owned by caller or it is in use (that should
not happen), the rmdir will fail with the corresponding errno.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoencapsulate lxc_handler
Daniel Lezcano [Thu, 16 Jul 2009 14:38:15 +0000 (16:38 +0200)]
encapsulate lxc_handler

Move the lxc_handler structure definition in the body file and
dynamically allocate it.

lxc_handler becomes an opaque structure for the user.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove useless initialization
Daniel Lezcano [Thu, 16 Jul 2009 14:38:15 +0000 (16:38 +0200)]
Remove useless initialization

The structure is cleared by the lxc_init function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-start should not hold inheritited fds
Michel Normand [Wed, 15 Jul 2009 21:48:22 +0000 (23:48 +0200)]
lxc-start should not hold inheritited fds

This patch makes the intermediate lxc processes to close the
inherited file descriptor. The child process will inherit these fd
in any case and that will be up to it to handle them.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agouse the lxc arguments dup in lxc_execute
Daniel Lezcano [Wed, 15 Jul 2009 21:48:22 +0000 (23:48 +0200)]
use the lxc arguments dup in lxc_execute

Now we have a helper to dup the arguments, let's use it.
The code gains in clarity.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd a helper to dup the lxc arguments
Daniel Lezcano [Wed, 15 Jul 2009 21:48:22 +0000 (23:48 +0200)]
add a helper to dup the lxc arguments

Add a helper to dup the lxc_arguments, so the code making
the copy of the arguments will be more clear.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agocleanup lxc-init
Daniel Lezcano [Wed, 15 Jul 2009 21:48:22 +0000 (23:48 +0200)]
cleanup lxc-init

Make some cleanup around the parameters of lxc-init.
The option mount procfs is not needed as we want to do that
all the time.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodetect a cgroup named 'lxc'
Daniel Lezcano [Mon, 13 Jul 2009 21:12:10 +0000 (23:12 +0200)]
detect a cgroup named 'lxc'

This patch makes lxc to detect a specific cgroup dedicated to lxc
which is mounted with the lxc name. That allows to mount different
cgroup in different places with different options (aka subsystems)
and assign one to be used by lxc. If no such mount point is found,
the first cgroup mount point is used.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-execute or lxc-start to fail if cgroup not mounted
Michel Normand [Mon, 13 Jul 2009 21:12:09 +0000 (23:12 +0200)]
lxc-execute or lxc-start to fail if cgroup not mounted

Before this patch a container was able to be started
without mounted cgroup. (only a warning was logged)
But the lxc-ps is using the /proc/<pid>/cgroup to identify
the lxc container in which pid is running.
So to be consistent between all lxc command I force an error
if cgroup is not mounted at time of lxc-execute or lxc-start.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agocreate the lxc directory with lxc-setcap
Daniel Lezcano [Fri, 10 Jul 2009 06:58:27 +0000 (08:58 +0200)]
create the lxc directory with lxc-setcap

There are several cases:
 * we run the lxc-create as root, the @path@/var/lib/lxc will be created
 * we run the lxc-create as non-root, the creation of the directory will
   fail with "permission denied", so we should call lxc-setcap before
 * we run lxc-setcap (always as root), we create the directory and set
   the permission for everyone.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodon't create the lxc directory at rpm installation
Daniel Lezcano [Fri, 10 Jul 2009 06:58:27 +0000 (08:58 +0200)]
don't create the lxc directory at rpm installation

Don't create the directory when we install the lxc package.
This is handled by lxc-create.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove install-exec-local rule
Ryousei Takano [Fri, 10 Jul 2009 06:58:27 +0000 (08:58 +0200)]
Remove install-exec-local rule

Hi Daniel and all,

I am trying to run LXC on the CentOS 5.3 and the Linux kernel 2.6.30.
I found a problem with running the rpmbuild command.  The error message
is shown below:

$ rpmbuild -bb lxc.spec
<snip>
 /usr/bin/install -c 'lxc-setcap' '/var/tmp/lxc-0.6.2-build/usr/bin/lxc-setcap'
 /usr/bin/install -c 'lxc-version' '/var/tmp/lxc-0.6.2-build/usr/bin/lxc-version'
mkdir: cannot create directory `/var/lib/lxc': Permission denied
make[3]: *** [install-exec-local] Error 1
make[3]: Leaving directory `/home/ryousei/rpm/BUILD/lxc-0.6.2/src/lxc'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/ryousei/rpm/BUILD/lxc-0.6.2/src/lxc'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/ryousei/rpm/BUILD/lxc-0.6.2/src'
make: *** [install-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.26914 (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.26914 (%install)

This patch removes 'install-exec-local' rule in Makefile.  It is not necessary,
and it causes rpmbuild failure on the CentOS 5.3.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove fork_ns code
Daniel Lezcano [Tue, 7 Jul 2009 20:53:05 +0000 (22:53 +0200)]
remove fork_ns code

This code is no longer used, remove it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreplace fork_ns by lxc_clone
Daniel Lezcano [Tue, 7 Jul 2009 20:51:18 +0000 (22:51 +0200)]
replace fork_ns by lxc_clone

Make use of the lxc_clone function and do no longer
use the fork_ns function.

The lxc-unshare utility has been changed to always do a fork.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse glibc clone instead of clone syscall
Daniel Lezcano [Tue, 7 Jul 2009 20:51:18 +0000 (22:51 +0200)]
use glibc clone instead of clone syscall

This patch replaces the clone syscall by the glibc clone making
the code not tied with the syscalls number declaration.

The unshare syscall has been removed as it is not interesting.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix missing capability fowner to manipulate /dev/pts/ptmx
Daniel Lezcano [Fri, 3 Jul 2009 13:25:45 +0000 (15:25 +0200)]
Fix missing capability fowner to manipulate /dev/pts/ptmx

This file may be without any permission

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAdd file capabilities to kernel options
Filippo Giunchedi [Thu, 2 Jul 2009 13:42:18 +0000 (15:42 +0200)]
Add file capabilities to kernel options

Point users in documentation to also enable POSIX capability for
dropping CAP_BOOT.

Signed-off-by: Filippo Giunchedi <filippo@esaurito.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAdd check for CONFIG_SECURITY_FILE_CAPABILITIES
Filippo Giunchedi [Thu, 2 Jul 2009 13:42:18 +0000 (15:42 +0200)]
Add check for CONFIG_SECURITY_FILE_CAPABILITIES

This might result in more evident lack of support for POSIX capabilities
enabled as pointed in documentation

Signed-off-by: Filippo Giunchedi <filippo@esaurito.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoClarify setcap advice/warning messages
Filippo Giunchedi [Thu, 2 Jul 2009 13:42:18 +0000 (15:42 +0200)]
Clarify setcap advice/warning messages

Probably a mention to libcap-2 is worth keeping, though it might be
clearer to point to setcap binary directly.

Signed-off-by: Filippo Giunchedi <filippo@esaurito.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoInclude /sbin in PATH for setcap
Filippo Giunchedi [Thu, 2 Jul 2009 13:42:18 +0000 (15:42 +0200)]
Include /sbin in PATH for setcap

Rationale: some distributions don't include /sbin in PATH for regular
users, thus setcap might not be found during configure

Signed-off-by: Filippo Giunchedi <filippo@esaurito.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUpdate kernel config options location
Filippo Giunchedi [Thu, 2 Jul 2009 13:42:18 +0000 (15:42 +0200)]
Update kernel config options location

These options appear in 2.6.29 in different locations, update the sgml
accordingly

Signed-off-by: Filippo Giunchedi <filippo@esaurito.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRewriting the pts section man for lxc.conf
christophe.quintard@fr.ibm.com [Thu, 2 Jul 2009 13:42:17 +0000 (15:42 +0200)]
Rewriting the pts section man for lxc.conf

I think this explanation is better.

Signed-off-by: Christophe Quintard <christophe.quintard@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate the lxc-ps man page after previous code change
Michel Normand [Wed, 1 Jul 2009 09:58:41 +0000 (11:58 +0200)]
update the lxc-ps man page after previous code change

this is the man page update following the
previous git commit 7cbfc4e4411b6effc6a64fd83a8cb37ffc9c7155

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation warning with malloc
Daniel Lezcano [Wed, 1 Jul 2009 09:58:41 +0000 (11:58 +0200)]
fix compilation warning with malloc

Add missing include stdlib.h

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc-execute to return exit code of its child not others
Michel Normand [Thu, 25 Jun 2009 09:21:56 +0000 (11:21 +0200)]
lxc-execute to return exit code of its child not others

lxc-execute has to return the exit code of it's child not others
as today's code would return the exit code of the last child.
We need to track the first process we launched and store its
exit status when it exits. In order to avoid to detect the exit
of this pid several time if the pids number wrap, we put an extra
flag saying the process group is orhpan.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoreplace the lxc-ps bash script by a perl script
Michel Normand [Thu, 25 Jun 2009 09:10:40 +0000 (11:10 +0200)]
replace the lxc-ps bash script by a perl script

Implement the lxc-ps script with perl script.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoanother place where readlink to be null terminated
Michel Normand [Thu, 25 Jun 2009 09:10:40 +0000 (11:10 +0200)]
another place where readlink to be null terminated

I did this one change by reading the code
but did not tried to run it.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agothe lxc_unlink_nsgroup may fail on ppc. V2
Michel Normand [Thu, 25 Jun 2009 09:10:40 +0000 (11:10 +0200)]
the lxc_unlink_nsgroup may fail on ppc. V2

the lxc_unlink_nsgroup may fail on ppc
where the stack is not zeroed by default
and because the readlink function do not add trailing null character.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoupdate the help of lxc-checkpoint and lxc-restart
Michel Normand [Thu, 25 Jun 2009 09:10:39 +0000 (11:10 +0200)]
update the help of lxc-checkpoint and lxc-restart

Update the checkpoint and restart regarding the statefile parameter.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc-fedora fixes
Matty [Wed, 24 Jun 2009 11:13:18 +0000 (13:13 +0200)]
lxc-fedora fixes

Howdy,

I was playing around with LXC containers this past weekend, and
noticed a couple of issues with the lxc-fedora script:

#1: Line 96 should be ${ROOTFS}/etc/sysconfig/network instead of
${ROOTFS}/sysconfig/network

#2 Line 249 contains a reference to $PKG, which isn't used in the
program. I adjusted the variable to point to the correct package, and
use this in the calls to yumdownloader:

    PKG="${DISTRO}-release.noarch.rpm"
                   .....
    yumdownloader --destdir="${CACHE}/partial" "${PKG}"

#3 The $CACHE/partial path is escaped unnecessarily:

   RPM="rpm --root \"${CACHE}/partial\""

#4 The program assumes yumdownloader will work, which isn't always the
case. I added an if statement to check the return code:

   echo "Downloading distribution release file ${PKG}"
   yumdownloader --destdir="${CACHE}/partial" "${PKG}"
   RESULT=$?

   if [ "${RESULT}" != "0" ]; then
       echo "Enable to download the distribution release file"
       exit 1
   fi

#5 The package name passed to yumdownloader is incorrect:

   yumdownloader --destdir="${CACHE}/partial" "${DISTRO}-release.noarch.rpm"

   On Fedora 10 and 11, this evaluates to:

   fedora-release.noarch.rpm

   When we need it to evaluate to:

   fedora-{RELEASE_VER}.release.noarch

   This is fixed in the PKG variable listed above.

A patch that addresses these issues is attached.

Thanks,
- Ryan

Signed-off-by: Matty <matty91@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agounshare the utsname in all the cases
Daniel Lezcano [Fri, 12 Jun 2009 14:02:14 +0000 (16:02 +0200)]
unshare the utsname in all the cases

The current code implies we have to define a utsname in order
to unshare it. This problematic in case of system container because
we want them to set their hostname. As the utsname namespace is
a COW, we can safely unshare it in all the cases.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>