Commit Graph

8686 Commits

Author SHA1 Message Date
Michael Santos
302aaa2b2d Exit if allocation fails
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-16 15:14:36 +01:00
Daniel Lezcano
071a2b8cc9 fix mount path
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-14 21:47:15 +01:00
Daniel Lezcano
d472214b83 rename physical device to the original name
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-07 02:08:47 +01:00
Daniel Lezcano
b84f58b9fb factor out networking configuration code
Change the name of the functions and factor some of them.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-07 02:08:47 +01:00
Daniel Lezcano
daa5d3fd90 lxc-0.7.4
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-26 10:18:19 +01:00
Jan Niehusmann
bb02d90eea Update file capa detection for kernels >=2.6.37
The comment containing the version number at the beginning of the kernel
config file changed its format with 2.6.37. This trivial patch makes the
grep less specific, so it triggers for both formats.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-26 10:18:19 +01:00
Amit Uttamchandani
7593bdfbe2 Fixed a small typo in lxc-debian template
"udpate" should be "update" in configure_debian().

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-19 09:45:32 +01:00
Rob Landley
a3e80ccc74 fix lxc-checkpoint and lxc-restart sgml labels
The patch fixes two build breaks in the sgml files:

lxc-checkpoint.sgml.in
Element Title in namespace '' encountered in refsect1, but no template
matches.

lxc-restart.sgml:58: parser error : AttValue: " or ' expected
      <arg
choice=req><option>--name=<replaceable>NAME</replaceable></option></a


Signed-off-by: Rob Landley <rlandley@parallels.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-17 10:07:44 +01:00
Daniel Lezcano
1b7d474304 Simplify broadcast computation
David Ward reported this computation could be written in a simpler
way.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-14 09:22:08 +01:00
Daniel Lezcano
955f4ce683 update configuration wrt to the broadcast address
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-06 21:30:18 +01:00
Daniel Lezcano
d8948a52c3 fix broadcast compution
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-06 21:29:13 +01:00
Daniel Lezcano
7b57e8b681 fix empty network configuration
The return statement is at the wrong place.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-02 21:55:49 +01:00
Daniel Lezcano
829dd9183c lxc-start can output the console to a file
Add the ability to specify a file to output the console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-01 14:49:40 +01:00
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