Commit Graph

307 Commits

Author SHA1 Message Date
Daniel Lezcano
d7efa8fcbf copy the configuration file in the conf repo
When creating the container, copy the configuration file to the
configuration tree.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Daniel Lezcano
4fcc0112bd create the container with an empty configuration
Fix the code to not fail when the specified configuration file
is empty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +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
Daniel Lezcano
920dfa346c change the checkpoint/restart function api
As the checkpoint/restart is expected to be sequential,
I pass the file descriptor to checkpoint and restart, so
that will be up to the caller to open the file descriptor
which can be a pipe, socket, file, etc ...

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Daniel Lezcano
34c66a6980 Remove old code to destroy the network
Removed this unused code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Daniel Lezcano
3f739da8b5 remove checkpoint / restart code
The checkpoint / restart code is too experimental regarding
the current implementation in the kernel.
As there are several implementation and we don't know which
one will be merged upstream, I remove the code and add a few
parameters to checkpoint.

The checkpoint/restart function will be plugins in order to choose
the CR solutions. This approach will allow to switch from one
implementation to another without breaking anything.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Daniel Lezcano
64e1ae63eb make use of the copy file function
Now we have specific function to copy the files, make use of it
and remove the old code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Daniel Lezcano
e3642c43e6 make a "copy file" function
Create a specific function to copy a file from a location to
another location.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-28 12:10:50 +02:00
Michel Normand
7cee878951 remove lxc_error_t enum that is now useless
There is no more need of the LXC_ERROR defines
and related lxc_strerror function.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:30:39 +02:00
Michel Normand
95b5ffafae remove LXC_ERROR_* usage in src/lxc/conf.c as not required
This is useless because error is already reported by the functions

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:30:39 +02:00
Michel Normand
75b1e1981d lxc-monitor and lxc-wait to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:36 +02:00
Michel Normand
272bc5af96 lxc-cgroup to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:36 +02:00
Michel Normand
2ea004b8c6 lxc-console to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:36 +02:00
Michel Normand
a30284df84 lxc-checkpoint ad lxc-restart to return 255 in case of error
to have same exit code for all lxc commands

Note that the lxc-restart is not yet reporting
the error of restarted application as done with lxc-start.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:36 +02:00
Michel Normand
c8f55b0eff lxc-freeze and lxc-unfreeze to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:36 +02:00
Michel Normand
f4072342e0 correct error reporting for lxc_setstate
there was a missing init of local variable

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
2009-05-18 22:27:35 +02:00
Michel Normand
79507e493e lxc-destroy return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:35 +02:00
Michel Normand
7f8306138a lxc-create to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:35 +02:00
Michel Normand
23075e69dc lxc-stop to return 255 in case of error
to have same exit code for all lxc commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:35 +02:00
Michel Normand
b0ed5e6423 lxc-execute to report exit code of started application
The exit code of the application as reported by lxc-execute is:
0-126       exit code of the application itself
128+n       signal n received by the application
255         lxc error

Note that this is the same type of changes as done
for lxc-start command line.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:27:35 +02:00
Michel Normand
8559e7039c add support of lxc log file to lxc-init
pass to lxc-init the log options given to lxc-execute
(in fact logfile logpriority and quiet)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
2009-05-18 22:27:35 +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
41cfbac9dd add long options step4
add the long options to the remaining lxc_*.c files
that need changes in struct lxc_arguments.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:11:46 +02:00
Michel Normand
4237c6ca1f add long options step3
add the long options to remaining lxc_*.c  files
that do not impact the struct lxc_arguments

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-18 22:11:46 +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
Michel Normand
cda02a28c0 add long options step1
add the long options to lxc-execute as an exemple
of usage of the new functions added in src/lxc/arguments.*

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
Michel Normand
441e496395 add quiet option
This added quiet option allow to disable
the reporting via stderr of the lxc error messages.

Note that the usage function is still printing in case of error,
but will be removed by later patches

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
Michel Normand
fcffb59fc8 in lxc-unshare remove log options
remove the -o and -l log options in src/lxc-unshared.c
because these are useless for such a basic test command.
It is sufficient to report the error to stderr.

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
Michel Normand
4c200d12e0 report error in lxc_get_lock
report error in lxc_get_lock and remove the call to lxc_strerror
that become useless for these errors.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-17 13:43:51 +02:00
Michel Normand
305dbab7e6 create a new lxc_check_lock function
added in src/lock.c to replace call to lxc_get_lock and lxc_put_lock,
when only need to check if container is active or not.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-17 13:43:51 +02:00
Michel Normand
d737c07495 add a default stderror log appender
This is adding a stderror log appender that is used as default one.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-15 10:47:08 +02:00
Michel Normand
5fd8380be6 properly handle va_list in log_append functions
the support of multiple appenders need to associate
one va_list per appender.
This is the purpose of this patch to copy the va_list
before to call the appender.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-15 10:43:51 +02:00
Daniel Lezcano
31c53c2e1a Replace netlink by abstract unix socket
Instead of messing with the netlink messages, let's
use the abstract unix socket and assume we will have
a single receiver and multiple sender.

With this patch mcr-wait and mcr-monitor are mutually
exclusive... for the moment.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 21:28:27 +02:00
Michel Normand
8b92dc3ab6 change lxc_cgroup_set/get functions to return -1
and report error message as soon as detected error in these two functions

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
2009-05-14 16:27:29 +02:00
Michel Normand
69c3910d15 SYSERROR not to add end of line character
I assume this is a typo error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
2009-05-14 16:27:28 +02:00
Michel Normand
51cab6315f add support of a lxc log file to cli
this is adding -o and -l options to all cli of lxc

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:52:03 +02:00
Michel Normand
3ab87b66af remove fprintf to stderr and replace by ERROR call when needed
do it in all cli, except:
* the usage functions that will be removed by another patch
* the lxc_init that need more work
* the lxc_priority that is not used anymore

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:52:03 +02:00
Michel Normand
2e71498422 add error log in lxc_file_for_each_line
this is required to log error where needed
and to to avoid additionnal log later on.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:23:30 +02:00
Michel Normand
487f4ee9f8 change lxc-cgroup parameter checking
required to support either:
lxc-cgroup -n foo subsystem value
lxc-cgroup -nfoo  subsystem value

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:23:30 +02:00
Michel Normand
a4255c0807 change lxc-unshare options
replace the specific clone options by a -s option
with the Ored list of namespaces to be cloned.

take the opportunity of this change to have
the -u <uid> option to not automatically set
the clone flag to CLONE_NEWUSER but to be dependant
of the new -s USER option.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:11:40 +02:00
Michel Normand
d00184d361 replace fprintf by ERROR call in lxc_unshare.c
Do it except for the usage functions that will be removed by another patch

This is a follow on a previous patch that treated
all src/lxc/lxc_*.c but this file.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:11:40 +02:00
Michel Normand
1615dc39e2 avoid segfault on git-unshare
avoid segfault when invalid parameter
git-unshare -u 666666

and improve error reporting

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-05-14 15:11:39 +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
Daniel Lezcano
6b9f39176c Revert "make the log fd thread safe"
This reverts commit 2c9bd0073f.

Pointless and useless right now and certainly wrong as several
threads in the library may want to log to the same, to be defined
later.
2009-04-26 11:49:53 +02:00
Daniel Lezcano
f8dafdbb15 rename configure.in to configure.ac
Rename configure.in to configure.ac as it is the correct
name for the recent version.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-26 11:43:41 +02:00
Daniel Lezcano
8db2cb8e0d remove m4 dir usage
As the m4 directory is not used, remove the usage from
the scripts.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-26 11:43:41 +02:00
Daniel Lezcano
ccf1319832 add aclocal include in makefile
When auto-regen is done at the make time, eg. when the configure.in
script has been modified, the configure is not correctly generated
because the 'config' directory is missing for aclocal, and that makes
the generation to fail due to the missing macros defined in config
directory.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-26 11:43:41 +02:00