Commit Graph

35 Commits

Author SHA1 Message Date
Daniel Lezcano
b8f57738b4 log the container console when it is daemonized and the log is enabled
When we daemonize the container and we specify the log file,
the container will use the log file to write the console output.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-06-07 21:48:46 +02:00
Daniel Lezcano
6203de18eb rename the ns_cgroup with the container name
It is not easy to follow the cgroup name associated with a container,
so right after the container is created, I rename the cgroup which
is the pid of the creator by the container name.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Michel Normand
e043236e2a lxc-start to report exit code of started application
The exit code of the application as reported by lxc-start is:
0-126       exit code of the application itself
128+n       signal n received by the application
255         lxc error

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:34 +02:00
Michel Normand
9618063c87 add long options step2
add the long options to lxc-start
with a small change in lxc_start proto to avoid compilation warning

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:11:45 +02:00
Daniel Lezcano
be43f17e58 autoassign tty number
When no tty number is specified in the command line,
let the tty service to provide choose one available
tty and provide this one.

The documentation is updated wrt this modification and
I did a little fix to generate the date of the documentation.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-07 19:36:33 +02:00
Daniel Lezcano
1bc5cc8c0b export-fine-grain-api-for-start
Export the fine grain api of lxc to be usable for external
component which wants to have more control on the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-29 17:49:04 +02:00
Daniel Lezcano
59eb99bad4 encapsulate the lxc code
Make the lxc code more modular and use it for lxc_start
function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-29 17:49:04 +02:00
Daniel Lezcano
ca5f79263d define a handler to manage a container
Define a handler to store the resource informations for the container.
That allows to factor out some code and will help to encapsulate a
little more the 'start' code which is too big.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-29 17:49:04 +02:00
Cedric Le Goater
36eb9bdef1 lxc: use new logging system
This patch defines a new log category in each file using logging and
replaced the former logging routines with the new ones.

Signed-off-by: Cedric Le Goater <legoater@free.fr>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-21 21:51:13 +02:00
Ryousei Takano
3f21c11481 Fix compile warnings
This patch fixes compile warnings: ignoring return value of function,
declared with attribute warn_unused_result, and adds error handling.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-31 13:55:18 +02:00
Matt Helsley
bfa3802503 Add powerpc signalfd syscall numbers
Add signalfd and signalfd4 syscall number definitions for powerpc so
that we may compile even with older platform headers.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-20 11:51:46 +01:00
Serge E. Hallyn
47f3833097 define s390x signalfd for old headers
define s390x signalfd for systems with headers which are too
old.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-09 17:38:17 +01:00
Michael K. Johnson
8ca61733b9 define signalfd patch
If sys/signalfd.h does not exist, assume that it does not exist
in glibc, rather than that it exists without a corresponding
header file.  Note that this version of the signalfd() wrapper
function (unlike the version in glibc) falls back dynamically to
the old signalfd system call if the signalfd4 system call is not
implemented in the currently-running kernel; the version in glibc
chooses the version of the signalfd system call to make via static
build-time configuration.

Signed-off-by: Michael K Johnson <johnsonm@rpath.com>
Signed-off-by: Daniel Lezcnao <dlezcano@fr.ibm.com>
2009-03-08 17:24:26 +01:00
Matt Helsley
656994bbfa liblxc: Handle missing PR_CAPBSET_DROP definition
On distros with older headers liblxc fails to build because PR_CAPBSET_DROP is 
not defined by including /usr/include/sys/prctl.h. This adds an autoconf
test and, if not present, defines it. When prctl() is called on systems that
do not support PR_CAPBSET_DROP we should expect EINVAL. This case is already
handled by the liblxc code so no further changes are needed.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
dlezcano
ff218c25da Add signalfd function definition
From: Dietmar Maurer <dietmar@proxmox.com>

The signalfd function prototype and the signalfd header file is not
defined in the debian Lenny. We want to use this debian version with a
newer kernel.

This patch gives the signalfd function prototype, because the function is
available in the glibc-2.7 which is the version coming with debian Lenny.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-02 14:50:00 +00:00
dlezcano
b0a33c1eb6 From: Daniel Lezcano <daniel.lezcano@free.fr>
Console support for the system container.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-01-25 21:52:38 +00:00
dlezcano
caf249f40e Remove annoying warnings and fix tty for restart
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Remove annoying compilation messages and fix tty for the restart.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-26 17:05:11 +00:00
dlezcano
939229eb16 Pass the ttyname to the lxc_setup function
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Retrieve the ttyname and pass it to the lxc_setup function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-25 13:00:49 +00:00
dlezcano
b322326203 Return error code in child process
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Return the error code when the exec fails in the child process, that
decreases the granularity of the error given to the user.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-21 15:56:38 +00:00
dlezcano
8b8b04f80a Add lxc.7 man page
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Added the overview man page for lxc.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-20 15:04:09 +00:00
legoater
6c79a11ba0 fixed readlink to add an ending '\0'
From: Cedric Le Goater <clg@fr.ibm.com>

fixed readlink to add an ending '\0'

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
2008-11-19 11:05:42 +00:00
dlezcano
e5bda9eed7 Return a lxc-error for creation and starting
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Return a lxc-error when for the lxc_configure and lxc_setup function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-17 18:22:29 +00:00
dlezcano
1f3da8f86c Handle the lock error and show message to user
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Handle the lock error and show message to user.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-17 17:55:49 +00:00
dlezcano
e2bcd7db5e Add return error status in the different functions
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Add the most known error to the different API to be followed up by the
caller, so we can later show a better message to the user when something
goes wrong. The error catching is coarse grain right now but will be improved,
step by step.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-17 16:01:34 +00:00
dlezcano
b7c9b19991 Change at compilation time the destruction of the network devices
From: Daniel Lezcano <dlezcano@fr.ibm.com>

The future kernel version will automatically autodestroy the network devices
when the network namespace exits. This is not the case for the current version.
In order to handle the both cases, I added a configuration option to disable
the network destruction when the container exits:
	--disable-network-destroy

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-14 16:16:35 +00:00
dlezcano
05f05512ed Replace lxc_execute by an intermediate lxc_init
From: Daniel Lezcano <dlezcano@fr.ibm.com>

The main difference between lxc_start and lxc_execute is the latter creates
an intermediate process to wait for all the childs. That allows to support
daemons or orphan process group for the pid namespace.

Having such difference makes the code to be duplicate between the two
functions. So instead of doing this, I create an intermediate <init> program
which is in charge to launch the specified command. This command is the
lxc-init program taking different options:
 --mount-procfs : mount the proc filesystem before exec'ing the command
 --mount-sysfs : mount the sys filesystem before exec'ing the command

A double dash indicates the end of the options of lxc-init and the beginning
of the command to be launched.

To summarize:
 * lxc_execute function is no more.
 * lxc-execute command uses the lxc_start function and launch the specified
command via lxc-init

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-13 15:21:55 +00:00
dlezcano
42ff343ddb From: Daniel Lezcano <dlezcano@fr.ibm.com>
Remove the CAP_SYS_BOOT capability from the bouding set, so we can poweroff,
halt, reboot the container safely without shutting down the real host.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-04 22:18:23 +00:00
dlezcano
57545890fe From: Daniel Lezcano <dlezcano@fr.ibm.com>
Exit instead of returning in child process.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2008-11-04 21:52:48 +00:00
dlezcano
536b97f0c8 Removed useless opentty function and moved the sighandler restore to the right place 2008-10-08 14:15:17 +00:00
dlezcano
218d4250a9 Create the cgroup proxy before trying to set it up. 2008-10-07 14:23:25 +00:00
dlezcano
22ebac194e Replace asprintf by snprintf 2008-10-04 19:47:17 +00:00
dlezcano
f4d507d5fe Added console support 2008-09-09 14:35:44 +00:00
dlezcano
b113348ebd Change header inclusion path 2008-09-04 10:09:53 +00:00
dlezcano
06efeb5c0e Headers cleanup 2008-09-04 09:46:22 +00:00
dlezcano
0ad19a3fc3 Joined liblxc and lxc directory 2008-09-04 07:57:50 +00:00