]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
14 years agoRename doc/examples/lxc-complex-config.in to lxc-complex.conf.in
Michael Holzt [Fri, 8 Jan 2010 14:19:20 +0000 (15:19 +0100)]
Rename doc/examples/lxc-complex-config.in to lxc-complex.conf.in

Rename doc/examples/lxc-complex-config.in to lxc-complex.conf.in as all other
examples in this directory have a .conf ending as well.

Signed-off-by: Michael Holzt <lxc@my.fqdn.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove dead code
Daniel Lezcano [Fri, 8 Jan 2010 14:19:19 +0000 (15:19 +0100)]
Remove dead code

Remove dead code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse pivot_root instead of chroot
Michael Holtz [Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)]
use pivot_root instead of chroot

lxc currently does a chroot into the target rootfs. chroot is insecure and
can easily be broken, as demonstrated here:

| root@synergy:~# touch /this_is_the_realrootfs_ouch
| # touch /container/webhost/this_is_the_container
| # lxc-start -n webhost /bin/sh
| # ls this*
| this_is_the_container
| # ./breakchroot
| # ls this*
| this_is_the_realrootfs_ouch

code to break chroot taken from
http://www.bpfh.net/simes/computing/chroot-break.html

Now this can be fixed. As our container has his own mount namespace, we can
easily pivot_root into the rootfs and then unmount all old mounts. The patch
attached add a new config keyword which contains the path to a temporary
mount for the old rootfs (inside the container). This stops the chroot break
method shown before.

Example:

| root@synergy:~# grep pivotdir /var/lib/lxc/webhost/config
| lxc.pivotdir = /oldrootfs
| root@synergy:~# ls -lad /container/webhost/oldrootfs
| drwxr-xr-x 2 root root 4096 2010-01-02 03:59 /container/webhost/oldrootfs
| root@synergy:~# lxc-start -n webhost /bin/sh
| # mount -t proc proc /proc
| # cat /proc/mounts
| rootfs / rootfs rw 0 0
| /dev/root / ext3 rw,relatime,errors=remount-ro,data=writeback 0 0
| devpts /dev/console devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
| proc /proc proc rw,relatime 0 0
| # ls this*
| this_is_the_container
| # ./breakchroot
| # ls this*
| this_is_the_container

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michael Holtz <lxc@my.fqdn.org>
14 years agolxc: avoid memory corruption on ppc and s390 V4
Michel Normand [Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)]
lxc: avoid memory corruption on ppc and s390 V4

conf object is on stack and is used in forked process.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc_cgroup_set not reporting error
Michel Normand [Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)]
lxc_cgroup_set not reporting error

this is a side effect of previous patch I made
on this same function in commit
a6ddef6149858df87cf7ab3c21e2fd34d14cc452

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: update man and help of lxc-create
Michel Normand [Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)]
lxc: update man and help of lxc-create

few added lines to document the new lxc-create -t option

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix manpage typo
Paul Fee [Tue, 5 Jan 2010 12:11:27 +0000 (13:11 +0100)]
fix manpage typo

Fix and clarify some parts of the lxc.conf man page.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd macvlan vepa and bridge mode
Daniel Lezcano [Mon, 28 Dec 2009 21:10:11 +0000 (22:10 +0100)]
add macvlan vepa and bridge mode

The future kernel 2.6.33 will incorporate the macvlan bridge
mode where all the macvlan will be able to communicate if they are
using the same physical interface. This is an interesting feature
to have containers to communicate together. If we are outside of the
container, we have to setup a macvlan on the same physical interface than
the containers and use it to communicate with them.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agobusybox template
Daniel Lezcano [Sun, 27 Dec 2009 21:36:09 +0000 (22:36 +0100)]
busybox template

This script builds a busybox rootfs and provides the associated
configuration to run the busybox.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadapt lxc-sshd to be a template
Daniel Lezcano [Sun, 27 Dec 2009 21:36:09 +0000 (22:36 +0100)]
adapt lxc-sshd to be a template

Cleanup the script, simplify it and pass the arguments to this
script to be callable by lxc-create template logic.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd template option for lxc-create
Daniel Lezcano [Sun, 27 Dec 2009 21:36:09 +0000 (22:36 +0100)]
add template option for lxc-create

The lxc-create command is now able to call a sub script to install
a mini template.
Right now, debian is supported.

The rootfs is stored automatically in <lxcpath>/<name>/rootfs
So the rootfs is a subdirectory of the container configuration directory.

When lxc-destroy is called, the rootfs is deleted with the container
configuration.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agocleanup lxc-debian script
Daniel Lezcano [Sun, 27 Dec 2009 21:36:09 +0000 (22:36 +0100)]
cleanup lxc-debian script

The lxc-debian is epurated and consolidated with a better
error handling.

This script is no longer interactive but it installs in a specified
place the debian rootfs.

This script is not supposed to be called directly so it will fall in
libexec path very soon. This script is called by lxc-create
as a template with the right option and the right place.

The debian network configuration is by dhcp.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix mount entry typo
Daniel Lezcano [Fri, 18 Dec 2009 13:19:59 +0000 (14:19 +0100)]
fix mount entry typo

Added missing carriage-return when adding a new entry.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoIntroduce per netdev priv structure
Jamal Hadi Salim [Tue, 15 Dec 2009 09:14:27 +0000 (10:14 +0100)]
Introduce per netdev priv structure

Some devices like veth or vlans have a bit of extra details that
are specific to them. Example veth.pair and vlan.vlanid.
Separate them from the common so we can update cleanly in the future.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAdd VLAN support in config
Jamal Hadi Salim [Tue, 15 Dec 2009 09:14:27 +0000 (10:14 +0100)]
Add VLAN support in config

This adds ability to migrate vlan interfaces into namespaces
by specifying them in a config

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAdd utility u16 get/put
Jamal Hadi Salim [Tue, 15 Dec 2009 09:14:26 +0000 (10:14 +0100)]
Add utility u16 get/put

Add utility functions to parse a u16 and put a u16 on a
netlink message

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix a compilation warning
Daniel Lezcano [Thu, 26 Nov 2009 15:46:25 +0000 (16:46 +0100)]
fix a compilation warning

lxc_get_cgroup_path is used in the file but the header
defining the function is missing.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years ago"Default" configuration may destroy host system
Andrian Nord [Thu, 26 Nov 2009 15:46:25 +0000 (16:46 +0100)]
"Default" configuration may destroy host system

If you're running (by mistake or typo) (via lxc-start) container that does not
exists it will run with lxc.rootfs=/, meaning that /sbin/init will
restart initialization procedure, efficiently messing host's system,
that may lead to unpredictable results or even destroy (make inaccessible) host
system (by reseting network configuration or something like that).

(Actually, it _did_ destroy system of everyone who tested this).

Actually, I finally lost any meaning of having such a feature for
full-system containers. You may not use hosts's FS - it's described at
above. You may not use some temporary directory - that's nonsense.

This patch forbinds starting container via lxc-start without rcfile and
custom start program, but probably it fixes only small part of problem.
I really don't see much sense in such a feature without ability of
overriding 'default' setting with command line switches. Anyway, default
behaviour should be as save as possible.

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agopass lxc_conf to the lxc_start function instead of the rcfile
Daniel Lezcano [Thu, 26 Nov 2009 15:46:24 +0000 (16:46 +0100)]
pass lxc_conf to the lxc_start function instead of the rcfile

The rcfile is parsed in the lxc_start function. This is not the place
to do that. Let's the caller to do that.

In the meantime, we have the lxc_conf structure filled right before
calling the lxc_start function so we can do some sanity check on the
configuration to not break the system when we launch the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove unnecessary reset of msg.msg_controlle
Jamal Hadi Salim [Thu, 26 Nov 2009 15:46:24 +0000 (16:46 +0100)]
Remove unnecessary reset of msg.msg_controlle

Remove unnecessary reset of msg.msg_controllen

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse correct number of ttys during setup
Sven Wegener [Thu, 26 Nov 2009 15:46:23 +0000 (16:46 +0100)]
use correct number of ttys during setup

commit 985d15b106c8959ff130ba5425c2abbe36dc2cca "fix fdleak and errors
in lxc_create_tty()" created a zero-sized malloc(), causing memory
corruption. use config->tty like all the other code does.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agominor cleanups for instanciate_veth()
Michael Tokarev [Thu, 26 Nov 2009 15:46:23 +0000 (16:46 +0100)]
minor cleanups for instanciate_veth()

the same cleanup as in instanciate_macvlan(). Just makes code
shorter and less "jumpy" (as with goto back)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoallow lxc.network.pair to specify host-side name for veth interface
Michael Tokarev [Thu, 26 Nov 2009 15:46:23 +0000 (16:46 +0100)]
allow lxc.network.pair to specify host-side name for veth interface

Currently we allocate veth device with random name on host side,
so that things like firewall rules or accounting does not work
at all.  Fix this by recognizing yet anothe keyword to specify
the host-side device name: lxc.network.pair, and use it instead
of random name if specified.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-ps to limit its search to containers
Michel Normand [Thu, 26 Nov 2009 15:46:22 +0000 (16:46 +0100)]
lxc-ps to limit its search to containers

The purpose of this patch is to limit the search
of pids to those in containers by looking at first
in the /cgroup/<name>/tasks  when --lxc or --names options
are specified by user.
The idea is to speedup the output when only few
container names are specified while the machine
is running with many processes.

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-ls to report also active containers
Michel Normand [Thu, 26 Nov 2009 15:46:22 +0000 (16:46 +0100)]
lxc-ls to report also active containers

With previous changes that allow to start a container
without the need to create it; the lxc-ls was only reporting
the created containers.
With this patch, the lxc-ls is now reporting created and active
containers.

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-ps typo in man lxc
Michel Normand [Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)]
lxc-ps typo in man lxc

Fix bad name parameter in the lxc-ps man page.

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-info to report the FROZEN state
Michel Normand [Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)]
lxc-info to report the FROZEN state

this state is reported when the lxc-freeze command
was issued on the container.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix fdleak and errors in lxc_create_tty()
Michael Tokarev [Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)]
fix fdleak and errors in lxc_create_tty()

if, for some reason, openpty() fails, lxc_create_tty() will
leak all previous ptys and leave the config structure in a
inconsistent state (wrt the number of ptys actually opened)
Fix that by explicitly closing all previously opened ptys
in case of failure and by setting number of actually opened
ttys after actual open

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoversion 0.6.4
Daniel Lezcano [Fri, 20 Nov 2009 14:01:32 +0000 (15:01 +0100)]
version 0.6.4

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix rpm generation regarding latest modifications
Daniel Lezcano [Fri, 20 Nov 2009 14:01:31 +0000 (15:01 +0100)]
fix rpm generation regarding latest modifications

The configuration examples have been moved to doc/lxc/examples.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agocheck if lxc.netdev.link is set for macvlan
Michael Tokarev [Fri, 20 Nov 2009 14:01:31 +0000 (15:01 +0100)]
check if lxc.netdev.link is set for macvlan

Ensure that lxc.netdev.link is specified for macvlan interfaces,
since it's required.

While at it, simplify logic in instanciate_macvlan():
remove unnecessary-complicating goto statements (we only
need to perform a cleanup in one place)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoallow link-less veth devices
Michael Tokarev [Fri, 20 Nov 2009 14:01:31 +0000 (15:01 +0100)]
allow link-less veth devices

Before, a veth device pair required a link which was treated as
a bridge device.  Code crashed if there was no lxc.network.link
specified.  Fix that by allowing lxc.network.link to be unset

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agorollback configuration is a file
Daniel Lezcano [Fri, 20 Nov 2009 14:01:30 +0000 (15:01 +0100)]
rollback configuration is a file

The container will be a directory where the user can store everything,
so we create one directory and store a configuration file inside.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoDo not chdir when daemonize
Daniel Lezcano [Fri, 20 Nov 2009 14:01:30 +0000 (15:01 +0100)]
Do not chdir when daemonize

With the previous modifications, a temporary directory is created
to mount the rootfs in order to have the system container to remount
itself the '/' directory.

But in case of daemonize, we change the directory, so when the rootfs
is specified with a relative path, we can not access it.

Don't chdir, as that will be done automatically later in the chroot
setup.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate the man pages
Daniel Lezcano [Fri, 20 Nov 2009 14:01:30 +0000 (15:01 +0100)]
update the man pages

Update the man pages regarding the different modifications.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange C/R api
Michel Normand [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
change C/R api

Change Checkpoint / Restart API

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove unused cr_plugin_columbia.c
Michel Normand [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
remove unused cr_plugin_columbia.c

Remove checkpoint / restart dead code.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc_init better error reporting
Michel Normand [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
lxc_init better error reporting

Display the 'rcfile' value on error

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange network_netdev function parameter
Daniel Lezcano [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
change network_netdev function parameter

A mindless change to encapsulate a little more the function.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofactor out common config evaluating code
Michael Tokarev [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
factor out common config evaluating code

in confile.c we currently have a ton of functions each doing
the same thing.  Clean them up by providing common routines
to do the main work.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agorename struct lxc_netdev fields to match reality
Michael Tokarev [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
rename struct lxc_netdev fields to match reality

struct lxc_netdev is used to hold information from cnfig file
about a network device/configuration.  Make the fields of this
structure to be named similarily with the config file keywords,
namely:
 s/ifname/link/ - host-side link for the device (bridge or eth0)
 s/newname/name/ - container-side ifname
It is insane to have completely different names in config file
and in structure/variable names :)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate the man pages
Daniel Lezcano [Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)]
update the man pages

Update the man pages regarding the modifications around the
configuration option, volatile containers and new configuration
file format.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoexport set_state function
Michel Normand [Tue, 17 Nov 2009 21:57:46 +0000 (22:57 +0100)]
export set_state function

This function will be needed for the restart function.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd capabilities for lxc-checkpoint
Michel Normand [Tue, 17 Nov 2009 21:57:46 +0000 (22:57 +0100)]
add capabilities for lxc-checkpoint

add capabilities for lxc-checkpoint

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: move setup_fs to utils.c
Michel Normand [Tue, 17 Nov 2009 21:57:46 +0000 (22:57 +0100)]
lxc: move setup_fs to utils.c

This is not required immidiately but may be used by other init.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix container find the previously created configuration
Daniel Lezcano [Tue, 17 Nov 2009 21:57:46 +0000 (22:57 +0100)]
fix container find the previously created configuration

The command specifies a configuration file => use it
The command does not specify a configuration but the container
was created before, use the configuration.
The command does not specify a configuration and the container
was not created before, use default.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-netstat should use @LXCPATH@ for lxcpath=
Andrian Nord [Tue, 17 Nov 2009 09:56:24 +0000 (10:56 +0100)]
lxc-netstat should use @LXCPATH@ for lxcpath=

Typo ;)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agobatched reads for lxc_console
Michael Tokarev [Tue, 17 Nov 2009 09:56:24 +0000 (10:56 +0100)]
batched reads for lxc_console

Instead of doing I/O one-byte-at-a-time in lxc_console,
which is slow, let's do it in batches.  Only for output
(from container to the host system), since input is most
likely one-byte-at-a-time anyway (from a keyboard).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agohost consoles/ttys in containers
Michael Tokarev [Tue, 17 Nov 2009 09:56:24 +0000 (10:56 +0100)]
host consoles/ttys in containers

I noticed that container's consoles aren't quite useable
(be it lxc-console or lxc-start with getty bound to /dev/console).
The main problem is a complete lack of window resizing support:
when I resize an xterm window with lxc-start or lxc-console, the
"guest" does not know about that and continues to think that the
terminal is 80x25 still.

Is it just a lack of functionality (missing implementation) or
something problematic?

Ok, the attached patch fixes this.

It moves the 'master' variable out of main function so it's
accessible from the signal handler, sets up SIGWINCH handler
to call a (newly created) winsz() function that gets the
current tty size using TIOCGWINSZ ioctl and if that works,
sets up the pty size using TIOCSWINSZ.  That same function
is called at the start as well, when setting up the signal
handler.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-By: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoChoose configuration directory
Andrian Nord [Tue, 17 Nov 2009 09:56:23 +0000 (10:56 +0100)]
Choose configuration directory

Maybe it will be more logical to keep configs into /etc/lxc/?

Or, maybe, just use --with-config-path=/some/path switch into configure,
which could be overridden as user wants to? Something like this one (in
assumption, that this is up to user to create corresponding directory):

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agocleanup <lxc/lxc.h>
Cedric Le Goater [Tue, 17 Nov 2009 09:56:23 +0000 (10:56 +0100)]
cleanup <lxc/lxc.h>

<lxc/lxc.h>  should only include what is needed. This patch removes
all useless headers from lxc.h and fixed other .c files.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agotypo in 488624016575d092d56211347b2bbe8367cd339a (V2)
Michel Normand [Fri, 13 Nov 2009 21:55:23 +0000 (22:55 +0100)]
typo in 488624016575d092d56211347b2bbe8367cd339a (V2)

without this correction, unable to create a container with a configuration file.
This is a side effect of commit 488624016575d092d56211347b2bbe8367cd339a

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix lxc-netstat script
Daniel Lezcano [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
Fix lxc-netstat script

Recent changes around the configuration tree broke the current
implementation of the lxc-netstat.

Instead of retrieving the init_pid in the /var/lxc/<name>/...,
pick one in the cgroup tasks list.

There is still a restriction with this command making impossible
to run it as non-root, any idea is welcome :(

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoQ: general lxc architecture
Andrian Nord [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
Q: general lxc architecture

Patch moves etc/* contents into doc/examples/ and adds
--disable-examples configure switch which may be used not to install
examples. Default is to install them into ${docdir}/examples (commonly:
/usr/share/doc/lxc/examples)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc lxc-sshd using new lxc.mount.entry keyword
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
lxc lxc-sshd using new lxc.mount.entry keyword

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: remove lxc.mount setting in lxc-fedora script
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
lxc: remove lxc.mount setting in lxc-fedora script

This script do not use extract fstab (as done by lxc-debian)
so there is no reason to set the lxc.mount key in config file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <michel_mno@laposte.net>
14 years agolxc-debian using new lxc.mount.entry keyword
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
lxc-debian using new lxc.mount.entry keyword

Fix script to not add a fstab file.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: add a new lxc.mount.entry keyword
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
lxc: add a new lxc.mount.entry keyword

The purpose of this new keyword is to save in main config file
all the lines of a provided fstab file.
This will ultimately replace the the lxc.mount keyword
when lxc scripts will use the new keyword.

Warning: I did not validated this patch
in all conditions of provided malformed input string.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agostop config reading if cgroup setting failed
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
stop config reading if cgroup setting failed

in today's code lxc-start to not stop if setup_cgroup is detecting an error

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-debian to not use empty mount table
Michel Normand [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
lxc-debian to not use empty mount table

lxc should not save in config generated file the name of an
empty file if no additionnal mount point specified by user.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoReplace create/destroy by a script
Daniel Lezcano [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
Replace create/destroy by a script

The simplification of the container configuration makes
pointless to have so much complexity in the container creation.
Let's remove that and replace by some scripts.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAllows a container to run without previous creation
Daniel Lezcaon [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
Allows a container to run without previous creation

When a container was created, its configuration is used.
When a container was not created, the configuration specified in
the command line is used, if not configuration file is used,
default values are used.

That allows to create 'volatile' container, like tmp files.
It is useful for example to spawn different container with the
same generic configuration file. That let the user to have its own
repository of configuration files.

And, more important, that fix temporary created container with
lxc-execute to be not deleted when the host crash or the command
is killed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoliblxc: Fix compile failure
Dhaval Giani [Fri, 13 Nov 2009 10:48:29 +0000 (11:48 +0100)]
liblxc: Fix compile failure

Fix compile failure

commit 884866b3c305f1edd74c9ea7f082d009a86f3fd5 introduces a compile
failure,

make[3]: *** No rule to make target `lock.c', needed by `liblxc_so-lock.o'.  Stop.
make[3]: Leaving directory `/home/dhaval/work/lxc/lxc/src/lxc'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dhaval/work/lxc/lxc/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/dhaval/work/lxc/lxc/src'
make: *** [all-recursive] Error 1

Remove those entries from the Makefile

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix abstract af_unix socket name
Daniel Lezcano [Thu, 12 Nov 2009 13:40:14 +0000 (14:40 +0100)]
Fix abstract af_unix socket name

Fix a typo making the abstract af_unix socket name to be wrong.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove the usage of a lock file
Daniel Lezcano [Thu, 12 Nov 2009 13:40:14 +0000 (14:40 +0100)]
Remove the usage of a lock file

The lock is no longer needed as the mutual exclusion and
'is running' check is done via the af_unix command socket.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoexport log function so it can be used by library user
Cedric Le Goater [Thu, 12 Nov 2009 13:40:14 +0000 (14:40 +0100)]
export log function so it can be used by library user

The log api may be used by an external component which needs to
access these functions.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove an unnecessary entry in the spec file
Ryousei Takano [Wed, 11 Nov 2009 20:33:44 +0000 (21:33 +0100)]
Remove an unnecessary entry in the spec file

Hi Daniel and all,

The rpmbuild command fails due to an unnecessary *.a entry in the %file list.
This patch removes it from the lxc.spec file.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoipv6 interfaces added with /0 prefix
Andrian Nord [Mon, 9 Nov 2009 09:43:03 +0000 (10:43 +0100)]
ipv6 interfaces added with /0 prefix

Greetings, I've found a small typo into src/lxc/conf.c that leads to
nulled prefix for ipv6 addresses.

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: lxc version to reflect string in AC_INIT (V2)
Michel Normand [Wed, 4 Nov 2009 14:14:30 +0000 (15:14 +0100)]
lxc: lxc version to reflect string in AC_INIT (V2)

I changed the code to have lxc version to reflect the
string set in AC_INIT of configure.ac
rather than to report only the 3 first digits

update: use PACKAGE_VERSION in place of VERSION

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoconfigure.ac - allow user to switch off/on documentation generation
Andrian Nord [Wed, 4 Nov 2009 13:03:44 +0000 (14:03 +0100)]
configure.ac - allow user to switch off/on documentation generation

Andrian Nord <NightNord@gmail.com>:
>> > > As documentation requires docbook2man to be installed, which is not,
>> > > otherwise, required for proper LXC work or compilation process, it
>> > > might be usefull to be able to switch it off.

Michel Normand <normand@fr.ibm.com>:
> > For me, it is Ok to add a --enable/disable/-doc,
> > but not make configure to fail if no option specified
> > and no docbook2man package.
> >
> > For me it should be optionnal.
> > I like the current behaviour where configure is running without option
> > and is enabling/disabling by itself the doc building.
> > Could you send a new patch with this idea ?

Andrian Nord <NightNord@gmail.com>:
Of course. You mean, that you what default behaviour to remain
auto-detection? That is:
--enable-doc: require docbook2man or fail, generate mans
--enable-doc=auto, or not specified (default): check for docbook2man,
generate mans if found, silently ignore if not found (I suppose
diagnostic message is redundant, as information already contains into
./configure --help)
--disable-doc: never check for docbook2man and don't gen mans

Here comes a patch what do this, as far as I see
(I'm sorry for violating post-rules in previous mail, now I'll do all
right, I hope. Should I attach patch anyway, as it might be usefull
for applying?)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Acked-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc /cgroup/name/ not removed at container end
Michel Normand [Tue, 3 Nov 2009 10:40:42 +0000 (11:40 +0100)]
lxc /cgroup/name/ not removed at container end

this is a side effect of my previous patch
that removed the LXCPATH/name/nsgroup file.
9f44c57836626d8eb16c7bba4a5f5d88db74df01

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation error when buildir differs from srcdir
Daniel Lezcano [Fri, 23 Oct 2009 09:15:27 +0000 (11:15 +0200)]
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>
14 years agolxc: kill libtool
Cedric Le Goater [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
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>
14 years agouse config.h to define the lxcpath and co
Daniel Lezcano [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
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>
14 years agoremove test directory
Daniel Lezcano [Thu, 22 Oct 2009 13:33:40 +0000 (15:33 +0200)]
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>
14 years agomount /dev/mqueue
Daniel Lezcano [Thu, 15 Oct 2009 12:17:14 +0000 (14:17 +0200)]
mount /dev/mqueue

Mount always /dev/mqueue with lxc_init.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoclean up and factor out some code
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
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>
14 years agoFix network prefix
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
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>
14 years agofix compilation error for tests
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
fix compilation error for tests

Fix test program compilation errors.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove configure dead code
Daniel Lezcano [Mon, 12 Oct 2009 20:02:06 +0000 (22:02 +0200)]
remove configure dead code

Remove the old configuration remaining code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix tty creation using confdir
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
fix tty creation using confdir

tty_create uses the old conf directory, fixing this.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix netdev structure vs network structure
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agoFactor out some network code
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
Factor out some network code

We can factor out the "ip addr add"

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUse the configuration structure for the network
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agoMove configuration info to the structure
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agoMove the configuration file to the start function
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agouse the configuration structure for the cgroup
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use the configuration structure for the cgroup

Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove the LXCPATH/<name>/nsgroup file
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agouse the new nsgroup_path_get function in freezer.c
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agonew lxc_cgroup_path_get function
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agoplace nscgroup path in lxc_handler
Michel Normand [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agouse the configuration structure for the tty
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
use the configuration structure for the tty

Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse configuration structure for the mount points
Daniel Lezcano [Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)]
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>
14 years agoUse the configuration structure for pts
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
Use the configuration structure for pts

Avoid to use the directory structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the configuration structure to setup the utsname
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
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>
14 years agouse the configuration structure for setting up the rootfs
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
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>
14 years agouse the configuration to check if a resource is enabled
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
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>
14 years agoRead the config file at restart
Daniel Lezcano [Fri, 9 Oct 2009 09:38:38 +0000 (11:38 +0200)]
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>
14 years agomake container to die when parent dies
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
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>
14 years agoSimplify the mainloop
Daniel Lezcano [Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)]
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>