Commit Graph

1578 Commits

Author SHA1 Message Date
Daniel Lezcano
b9f94fc1e8 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>
2009-10-23 11:15:27 +02:00
Cedric Le Goater
5b46e19c3f 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>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
881450bbed 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>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
92d385229b 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>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
0e322d2295 mount /dev/mqueue
Mount always /dev/mqueue with lxc_init.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-15 14:17:14 +02:00
Daniel Lezcano
d685aa8049 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>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a059591e9f 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>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a1511e8d15 fix compilation error for tests
Fix test program compilation errors.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a79cf70427 remove configure dead code
Remove the old configuration remaining code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
5e4a62bf32 fix tty creation using confdir
tty_create uses the old conf directory, fixing this.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
5f4535a3d9 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
4bf1968d3c Factor out some network code
We can factor out the "ip addr add"

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
82d5ae15e7 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
571e6ec89e 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
88d5514d16 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>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
102a53038a use the configuration structure for the cgroup
Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Michel Normand
9f44c57836 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>
2009-10-09 11:38:39 +02:00
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