Commit Graph

1578 Commits

Author SHA1 Message Date
Daniel Lezcano
61ba7fe64a cleanup namespace.h
Rename lxc_namespace.h to namespace.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2009-03-30 14:02:19 +02:00
Ryousei Takano
e65b846976 Use 'uname -m' instead of arch
'uname -m' seems to be more general to get the machine's architecture
type.  Ubunbu 8.10 (and also all debian based distros?) does not have
arch(1).

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-27 11:12:45 +01:00
Ryousei Takano
b44cb779a1 Add mtu option setting for lxc-fedora
This patch adds the mtu option setting for the lxc-fedora script.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-26 11:39:19 +01:00
Ryousei Takano
81f6a40acf Add mtu option setting for lxc-debian
This patch adds the mtu option setting for the lxc-debian script.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-26 11:39:19 +01:00
Daniel Lezcano
eb14c10a41 set the mtu before attaching to the bridge
"I checked lxc-0.6.1 and your commit 75d09f83b8
(set mtu for netdev).

I found a problem of the MTU size of br0.  In the current code,
device_set_mtu() is
called after bridge_attach(), so the MTU size of br0 is set to the
default MTU size
of veth0 (i.e., 1500 bytes).
This causes performance degradation as I reported.

We need to modify to call device_set_mtu() before bridge_attach()"

Now that we have the network functions accessible, do not longer
use the lxc_configure_veth, lxc_configure_macvlan and split
the configuration of the veth in order to create it, configure it
and finally attach it to the bridge.

Reported-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Ryousei Takano <takano-ryousei@aist.go.jp>
2009-03-26 11:32:23 +01:00
Daniel Lezcano
497353b66b change the api to export the network functions
The network functions are too encapsulated and do not allow
flexibility. Export all these api and prepare the changes for the
next patch to set the mtu.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Ryousei Takano <takano-ryousei@aist.go.jp>
2009-03-26 11:32:22 +01:00
Ryousei Takano
b35f75882e Fix trivial stuff for mtu option setting
Hi Daniel,

This patch removes unused variable 'strmtu' and fix an incorrect variable name.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-25 18:47:14 +01:00
Daniel Lezcano
1b36359d9b increment minor version number
increment the minor version number for the next release

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-24 18:31:23 +01:00
Daniel Lezcano
237315ff50 Use a specific script to set the capabilities
Instead of having the capabilities to be set automatically,
it will be up to the user to set them through a specific
script 'lxc-setcap'.

After installing the lxc tools, if we want them to be available,
for a non-root user, lxc-setcap will set the needed capabilities.
If, after thinking it, we want to remove the capabilities,
the 'lxc-setcap -d' will do this for us.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Guido Trotter <ultrotter@google.com>
2009-03-24 16:57:41 +01:00
Daniel Lezcano
75d09f83b8 set mtu for netdev
When setting the mtu size at the veth creation, the mtu is only set
on one side of the veth tunnel, the one attached to the bridge.

I changed a little the code and added the device_set_mtu function so
it is called after the veth has been created on both side.

That moves the mtu veth specific code inside the veth function creation.

Hopefully this code could be reused later for different future network
configuration (eg. ip tunnel).

The mtu option will be simply ignored in case of macvlan network configuration
because the macvlan network device inherit the mtu of the physical link.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-22 22:52:17 +01:00
Takano Ryousei
442cbbe65b Add lxc.network.mtu configuration (resend)
Hi Daniel,

I resent my patch. I hope to fix folding failure.

This patch allows users to specify the MTU size of the veth interface.
 It helps to use jumbo frames on the container.

Changes from v1:
	- Fix failing if the 'mtu' is not specified.
	- Delete the 'mtu' entry at time of lxc-destroy.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-22 09:47:30 +01:00
Daniel Lezcano
dfdcea5c4f Fix capability setting for lxc-init
lxc-init has moved to libexec, change the corresponding setcap
path.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-20 16:25:46 +01:00
Matt Helsley
bfa3802503 Add powerpc signalfd syscall numbers
Add signalfd and signalfd4 syscall number definitions for powerpc so
that we may compile even with older platform headers.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-20 11:51:46 +01:00
Guido Trotter
3619350200 CONTRIBUTING: specify where one can send patches
Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-19 16:11:11 +01:00
Guido Trotter
e81c7f2cce CONTRIBUTING: fix two typos
s/accessible/accessed/ because the optionality of the possibility is
already expressed by the 'can be' in front of it.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-19 16:11:10 +01:00
Guido Trotter
dbdab2ffcb lxc-checkconfig: Allow to override grep and config
It might be handy for the user to specify a different kernel config file
to check, perhaps the one of a kernel he's about to build. To allow that
we only set the CONFIG variable if it's not present in the environment
before. Also, if CONFIG is not found and we resort to a different file,
we say it explicitely, to avoid typos on the user's part resulting in
silently checking a different config than the one the user wanted.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-19 16:11:10 +01:00
Guido Trotter
84a156421a lxc-checkconfig: look in one more place
The current version of lxc-checkconfig falls back to searching in
/lib/modules/$KVER/build/.config if it doesn't find the config. In some
systems, though, the config will be installed in /boot/config-$KVER, so
we'll look there as well.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-19 16:11:10 +01:00
Guido Trotter
a25ba7aadb Install lxc-init in libexec dir
Since lxc-init is a helper program, which doesn't have an usage output
and is only going to be called only internally by lxc-execute, we'll
move it to the libexec dir.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-19 16:11:09 +01:00
Daniel Lezcano
d0dfcfbde7 Add .gitignore and avoid annoying interaction between compiled files and git
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-16 12:21:24 +01:00
Daniel Lezcano
fdc03323c2 Use the rbind mount for the rootfs
The actual behavior is to mount bind the rootfs to a specific location and
chroot to it. If someone did previously some bind mount in the rootfs they
will be lost in the container.

This fix makes the rootfs to have the submounts in the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-11 10:20:05 +01:00
Kristian Høgh
7e7f51d1b4 lxc-checkconfig fails on a kernel compiled without IKCONFIG_PROC.
Hi Daniel,

This patch retrieves info from kernel config in
/lib/modules/`uname -r`/build/.config
unless /proc/config.gz exist
                                                                                                            
Signed-off-by: Kristian Høgh <kfh.lxc@kfh.dk>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-10 11:00:32 +01:00
Serge E. Hallyn
30761e835c s390 sys_clone is backwards
Switch the flags and sp for sys_clone for s390.

Without this, lxc-execute gets a segfault on clone (of course).
With this, it succeeds.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-09 20:46:06 +01:00
Serge E. Hallyn
47f3833097 define s390x signalfd for old headers
define s390x signalfd for systems with headers which are too
old.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-09 17:38:17 +01:00
Michael K. Johnson
8ca61733b9 define signalfd patch
If sys/signalfd.h does not exist, assume that it does not exist
in glibc, rather than that it exists without a corresponding
header file.  Note that this version of the signalfd() wrapper
function (unlike the version in glibc) falls back dynamically to
the old signalfd system call if the signalfd4 system call is not
implemented in the currently-running kernel; the version in glibc
chooses the version of the signalfd system call to make via static
build-time configuration.

Signed-off-by: Michael K Johnson <johnsonm@rpath.com>
Signed-off-by: Daniel Lezcnao <dlezcano@fr.ibm.com>
2009-03-08 17:24:26 +01:00
Matt Helsley
216061bffa liblxc: Remove unused variable
nbargs isn't used for anything in lxc_unshare.c. Remove it.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
Matt Helsley
b7f85ccbb4 liblxc: Add username and uid lookup/check.
Add the ability to lookup usernames and check uids. Bails out early if the given
uid/name does not exist and avoids using atoi() (which is bad because we can't
tell if it parsed an int or a pumpkin).

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
Matt Helsley
3cf586a20a liblxc: Fix compiler warning
The second const qualifier causes gcc to emit a warning. const char *
should be sufficient.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
Matt Helsley
656994bbfa liblxc: Handle missing PR_CAPBSET_DROP definition
On distros with older headers liblxc fails to build because PR_CAPBSET_DROP is 
not defined by including /usr/include/sys/prctl.h. This adds an autoconf
test and, if not present, defines it. When prctl() is called on systems that
do not support PR_CAPBSET_DROP we should expect EINVAL. This case is already
handled by the liblxc code so no further changes are needed.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
Matt Helsley
54b1eb6860 liblxc: create a fedore template container
On Mon, 2009-02-09 at 15:43 -0800, Dan Smith wrote:
> DL> It may be possible to use yum like debootstrap for an minbase
> DL> fedora install.
> 
> Yep, something like the following should work:
> 
>   root=/path/to/tmproot
>   mkdir -p $root/var/lib/rpm
>   rpm --root $root --initdb
>   rpm --root $root -Uvfh --nodeps http://fedora.osuosl.org/linux/releases/10/Fedora/i386/os/Packages/fedora-release-10-1.noarch.rpm
>   yum --installroot=$root -y groupinstall Base

Looks familiar! ;) I was intrigued by this idea last weekend so I
started such a script. However I only tested it as far as creating a
semi-correct rootfs. With the exception of network configs most of the
configs are still written as for debian. For example I know the selinux
policy enforcement settings need to move, the inittab needs to be
replaced by the proper upstart configs, etc.

Of course it's based heavily on Daniel's excellent lxc-debian script.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-03-08 17:09:27 +01:00
dlezcano
1e648e6539 Add the pts configuration for lxc-debian
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Add the pts configuration when creating a debian container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-20 14:13:37 +00:00
dlezcano
cb69865878 Add missing files to CVS 2009-02-16 11:25:49 +00:00
dlezcano
b2718c72a7 Factor out some code
From: Daniel Lezcano <daniel.lezcano@free.fr>

Factor out some code and especially the parsing of text file functions.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:22:49 +00:00
dlezcano
78ae2fcca0 Support block device for the rootfs
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Allow to specify a block device as the rootfs. The creation of the
container will try with brute force to determine the file system type.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:21:41 +00:00
dlezcano
44931bc727 Add more capabilities
From: Daniel Lezcano <daniel.lezcano@free.fr>

lxc-execute and lxc-create need capability to mount.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:19:27 +00:00
dlezcano
4c8ab83be6 Make use of realpath
From: Daniel Lezcano <daniel.lezcano@free.fr>

The realpath function is more convenient to build the absolute path of
the rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:14:34 +00:00
dlezcano
9b0f04774f Mount bind the rootfs directory
From: Daniel Lezcano <daniel.lezcano@free.fr>

Instead of using a symlink to the rootfs, just mount bind the rootfs
directory.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:13:15 +00:00
dlezcano
c952d1b915 Remove some pointless debian services
From: Daniel Lezcano <daniel.lezcano@free.fr>

Remove some debian services because they don't have sense in a container,
like the hw clock or the unmount of the file systems.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-16 10:11:03 +00:00
dlezcano
341a091c39 Update the man according new devpts instance
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Update the man page with the new devpts instance option.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-12 14:48:25 +00:00
dlezcano
3c26f34eab setup the new pts instance
From: Daniel Lezcano <dlezcano@fr.ibm.com>

The pts new instance is setup conforming the documentation in the
kernel sources, Documentation/filesystems/devpts.txt.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-12 14:48:04 +00:00
dlezcano
10db618d7d add the new pts instance configuration
From: Daniel Lezcano <dlezcano@fr.ibm.com>

This patch adds the configuration for a new pts instance.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-12 14:47:36 +00:00
dlezcano
db4aa207ce build a set of flags for the different enabled subsystems
From: Daniel Lezcano <dlezcano@fr.ibm.com>

When we want to check if a subsystem is enabled, we look at the
presence of a file/directory in the configuration tree files. That
works until we chroot into the rootfs. Some subsystem should be
preferably setup after the chrootfs, making the code simpler and
easier to read. So before setup the different subsystem, I build a
flags set and reuse it later to check if the subsystem is enabled or
not.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-12 14:47:10 +00:00
dlezcano
6c2b975b7d Add a TODO file
From: Daniel Lezcano <daniel.lezcano@free.fr>

The TODO file should be filled.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-12 14:46:54 +00:00
dlezcano
45e2df30c1 add missing ifupdown package to debootstrap
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Add the ifupdown missing package.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-09 17:11:24 +00:00
dlezcano
2f997019d0 Update lxc-debian to use the lenny release
From: Matt Helsley <matthltc@us.ibm.com>

With the release of lenny nearing this patch may soon be useful.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-09 17:10:52 +00:00
dlezcano
49b93bbfb8 Create the m4 directory if it does not exist
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Create the m4 directory if it does not exist

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-09 17:10:02 +00:00
dlezcano
8524810714 handle interruption/failure of lxc-debian more gracefully
From: Matt Helsley <matthltc@us.ibm.com>

If lxc-debian fails or is interrupted during debootstrap then the next
invocation of lxc-debian breaks because it only checks for the existence
of the directory. This forces the user to remove the cache by hand to
retry the create step.

Let's allow the user to re-run lxc-debian to resume/retry. Store the
cache in a partial-$ARCH directory until debootstrap succeeds. Then move
the valid cache to its final destination.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-05 12:03:47 +00:00
dlezcano
ff218c25da Add signalfd function definition
From: Dietmar Maurer <dietmar@proxmox.com>

The signalfd function prototype and the signalfd header file is not
defined in the debian Lenny. We want to use this debian version with a
newer kernel.

This patch gives the signalfd function prototype, because the function is
available in the glibc-2.7 which is the version coming with debian Lenny.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-02-02 14:50:00 +00:00
dlezcano
dc21287c4d Complete use of autoconf prefix in lxc-debian
From: Matt Helsley <matthltc@us.ibm.com>

The lxc-debian script does not consistently address the lxc lock as
@LOCALSTATEDIR@/lock/subsys/lxc. Make consistent use of the autotools
substitution to completely enable configure --prefixes.

I also added a comment explaining why some of the paths didn't need
autoconf substitutions for anyone who wants to understand the script.
Also, to separate it from the container contents proper, I moved the
CACHE variable initialization above the container-internal path
variables.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-01-29 10:50:28 +00:00
dlezcano
79cf945c06 From: Daniel Lezcano <daniel.lezcano@free.fr>
This modification removes the tty configuration file and makes the tty
to be usable with the local tty.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-01-28 16:33:55 +00:00
dlezcano
64870cda2a Fixed bad variable type
From: Daniel Lezcano <daniel.lezcano@free.fr>

Fixed the type of the opt variable. On the powerpc architecture, that leads
to an infinite loop in the getopt inspection because getopt returns 255
instead of -1 as expected. The opt variable should be an int and not a char.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-01-26 19:43:46 +00:00