]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
12 years agoadd lxc-altlinux template
Alexey Shabalin [Tue, 16 Aug 2011 12:00:51 +0000 (16:00 +0400)]
add lxc-altlinux template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years ago.gateway options
Matthijs Kooijman [Tue, 30 Aug 2011 21:50:23 +0000 (23:50 +0200)]
.gateway options

Man for the gateway option.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoadd autodetection of the gateway address
Matthijs Kooijman [Tue, 30 Aug 2011 21:50:23 +0000 (23:50 +0200)]
add autodetection of the gateway address

For veth and macvlan networks, this can look up the host address on the
bridge (link) interface and add a default route on the guest to that
address. This facilitates a typical setup where guests are bridged
together.

syntax:
lxc.ipv4.gateway = auto
lxc.ipv6.gateway = auto

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years ago.gateway configuration
Matthijs Kooijman [Tue, 30 Aug 2011 21:50:23 +0000 (23:50 +0200)]
.gateway configuration

This directive adds a default route to the guest at startup.

syntax:
lxc.network.ipv4.gateway = 10.0.0.1
lxc.network.ipv6.gateway = 2001:db8:85a3::8a2e:370:7334

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoDon't log an error when the container is stopped
Daniel Lezcano [Tue, 30 Aug 2011 21:50:00 +0000 (23:50 +0200)]
Don't log an error when the container is stopped

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoremove minimal install for ubuntu template
Daniel Lezcano [Fri, 12 Aug 2011 19:47:55 +0000 (21:47 +0200)]
remove minimal install for ubuntu template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agomake undefined personality non-fatal
Daniel Lezcano [Thu, 11 Aug 2011 23:34:49 +0000 (01:34 +0200)]
make undefined personality non-fatal

Just warn, do not exit fatally.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agofix segfault when an unsupported personality is set
Daniel Lezcano [Thu, 11 Aug 2011 23:34:49 +0000 (01:34 +0200)]
fix segfault when an unsupported personality is set

Bad array len computation.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoVersion 0.7.5
Daniel Lezcano [Thu, 11 Aug 2011 17:00:13 +0000 (19:00 +0200)]
Version 0.7.5
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agofix setns parameter
Daniel Lezcano [Thu, 11 Aug 2011 16:59:44 +0000 (18:59 +0200)]
fix setns parameter

The setns syscall is now mainstream but the parameter passing changed.
Let's fix that.

The pid namespace and mount namespace attach are missing for the moment.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-ps : update the man page for passing the options
Daniel Lezcano [Thu, 11 Aug 2011 15:54:57 +0000 (17:54 +0200)]
lxc-ps : update the man page for passing the options

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-ps : fix the container name search
Daniel Lezcano [Thu, 11 Aug 2011 15:54:57 +0000 (17:54 +0200)]
lxc-ps : fix the container name search

We don't have to check for the cgroup namespace name because the
pid we are looking for is already in the list of the container owned by
lxc and retrieved from the abstract socket command name.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoadd container init pid with the lxc-info command
Daniel Lezcano [Thu, 11 Aug 2011 15:19:56 +0000 (17:19 +0200)]
add container init pid with the lxc-info command

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agofix RELEAE_URL to not hardcode the arch
InformatiQ [Wed, 13 Jul 2011 21:41:03 +0000 (00:41 +0300)]
fix RELEAE_URL to not hardcode the arch

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoworking fedora template
InformatiQ [Wed, 20 Apr 2011 20:15:51 +0000 (23:15 +0300)]
working fedora template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-checkconfig takes into account cgroup.clone_children
Daniel Lezcano [Tue, 9 Aug 2011 18:02:31 +0000 (20:02 +0200)]
lxc-checkconfig takes into account cgroup.clone_children

Take into account we may have the clone_children flag on the cgroup,
so we ignore cgroup namespace in this case.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoSilence lxc-unshare warning when removing cgroup
Serge E. Hallyn [Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)]
Silence lxc-unshare warning when removing cgroup

If ns cgroup is mounted, then when lxc-unshare runs, the kernel automatically
creates a new cgroup for the task.  So lxc-unshare tries to delete it.  But
if ns cgroup is not mounted, that cgroup does not get created, and now
lxc-unshare spits an error.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319
Forwarded: no

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agomake lxc-netstat work when /etc/mtab is not /proc/mounts
Serge E. Hallyn [Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)]
make lxc-netstat work when /etc/mtab is not /proc/mounts

like lxc-ps and lxc-ls, lxc-netstat breaks if there is not an 'lxc' cgroup
mount and /etc/mtab is not a link to /proc/mounts.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319
Forwarded: no

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agofix lxc-ls with mtab != /proc/mounts
Serge E. Hallyn [Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)]
fix lxc-ls with mtab != /proc/mounts

The cgroup mounts created by cgroup-bin do not show up in /etc/mtab.
lxc-ls, as lxc-ps before it, assumes that /etc/mtab is symlinked to
/proc/mounts.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Forwarded: no
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-ps: support '-n name' and '-- ps-options'
Serge E. Hallyn [Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)]
lxc-ps: support '-n name' and '-- ps-options'

This is more consistent with other lxc commands

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/820720

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoexplicitly do not use the console
Daniel Lezcano [Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)]
explicitly do not use the console

If the keyword 'none' is specified for the console name, lxc will ignore creating a console.
That allows to have a rootfs but without a console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoUse container's /run/utmp if it exists
Serge E. Hallyn [Sun, 7 Aug 2011 10:25:07 +0000 (12:25 +0200)]
Use container's /run/utmp if it exists

If /var/run is a symlink to /run in the container, then opening
/proc/<pid>/root/var/run/utmp will end up opening the host's utmp.
Therefore the hack detecting shutdown through utmp fails.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoadd ubuntu-keyring to the packagelist for oneiric containers.
Serge E. Hallyn [Sun, 7 Aug 2011 10:25:07 +0000 (12:25 +0200)]
add ubuntu-keyring to the packagelist for oneiric containers.

Otherwise apt fails during and after debootstrap.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoDon't try to add host user's groups in container
Serge E. Hallyn [Wed, 27 Jul 2011 14:34:58 +0000 (16:34 +0200)]
Don't try to add host user's groups in container

When '-b user' is specified to lxc-ubuntu container creation template, do
not automatically add all the groups of which user is a member on the host,
to user's groups in the container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-ubuntu: Allow /dev/fuse to be used in a container
Serge Hallyn [Sun, 24 Jul 2011 22:22:50 +0000 (00:22 +0200)]
lxc-ubuntu: Allow /dev/fuse to be used in a container

As people seem to want it, i.e.
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/800886

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agolxc-ubuntu: don't put devpts in $confdir/container/fstab
Serge Hallyn [Sun, 24 Jul 2011 22:22:50 +0000 (00:22 +0200)]
lxc-ubuntu: don't put devpts in $confdir/container/fstab

src/lxc/conf.c will explicitly mount it anyway.  Furthermore, the fstab
entry, which is getting processed first, did not specify -o newinstance.
This can cause the host's devpts entry mount options to change, as in
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/607636.

Note - I messed up.  This was applied upstream, but I dropped it in
subsequent conversion to lxc-ubuntu template.  It therefore needs to
be reapplied.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agoAdd arm as a supported srcarch
Serge Hallyn [Sun, 24 Jul 2011 22:22:50 +0000 (00:22 +0200)]
Add arm as a supported srcarch

Otherwise building on armel fails with

checking for linux SRCARCH... configure: error: architecture arm-unknown-linux-gnueabi not supported

See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/745884 for details.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agofix lxc-ps to work with systemd
Joerg Gollnick [Sun, 24 Jul 2011 22:22:50 +0000 (00:22 +0200)]
fix lxc-ps to work with systemd

Dear all,
while working with systemd I found that lxc-ps -efa does not recognize the
container name.
Best regards Joerg

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
12 years agocgroups: support cgroups mounted in multiple places (v3)
Serge E. Hallyn [Sun, 3 Jul 2011 22:42:06 +0000 (00:42 +0200)]
cgroups: support cgroups mounted in multiple places (v3)

(sorry for the extra traffic.)

With this patch, lxc works for me both with all cgroups mounted with
ns cgroup on /cgroup, and with libcgroup mounting all cgroups
separately.

To do this, instead of looking for one cgroup called 'lxc' or
otherwise taking the first cgroup we find, we actually create a
container in every mounted cgroup fs.  Right now it's done under the
root of each fs.  We may want to put that under lxc, or, better yet,
make that configurable.

Changelog:
  Michael H. Warfield: Handle the case where subsystem doesn't have '.'.
  Daniel Lezcano: clean up incorrect reentrant use of mntent helpers
  v3: use the rest of Daniel's cleanups

TODO: add a configurable directory name, 'lxc' by default, under which
      all lxc cgroups are created (i.e. /sys/fs/cgroup/lxc)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Tested-by: Michael H. Warfield <mhw@WittsEnd.com>
12 years agotemplates: add openSUSE template.
Frederic Crozat [Sun, 3 Jul 2011 22:35:52 +0000 (00:35 +0200)]
templates: add openSUSE template.

The good news is, starting with next openSUSE release (and next SLES 11
Service Pack), patching /etc/init.d/boot won't be needed anymore for
LXC, we integrated detection of LXC (through container variable set to
lxc) in /etc/init.d/boot and /dev is no longer mounted automatically by
initscript.

Signed-off-by: Frederic Crozat <fcrozat@suse.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoprint netdev name, not link, after moving dev into netns
Serge Hallyn [Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)]
print netdev name, not link, after moving dev into netns

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoClarify the template-specific options a bit in lxc-create's help
Serge Hallyn [Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)]
Clarify the template-specific options a bit in lxc-create's help

This does not supplant the need for a manpage, but it's a start.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-ubuntu: Default to current ubuntu release.
Serge Hallyn [Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)]
lxc-ubuntu: Default to current ubuntu release.

If can't match any valid release, use lucid.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-ubuntu: Base arch detection code on debootstrap's with some additions when we...
Serge Hallyn [Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)]
lxc-ubuntu: Base arch detection code on debootstrap's with some additions when we don't have dpkg or udpkg

Changelog: [seh] Don't take arch from environment

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoconsolidate ubuntu templates
Serge Hallyn [Sat, 25 Jun 2011 13:17:47 +0000 (15:17 +0200)]
consolidate ubuntu templates

Consolidate lucid, maverick, natty, and oneiric templates into one 'ubuntu'
template.

Add support for specifying architecture.

Add support for '--trim|-x' option, which removes services like the lucid
template used to.  This creates smaller, faster-booting containers, but they
will not be safe with certain upgrades, like mountall or udev.  When -x is
not specified for lucid or maverick container, then install lxcguest from
the ubuntu-virt ppa, since it does not exist in the official archives, and
the container is not safe to boot without lxcguest.

Add support for '--bindhome <user>' option, which will cause /home/<user>
to be bind-mounted into the container, and create the user with his
original password, shell, and group memberships in the container.

changelog:
  june 23:
    lxc-ubuntu template: set lxc.arch in config
    install lxcguest when NOT trimming the container
    lxc-ubuntu: always install lxcguest in postprocess

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-create: pass remaining args to templates
Serge E. Hallyn [Thu, 23 Jun 2011 22:42:24 +0000 (00:42 +0200)]
lxc-create: pass remaining args to templates

This way I can do

lxc-create -t ubuntu -f /etc/lxc.conf -n u1 -- -x

and have -x passed to the template

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoAdd lxc-clone script
Serge E. Hallyn [Thu, 23 Jun 2011 22:42:24 +0000 (00:42 +0200)]
Add lxc-clone script

Create an lxc-clone script to clone containers.  It should probably
be factored into helpers and then enhanced, in particular to convert
between LVM and non-LVM containers, create non-snapshot LVM clones,
support loopback devices, and, when stable enough, to use
overlayfs, btrfs, etc.

But this is a start.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-destroy: delete a rootfs if it is an lvm volume
Serge E. Hallyn [Thu, 23 Jun 2011 22:42:24 +0000 (00:42 +0200)]
lxc-destroy: delete a rootfs if it is an lvm volume

If this is acceptable as is, then I'll try to get a simple lxc-clone
out tomorrow (taking into account your comments from last time).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoset close-on-exec flag on command socket
Daniel Lezcano [Thu, 2 Jun 2011 07:50:38 +0000 (09:50 +0200)]
set close-on-exec flag on command socket

When we accept a connection, we have to set the close-on-exec flag,
otherwise that won't be possible to reboot a container through a
lxc-console command.

Reported-by: Katoh Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoAdd initial oneiric template
Stéphane Graber [Tue, 24 May 2011 18:19:09 +0000 (14:19 -0400)]
Add initial oneiric template

13 years agoConvert all Debian (and derivative) templates from using 'arch' to using 'dpkg -...
Stéphane Graber [Tue, 24 May 2011 18:19:08 +0000 (14:19 -0400)]
Convert all Debian (and derivative) templates from using 'arch' to using 'dpkg --print-architecture' as debootstrap does

13 years agoCheck for existing ptmx symlink
Sven Wegener [Mon, 23 May 2011 21:12:24 +0000 (23:12 +0200)]
Check for existing ptmx symlink

It's OK, if /dev/ptmx points to /dev/pts/ptmx via a symlink.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoAdd relatime and strictatime mount options
Sven Wegener [Mon, 23 May 2011 21:12:24 +0000 (23:12 +0200)]
Add relatime and strictatime mount options

Also add #ifndef for compability with glibc before 2.12.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: don't install setns.h
Cedric Le Goater [Fri, 20 May 2011 09:37:16 +0000 (11:37 +0200)]
lxc: don't install setns.h

'setns.h' is not an lxc interface.

Also, a side effect of this declaration of 'setns.h' in the lxc header
files is to be distributed in the lxc tarball. This breaks the
lxc-attach command because the file is not automatically generated at
compile time.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoignore non-lxc configuration line
Daniel Lezcano [Fri, 13 May 2011 20:29:34 +0000 (22:29 +0200)]
ignore non-lxc configuration line

We ignore the line of in the configuration file not beginning by "lxc."
So we can mix the configuration file with another information used for
another component through the lxc library.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agotemplates: don't put devpts in $confdir/container/fstab
Daniel Lezcano [Fri, 6 May 2011 23:33:33 +0000 (01:33 +0200)]
templates: don't put devpts in $confdir/container/fstab

src/lxc/conf.c will explicitly mount it anyway.  Furthermore, the fstab
entry, which is getting processed first, did not specify -o newinstance.
This can cause the host's devpts entry mount options to change, as in
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/607636.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agotemplates: don't put devpts in $confdir/container/fstab
Serge E. Hallyn [Fri, 6 May 2011 23:33:33 +0000 (01:33 +0200)]
templates: don't put devpts in $confdir/container/fstab

src/lxc/conf.c will explicitly mount it anyway.  Furthermore, the fstab
entry, which is getting processed first, did not specify -o newinstance.
This can cause the host's devpts entry mount options to change, as in
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/607636.

I believe the lenny, fedora, and debian templates also will need an
update.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-execute: document the '--' option
Cedric Le Goater [Thu, 5 May 2011 10:07:51 +0000 (12:07 +0200)]
lxc-execute: document the '--' option

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: fix bogus header file
Cedric Le Goater [Thu, 5 May 2011 10:07:51 +0000 (12:07 +0200)]
lxc: fix bogus header file

The lxc/ prefix is missing in <start.h>. This breaks the inclusion
of the header file <lxc/conf.h> in external source code.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: default log appender on stderr
Greg Kurz [Wed, 6 Apr 2011 11:41:44 +0000 (13:41 +0200)]
lxc: default log appender on stderr

The default appender for logs is currently the file one: this
make macros from log.h unusable as long as lxc_log_init() hasn't
been called. This prevents errors from even being printed on
stderr in lxc_caps_init() for example.

Let's make stderr the default appender.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-attach: fix access permissions of /proc/$pid/ns
Cedric Le Goater [Mon, 4 Apr 2011 15:05:47 +0000 (17:05 +0200)]
lxc-attach: fix access permissions of /proc/$pid/ns

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-* tools are vulnerable for arguments with spaces
Michel Normand [Tue, 15 Mar 2011 19:19:07 +0000 (20:19 +0100)]
lxc-* tools are vulnerable for arguments with spaces

this is related to the bug
http://sourceforge.net/tracker/?func=detail&aid=3113612&group_id=163076&atid=826303
that suggested to modify bash lxc script to properly use "$@" in place of "$*"

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc_cgroup_path_get, cache the right value
François-Xavier Bourlet [Tue, 22 Mar 2011 14:10:37 +0000 (15:10 +0100)]
lxc_cgroup_path_get, cache the right value

lxc_cgroup_path_get currently cache the cgroup mount point plus the
container name at the same time, making every call of the function
returning the same value.
It mean that actually every call to lxc_cgroup_get with a different
container name will in fact use the same container name as used for
the primary call.

I join a patch to fix that, still doing some caching, but only caching
the cgroup moint point this time. This patch actually work for me, as
I am using the liblxc for retrieving statistics about all running
containers, using lxc_cgroup_get to retrieve every interesting values.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoconfile: check allocation succeeds
Michael Santos [Sat, 19 Mar 2011 15:11:31 +0000 (11:11 -0400)]
confile: check allocation succeeds

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoconf: increase buffer size to include spaces
Michael Santos [Sat, 19 Mar 2011 15:11:03 +0000 (11:11 -0400)]
conf: increase buffer size to include spaces

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoarguments: check allocation succeeds
Michael Santos [Sat, 19 Mar 2011 15:10:34 +0000 (11:10 -0400)]
arguments: check allocation succeeds

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agonetwork: ensure interface name is NULL terminated
Michael Santos [Sat, 19 Mar 2011 15:10:12 +0000 (11:10 -0400)]
network: ensure interface name is NULL terminated

IFNAMSIZ includes the trailing NULL.

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc_unshare: edit help output
Michael Santos [Sat, 19 Mar 2011 15:09:44 +0000 (11:09 -0400)]
lxc_unshare: edit help output

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoEnsure monitored container name is null terminated
Michael Santos [Wed, 16 Mar 2011 14:05:05 +0000 (10:05 -0400)]
Ensure monitored container name is null terminated

regexec() expects a null terminated name.

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoExit if allocation fails
Michael Santos [Wed, 16 Mar 2011 14:04:13 +0000 (10:04 -0400)]
Exit if allocation fails

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix mount path
Daniel Lezcano [Mon, 14 Mar 2011 20:47:15 +0000 (21:47 +0100)]
fix mount path

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agorename physical device to the original name
Daniel Lezcano [Mon, 7 Mar 2011 01:08:47 +0000 (02:08 +0100)]
rename physical device to the original name

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofactor out networking configuration code
Daniel Lezcano [Mon, 7 Mar 2011 01:08:47 +0000 (02:08 +0100)]
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>
13 years agolxc-0.7.4
Daniel Lezcano [Sat, 26 Feb 2011 09:18:19 +0000 (10:18 +0100)]
lxc-0.7.4

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoUpdate file capa detection for kernels >=2.6.37
Jan Niehusmann [Sat, 26 Feb 2011 09:18:19 +0000 (10:18 +0100)]
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>
13 years agoFixed a small typo in lxc-debian template
Amit Uttamchandani [Sat, 19 Feb 2011 08:45:32 +0000 (09:45 +0100)]
Fixed a small typo in lxc-debian template

"udpate" should be "update" in configure_debian().

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix lxc-checkpoint and lxc-restart sgml labels
Rob Landley [Thu, 17 Feb 2011 09:07:44 +0000 (10:07 +0100)]
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>
13 years agoSimplify broadcast computation
Daniel Lezcano [Mon, 14 Feb 2011 08:22:08 +0000 (09:22 +0100)]
Simplify broadcast computation

David Ward reported this computation could be written in a simpler
way.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoupdate configuration wrt to the broadcast address
Daniel Lezcano [Sun, 6 Feb 2011 20:30:18 +0000 (21:30 +0100)]
update configuration wrt to the broadcast address

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix broadcast compution
Daniel Lezcano [Sun, 6 Feb 2011 20:29:13 +0000 (21:29 +0100)]
fix broadcast compution

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix empty network configuration
Daniel Lezcano [Wed, 2 Feb 2011 20:55:49 +0000 (21:55 +0100)]
fix empty network configuration

The return statement is at the wrong place.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-start can output the console to a file
Daniel Lezcano [Tue, 1 Feb 2011 13:49:40 +0000 (14:49 +0100)]
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>
13 years agolxc-0.7.4-rc1
Daniel Lezcano [Tue, 1 Feb 2011 11:55:39 +0000 (12:55 +0100)]
lxc-0.7.4-rc1

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agotake into account new configure option --with-linuxdir
Cedric Le Goater [Fri, 21 Jan 2011 10:01:43 +0000 (11:01 +0100)]
take into account new configure option --with-linuxdir

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
13 years agogenerate setns syscall number
Clement Calmels [Thu, 20 Jan 2011 09:59:33 +0000 (10:59 +0100)]
generate setns syscall number

Signed-off-by: Clement Calmels <clement.calmels@fr.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
13 years agolxc-attach gives a better error message
Daniel Lezcano [Tue, 1 Feb 2011 10:42:29 +0000 (11:42 +0100)]
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>
13 years agoFix paths in the lxc-busybox template
Daniel Lezcano [Thu, 27 Jan 2011 23:24:54 +0000 (00:24 +0100)]
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>
13 years agoexport env variable in lxc_start
Daniel Lezcano [Thu, 27 Jan 2011 23:14:51 +0000 (00:14 +0100)]
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>
13 years agosuppress udev log output
Daniel Lezcano [Sun, 23 Jan 2011 20:47:12 +0000 (21:47 +0100)]
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>
13 years agoUpdate ubuntu templates
Serge Hallyn [Sat, 22 Jan 2011 20:59:40 +0000 (21:59 +0100)]
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>
13 years agoAdds correct file capa detection for >2.6.32 The kernel compile parameter was removed...
Reto Gantenbein [Mon, 17 Jan 2011 23:45:17 +0000 (00:45 +0100)]
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>
13 years agoOnly bring up network interface if IFF_UP is set
David Ward [Mon, 17 Jan 2011 09:18:50 +0000 (10:18 +0100)]
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>
13 years agoset veth host's side always up
Daniel Lezcano [Mon, 17 Jan 2011 09:18:50 +0000 (10:18 +0100)]
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>
13 years agoFix mntflags initialization
Joerg Gollnick [Sun, 16 Jan 2011 18:40:46 +0000 (19:40 +0100)]
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>
13 years agoadd lxc-lenny template
Daniel Lezcano [Fri, 14 Jan 2011 08:51:13 +0000 (09:51 +0100)]
add lxc-lenny template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix clone_children path
Daniel Lezcano [Thu, 13 Jan 2011 22:45:22 +0000 (23:45 +0100)]
fix clone_children path

This line is at the wrong place ...

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoadd missing template in Makefile
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)]
add missing template in Makefile

Missed to add lxc-lenny to the template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix busybox inittab template
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)]
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>
13 years agosubstitute the absolute rootfs mount path
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)]
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>
13 years agoencapsulate mount point code
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)]
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>
13 years agomindless changes to conform indentation
Daniel Lezcano [Thu, 13 Jan 2011 15:15:15 +0000 (16:15 +0100)]
mindless changes to conform indentation

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoset function static
Daniel Lezcano [Thu, 13 Jan 2011 15:15:15 +0000 (16:15 +0100)]
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>
13 years agofix cgroup directory removal
Daniel Lezcano [Mon, 10 Jan 2011 16:58:32 +0000 (17:58 +0100)]
fix cgroup directory removal

Fix the name of the directory to remove.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix the ns_cgroup vs clone_children
Daniel Lezcano [Sun, 9 Jan 2011 22:53:19 +0000 (23:53 +0100)]
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>
13 years agoCorrecting charset argument when calling locale-gen.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Correcting charset argument when calling locale-gen.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoCorrecting include argument when calling debootstrap.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Correcting include argument when calling debootstrap.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoDisabling unneeded checkroot.sh initscript in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Disabling unneeded checkroot.sh initscript in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoCreating missing tty device nodes for squeeze in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Creating missing tty device nodes for squeeze in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoSetting default mirror to cdn.debian.net in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Setting default mirror to cdn.debian.net in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoSetting default suite to squeeze in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)]
Setting default suite to squeeze in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>