Commit Graph

1073 Commits

Author SHA1 Message Date
Daniel Lezcano
9dd97e4414 lxc-0.7.4-rc1
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-01 12:55:39 +01:00
Cedric Le Goater
dfb8f06a3b take into account new configure option --with-linuxdir
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
2011-02-01 12:54:17 +01:00
Clement Calmels
0f1c997258 generate setns syscall number
Signed-off-by: Clement Calmels <clement.calmels@fr.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
2011-02-01 12:54:17 +01:00
Daniel Lezcano
9f53d717c4 lxc-attach gives a better error message
Don't assume the user knows the kernel internals :)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-01 11:42:29 +01:00
Daniel Lezcano
b09ecaf303 Fix paths in the lxc-busybox template
Author of the patch : Jonathan Liu <???> posted as a bug fix on the lxc
sourceforge website.

OS: Arch Linux 32-bit

/etc/init.d/rcS do not use full path to syslogd, mount and udhcpc executables.
As busybox requires /proc mounted if CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
to run these commands without full path, the full path should be used in the
startup script as /proc is mounted later in the script.

It also fails to start the machine if /lib64 does not exist on the host system
as there is a mount entry for /lib64 in the config.

The attached patch changes commands in /etc/init.d/rcS to use full path and
adds a check for /lib64 on host before adding lib64 mount entries to config.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-28 00:24:54 +01:00
Daniel Lezcano
3244e75040 export env variable in lxc_start
Let's export the 'container' variable and let init receive it
as a kernel command line option.

In the upstart init scripts, we can distinguish if we are in a
container context or not.

===============================================================================

# /dev/console - getty
#
# This service maintains a getty on /dev/console from the point the
# system is started until it is shut down again.
# It only runs in lxc containers.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

env container
pre-start script
	[ "x$container" != "xlxc" ] && { stop; exit 0; }
	exit 0;
end script

respawn

exec /sbin/getty -8 38400 /dev/console

===============================================================================

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-28 00:14:51 +01:00
Daniel Lezcano
434d90db57 suppress udev log output
We use udev within these containers and we prevent the /dev files
to be created with the cgroup whitelist. So when the udevd receives
the event from the kernel, it will fail to create some nodes in /dev
and will spit error on the console.

We set the log level to zero, so udev will silently fail.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-23 21:47:12 +01:00
Serge Hallyn
27b39fd49d Update ubuntu templates
Rename 'ubuntu' template to 'lucid'

Add new maverick and natty templates, which do much less tweaking
of the environment.  These should only be used on a kernel which
supports sysfs tagging for /sys/class/net, as udev will be running
in the container.

The natty template needed to slightly change the installed packages
for dhclient to be correclty installed.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-22 21:59:40 +01:00
Reto Gantenbein
fb4c7e2829 Adds correct file capa detection for >2.6.32 The kernel compile parameter was removed with kernel release 2.6.33 Since then file capabilities are enabled by default kernel commit: b3a222e52e4d4be77cc4520a57af1a4a0d8222d1
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-19 00:29:41 +01:00
David Ward
b0efbac48e Only bring up network interface if IFF_UP is set
Each network interface was brought up regardless of the configuration,
as the wrong boolean operator was being used to test the IFF_UP flag.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-17 10:18:50 +01:00
Daniel Lezcano
6e35af2e39 set veth host's side always up
We should always have the veth host's side up, otherwise if we omit
the up flag in the configurationn, letting the container to configure
its interface, the network will be never enabled as the host's side
is not up.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-17 10:18:50 +01:00
Joerg Gollnick
91656ce587 Fix mntflags initialization
Dear all,
while setting up a container on x86_64 (archlinux host/guest) I had trouble 
with mounting dev/pts and others from container.fstab and a ssh login does not 
work (only ssh container bash -i gives you a shell)
The cause is that conf.c does not initialize mntflags.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-16 19:40:46 +01:00
Daniel Lezcano
2175f8936c add lxc-lenny template
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-14 09:51:13 +01:00
Daniel Lezcano
e465953677 fix clone_children path
This line is at the wrong place ...

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 23:45:22 +01:00
Daniel Lezcano
03d56dffa6 add missing template in Makefile
Missed to add lxc-lenny to the template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:25:14 +01:00
Daniel Lezcano
0016af974d fix busybox inittab template
The inittab file format is wrong regarding how behaves busybox with
this syntax.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:25:14 +01:00
Daniel Lezcano
013bd42848 substitute the absolute rootfs mount path
Change the mount point in the rootfs because we mount the rootfs
in ROOTFSDIR for the pivot. We have to substitute the real mount
path to the new path located in ROOTFSDIR.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:25:14 +01:00
Daniel Lezcano
911324ef25 encapsulate mount point code
Change the code to encapsulate the different mounts point.

 * mount on the host fs
 * mount relatively to the rootfs
 * mount absolutely to the rootfs (broken)

That will make the code cleaner to fix the latter.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:25:14 +01:00
Daniel Lezcano
d330fe7b86 mindless changes to conform indentation
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:15:15 +01:00
Daniel Lezcano
8edcba11e9 set function static
Set the function prototype to static as it is not exported and used
somewhere else in the code than this file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-13 16:15:15 +01:00
Daniel Lezcano
429a84f4ab fix cgroup directory removal
Fix the name of the directory to remove.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-10 17:58:32 +01:00
Daniel Lezcano
5193cc3d93 fix the ns_cgroup vs clone_children
The following patch fixes the bug where the clone_children compatibility
flag is available with the ns_cgroup subsystem. The 2.6.37 kernel version
should be the only one which is concerned by this modification, please
refer to Documentation/feature-removal-schedule.txt and look for ns_cgroup.

The problem is coming from we check for clone_children and we set it
automatically and then we try to create a new cgroup. As the
ns_cgroup is present the cgroup already exists and we are not allowed
to attach our pid to a new cgroup. The next error will be when we try
to create a new container because we enabled the clone_children flag
and the ns_cgroup is present, it is not allowed by the kernel.

The patch fix this by checking the mount options.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-01-09 23:53:19 +01:00
Daniel Baumann
57f61aa750 Correcting charset argument when calling locale-gen.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Baumann
346645ef74 Correcting include argument when calling debootstrap.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Baumann
0b2fa08ea6 Disabling unneeded checkroot.sh initscript in debian template.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Baumann
4e0eb76555 Creating missing tty device nodes for squeeze in debian template.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Baumann
49a630b8f3 Setting default mirror to cdn.debian.net in debian template.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Baumann
9116540be4 Setting default suite to squeeze in debian template.
Signed-off-by:  Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:51 +01:00
Daniel Lezcano
54c7901672 Duplicate lxc-debian to lxc-lenny
Duplicate the lxc-debian template to use it as a fine grained
template.

Subject: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-28 21:32:50 +01:00
Daniel Lezcano
fd4f5a5688 use clone_children cgroup's flag
If the ns_cgroup does not exist, we use the clone_children feature.
Everytime a cgroup is created, we set this compatibility flag and we create
the cgroup manually and add the child task to the cgroup.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:37 +01:00
Daniel Lezcano
ef342abb22 Move common code to lxc_cgroup_create
For both the ns_cgroup and the usual cgroup creation, we have to
check if a previous does not exist and remove it if it is empty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:37 +01:00
Daniel Lezcano
36b862992a encapsulate the ns_cgroup
Create a single API to create a cgroup which will switch to the old
ns_cgroup automatically.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:37 +01:00
Daniel Lezcano
b234e44fdf Change nscgroup interface
Prepare the nscgroup to be converted to the clone_children changes.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:37 +01:00
Daniel Lezcano
7c282e3cf4 Remove unused nscgroup field
This field is unused.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:37 +01:00
Daniel Lezcano
4839ec2994 remove duplicate cgroup header
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:36 +01:00
Michael Tokarev
59760f5d0f Make mount paths relative to rootfs
Why not chdir into the root of container right when
the root filesystem is (bind-)mounted, and let all
mount entries to be relative to the container root?

Even more, to warn if lxc.mount[.entry] contains
absolute path for the destination directory (or a
variation of this, absolute and does not start with
container root mount point)?

This way, all mounts will look much more sane, and
it will be much easier to move/clone containers -
by changing only lxc.rootfs.

I do it this way locally since the beginning, by
chdir'ing to the proper directory (rootfs) before
running lxc-start (in a startup script), but this
is now broken in 0.7.3 which bind-mounts rootfs
somewhere in /usr/lib/lxc.

Signed-off-by: Michael Tokarev<mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-12-17 11:43:36 +01:00
Sergey S. Kostyliov
968fbd3605 add support for dirsync mount option
Add support for `dirsync' mount option. MS_DIRSYNC is on of the
mount(2) mountflags so don't send it as extra mount option to avoid:

 	lxc-start: Invalid argument - failed to mount ...

errors.

Signed-off-by: Sergey S. Kostyliov <rathamahata@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-30 21:41:19 +02:00
Daniel Lezcano
acb0e33016 set version to 0.7.3
Version 0.7.3

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2010-10-26 18:14:47 +02:00
Daniel Lezcano
6ecad93f96 update the man page with the net script hook
Update the man page wrt the hook script added for the host side
network configuration.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2010-10-26 18:14:47 +02:00
Daniel Lezcano
43eb6f2931 fix multiple console for a container
Don't close the socket when we ask for a console, otherwise this will
make the console slot to be freed, so the next console will use the same
slot leading to an erratic behavior.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2010-10-26 17:42:38 +02:00
Daniel Lezcano
7ee895e428 don't play with the capabilities when we are root
We don't want to drop the capabilities when we are root because that
leads to some problems. For exemple, sudo lxc-start -n foo -o $(tty) fails with
"permission denied".

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2010-10-26 17:42:37 +02:00
Daniel Lezcano
b3ecde1ec3 Fix compilation error on fc12
The capability header makes the inclusion of the loop header to 
fail. Moving the inclusion of loop.h before capability.h fixes the
problem.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 15:11:45 +02:00
Daniel Lezcano
6ca5b95ef7 Fix compilation warning
Fix some compilation warnings:
 * include caps.h in lxc_checkpoint and lxc_restart
 * check the return of the timer notification read

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 15:11:45 +02:00
Daniel Lezcano
2656d23127 reduce function name
Cosmetic change by reducing the function names.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 14:57:57 +02:00
Daniel Lezcano
abbfd20baa use popen and redirect script output
Change the run_script function to use popen and to redirect
the output of the script to the log file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 10:52:47 +02:00
Daniel Lezcano
751d9dcd39 fix Coding Style
Fix the coding style, 80 chars lines, etc ...
Fix indentation blocks if ... then ... else ... fi

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 10:52:47 +02:00
Stefan Tomanek
e3b4c4c44a add lxc.network.script.up configuration hook
This commit adds an configuration option to specify a script to be
executed after creating and configuring the network used by the
container. The following arguments are passed to the script:

	* container name
	* config section name (net)

Additional arguments depend on the config section employing a
script hook; the following are used by the network system:

	* execution context (up)
	* network type (empty/veth/macvlan/phys)

Depending on the network type, other arguments may be passed:

veth/macvlan/phys:
	* (host-sided) device name

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-12 10:52:47 +02:00
Daniel Lezcano
49d3e78dce update the lxc.conf man page
Update the man page regarding the image or block device
supported as a rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-05 10:28:31 +02:00
Daniel Lezcano
a6afdde95c allow to specify a image or a device block as rootfs
This patch allows to specify an image or a block device.

The image or the block device is mounted on rootfs->mount.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-03 23:09:36 +02:00
Daniel Lezcano
b57c2211eb add rootfs mount dir variable to pkg-config
In the case we use an image for rootfs, if we need to do extra mount
from the host to the rootfs, we have to specify the place where the
image is mounted. This value is configured by the user with the
lxc.rootfs.mount otherwise defaulting to @LXCROOTFSMOUNT@. Let's 
export this variable to pkg-config, so the user can use it to build
a correct path to the rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2010-10-03 23:09:36 +02:00