Commit Graph

1578 Commits

Author SHA1 Message Date
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
Daniel Lezcano
5b2b6e7e2d inc the minor version
Inc the minor version for the next release.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-24 11:41:08 +02:00
Daniel Lezcano
01f3fe3156 Setting execution permission for the file
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-24 11:38:47 +02:00
Daniel Lezcano
91e1b53961 swap doc compilation order
Let's compile the documentation when everything has compiled
well, that saves time for devel ;) 

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-24 11:32:58 +02:00
Daniel Lezcano
8cdca67253 add the autogen script in the dist tarball
Add the autogen script to the tarball so people using the
dist version can patch the auto* files and regenerate them
directly for the dist tarball.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michael K Johnson <johnsonm@rpath.com>
2009-04-24 11:32:58 +02:00
Daniel Lezcano
ba5b258279 rename bootstrap to autogen.sh
By convention the script calling the auto tools is named
autogen.sh. I rename 'bootstrap' to 'autogen.sh' in order to
stick to this convention.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michael K Johnson <johnsonm@rpath.com>
2009-04-24 11:32:58 +02:00
Daniel Lezcano
e0b4037dfa add the missing header in the log file
License header is missing in the log files.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-24 11:32:58 +02:00
Michel Normand
eabbb2f0c0 locally define O_CLOEXEC
this is a required patch to be able to compile lxc on a RedHat 5 update 1
which has such define.
This is also required for the F_DUPFD_CLOEXEC define

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-24 11:32:58 +02:00
Daniel Lezcano
2c9bd0073f make the log fd thread safe
Add the tls attribute for the global static variables in the logs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-21 21:51:13 +02:00
Cedric Le Goater
dcb7355b2f lxc: cleanup log
some headers and macros are now redundant

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
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
Cedric Le Goater
cb8c5720bd lxc: introduce log4c style logging
lxc_log_init() should be called in each main() of a command
to define the default log priority and log file.

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
Michel Normand
a57cf79e58 exclude generated tarball from git managed files
exclude generated tarball from git managed files

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-20 22:10:59 +02:00
Michel Normand
4f916514e8 make the libtoolize files to be copy not
This is required to be able to make the build
on a machine that mount lxc source but not all
machine filesystem.
.
Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-20 22:10:59 +02:00
Ryousei Takano
998ac6763f Add support for various mount options
This patch adds support for various mount options.  It is also able to pass extra 
mount option data to mount(2).  For example, it allows users to mount aufs file 
system at lxc_start time.

See the thread
	http://sourceforge.net/mailarchive/forum.php?thread_name=E6D98D6C-F633-419A-9424-F24EBB3E11D9%40aist.go.jp&forum_name=lxc-devel
for details.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-20 22:10:59 +02:00
Môshe van der Sterre
b035ad62e6 prevent tty fd to be inherited in the container
Set the close on exec flag on the pty fd so they are automatically
closed when execing the container.

Signed-off-by: Môshe van der Sterre <me@moshe.nl>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-20 22:10:59 +02:00
Môshe van der Sterre
8de09ef556 check multiple devpts instance
Hello,

It took me some thinking to figure out DEVPTS_MULTIPLE_INSTANCES was disabled.
Maybe checking for it in lxc-checkconfig will be helpfull to others.

Greetings,
Môshe van der Sterre

Signed-off-by: Môshe van der Sterre <moshevds@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-04-20 22:10:59 +02:00
Daniel Lezcano
f6235d0635 don't remove init file in the stop function
At present the 'init' file is deleted from the 'stop' function and
I don't remember why it is done in this place :)

The 'init' file is removed from the 'start' when the first process
has been deleted.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-31 13:55:44 +02:00
Daniel Lezcano
34e7030e83 speed container creation/destruction
As the state of the container is monitored with the netlink,
the file state is no longer used to watch the state changes.

The previous hack, which adds a tempo of 200ms, is removed and
that makes the container being created, started, stopped, destroyed
faster, we gain 1 second in a container lifecycle. One second is
too much if we launch thousand of containers, one by one like for
example in a tests suite.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-31 13:55:44 +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
Guido Trotter
abf424cf20 $(localstatedir) != $(prefix)/var
The current code assumes that localstatedir is equal to $(prefix)/var,
thus failing for example on debian, where prefix is /usr and
localstatedir is /var. This patch fixes this by expanding LXCPATH just
once in configure.ac to $(localstatedir)/lib/lxc and expanding that
variable everywhere else.

install-exec-local is changed to just do one mkdir -p, and taking into
account of the DESTDIR variable, user for example for packaging.

Changing the permission of LXCPATH is done in lxc-setcap

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-30 14:16:39 +02:00
Daniel Lezcano
85a3182189 add error.h header
Add the missing header in the package installation.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
089cd8b878 move lxc_conf_init to conf.c
Changed the struct lxc_conf initialization function to the
right place.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
a871ff6bdf cleanup config.h
Rename lxc_config.h to confile.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
35d2c3e71d cleanup state.h
Rename lxc_state.h to state.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
951cc719a3 cleanup list.h
Rename lxc_list.h to list.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
731cc33fb7 cleanup log.h
Rename lxc_log.h to log.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
13954cce63 cleanup conf.h
Rename lxc_conf.h to conf.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
170d528eea cleanup cgroup.h
Rename lxc_cgroup.h to cgroup.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Daniel Lezcano
c6d1536e2b cleanup lock.h
Rename lxc_lock.h to lock.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00