Commit Graph

2861 Commits

Author SHA1 Message Date
Michel Normand
14ad6bfdf0 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>
2009-10-09 11:38:39 +02:00
Michel Normand
a6ddef6149 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>
2009-10-09 11:38:39 +02:00
Michel Normand
758437c558 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
52e3595723 use the configuration structure for the tty
Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
1bc60a65c9 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
d852c78cf0 Use the configuration structure for pts
Avoid to use the directory structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:38 +02:00
Daniel Lezcano
4e5440c654 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>
2009-10-09 11:38:38 +02:00
Daniel Lezcano
c69bd12f88 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>
2009-10-09 11:38:38 +02:00
Daniel Lezcano
ecb0e51b0c 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>
2009-10-09 11:38:38 +02:00
Daniel Lezcano
df83bf6f97 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>
2009-10-09 11:38:38 +02:00
Daniel Lezcano
6a6ad7af58 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>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
a9e61274bc 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>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
ded1d23faa format and fix small typos
Indent and make the code cleaner.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:09 +02:00
Michel Normand
fa4b063c6e 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>
2009-10-07 16:06:09 +02:00
Michel Normand
28034e531e remove src/lxc/lxc_priority.c
this was useless since old commit
576f946d78
that intoduced the cgroup support.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
d97b36f8f8 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>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
787dc17c3b remove dead state code
Remove old dead code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
46968ea3cc fix the abstract unix socket name
Let's use a more sexy name

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
e98fe68b38 handle the state command
handle the state command.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
66aeffc721 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>
2009-10-07 16:06:09 +02:00
Daniel Lezcano
5379ce7836 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>
2009-10-07 16:06:08 +02:00
Daniel Lezcano
6e47d49323 remove dead stop code
Remove old dead code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-07 16:06:08 +02:00
Daniel Lezcano
2137dc998b 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>
2009-10-07 16:06:08 +02:00
Michel Normand
3cc5de3619 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>
2009-10-07 16:06:08 +02:00
Michel Normand
724e753cb0 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>
2009-10-07 16:06:08 +02:00
Michel Normand
96fa1ff0d1 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>
2009-10-07 16:06:08 +02:00
Michel Normand
35be16d7cc 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>
2009-10-07 16:06:08 +02:00
Michel Normand
50c8bf0547 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>
2009-10-07 16:06:08 +02:00
Michel Normand
d8cc9804ae 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>
2009-10-07 16:06:08 +02:00
Michel Normand
2dcb28a9d0 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>
2009-10-07 16:06:08 +02:00
Michel Normand
e2001e1cea 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>
2009-10-07 16:06:08 +02:00
Michel Normand
9227a12a1d 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>
2009-10-07 16:06:08 +02:00
Michel Normand
cfd1dc0932 keep rcfile for lxc-execute as already done for lxc-create
The code previously added in lxc-create with
commit d7efa8fcbf
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>
2009-10-07 10:05:39 +02:00
Daniel Lezcano
70f7755e98 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>
2009-08-19 22:14:17 +02:00
Daniel Lezcano
b333f86e86 don't generate Changelog
Do not generate the changelog with the dist tarball.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-08-18 23:28:42 +02:00
Ken-ichirou MATSUZAWA
c4ffc8f70b 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>
2009-08-18 23:28:42 +02:00
Jiri Slaby
aa8b31f68f 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>
2009-08-18 23:28:42 +02:00
Guido Trotter
90e0a869ac 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>
2009-07-26 17:44:12 +02:00
Guido Trotter
5c320b7692 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>
2009-07-26 17:44:11 +02:00
Guido Trotter
f8e88c4e65 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>
2009-07-26 17:44:11 +02:00
Daniel Lezcano
c159cb9638 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>
2009-07-24 16:41:27 +02:00
Michel Normand
72439b9f8b close also inherited fd in lxc-execute
This is a complement of previous patches d983b93c3a
and af79587587 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>
2009-07-24 15:25:45 +02:00
Daniel Lezcano
c8c9ce7a2b 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>
2009-07-24 15:25:45 +02:00
Daniel Lezcano
1ac470c02a 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>
2009-07-24 15:25:45 +02:00
Daniel Lezcano
f5d186114c 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>
2009-07-24 15:25:44 +02:00
Daniel Lezcano
f49d83e90f change version to 0.6.3
Increment to the 0.6.3 version.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-07-24 15:25:43 +02:00
Daniel Lezcano
cd830f336a 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>
2009-07-22 19:39:18 +02:00
Daniel Lezcano
246091b903 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>
2009-07-22 19:39:18 +02:00
Daniel Lezcano
cd54d859da 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>
2009-07-22 19:39:17 +02:00
Daniel Lezcano
958f5c9e83 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>
2009-07-20 17:57:31 +02:00