]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
13 years agoremove redundent LXC_TTY_HANDLER
Jian Xiao [Thu, 23 Feb 2012 08:57:13 +0000 (09:57 +0100)] 
remove redundent LXC_TTY_HANDLER

All the signals (except fatal ones) are redirected to signalfd at lxc_init,
so the LXC_TTY_HANDLERs are redundant. This patch removes them.

Signed-off-by: Jian Xiao <jian@linux.vnet.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolimit rm to rootfs, avoiding nuking of any bind mounts from
andrea rota [Wed, 21 Dec 2011 12:10:47 +0000 (12:10 +0000)] 
limit rm to rootfs, avoiding nuking of any bind mounts from

the host

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: add Bugs section to lxc-monitor(1)
Greg Kurz [Thu, 5 Jan 2012 22:34:46 +0000 (23:34 +0100)] 
lxc: add Bugs section to lxc-monitor(1)

This lxc-monitor limitation deserves some lines in the manpage, until
something is done to allow several monitors to run concurrently.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: line buffered output for lxc-monitor
Greg Kurz [Thu, 5 Jan 2012 22:34:46 +0000 (23:34 +0100)] 
lxc: line buffered output for lxc-monitor

A typical usage is to start lxc-monitor in popen() and parse the ouput.
Unfortunately, glibc defaults to block buffering for pipes and you may
have to wait several lines before anything is written to stdout... this
prevent the use of lxc-monitor to implement automatons. Let's go line
buffered !

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoubuntu template: use -updates and -security (v3)
Serge Hallyn [Thu, 5 Jan 2012 22:34:46 +0000 (23:34 +0100)] 
ubuntu template: use -updates and -security (v3)

Particularly for LTS releases, which many people will want to use in
their containers, it is not wise to not use release-security and
release-updates.  Furthermore the fix allowing ssh to allow the container
to shut down is in lucid-updates only.

With this patch, after debootstrapping a container, we add -updates and
-security to sources.list and do an upgrade under chroot.  Unfortunately
we need to do this because debootstrap doesn't know how to.

Changelog:
Nov 14: as Stéphane Graber suggested, make sure no daemons start on
the host while doing dist-upgrade from chroot.
Nov 15: use security.ubuntu.com, not mirror. (stgraber)

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoFix ia64 clone
Daniel Lezcano [Thu, 5 Jan 2012 21:45:32 +0000 (22:45 +0100)] 
Fix ia64 clone

Fix the stack address for ia64.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoFix network cleanup on error
Daniel Lezcano [Thu, 5 Jan 2012 21:45:32 +0000 (22:45 +0100)] 
Fix network cleanup on error

Network cleanup does not cleanup correctly the virtual interfaces
in case of an error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agogive explicit error when the cgroup are not found
Daniel Lezcano [Thu, 5 Jan 2012 21:45:31 +0000 (22:45 +0100)] 
give explicit error when the cgroup are not found

When the cgroup is not mounted, we silently exit without giving
some clues to the user with what is happening.

Give some info and an explicit error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix indentation of the previous patch
Daniel Lezcano [Thu, 5 Jan 2012 21:45:31 +0000 (22:45 +0100)] 
fix indentation of the previous patch

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoSet high byte of mac addresses for host veth devices to 0xfe
Christian Seiler [Tue, 15 Nov 2011 17:53:53 +0000 (18:53 +0100)] 
Set high byte of mac addresses for host veth devices to 0xfe

When used in conjunction with a bridge, veth devices with random addresses
may change the mac address of the bridge itself if the mac address of the
interface newly added is numerically lower than the previous mac address
of the bridge. This is documented kernel behavior. To avoid changing the
host's mac address back and forth when starting and/or stopping containers,
this patch ensures that the high byte of the mac address of the veth
interface visible from the host side is set to 0xfe.

A similar logic is also implemented in libvirt.

Fixes SF bug #3411497
See also: <http://thread.gmane.org/gmane.linux.kernel.containers.lxc.general/2709>

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
13 years agoRevert "lxc: use -iquote instead of -I"
Daniel Lezcano [Fri, 18 Nov 2011 15:09:47 +0000 (16:09 +0100)] 
Revert "lxc: use -iquote instead of -I"

This reverts commit a2dea4ea209a8fcf6837668bbe59f350931d1c07.

13 years agoUbuntu template: some tweaks
Stéphane Graber [Thu, 10 Nov 2011 08:45:52 +0000 (09:45 +0100)] 
Ubuntu template: some tweaks

Allow mknod (fixing udev upgrades) and drop mac_override and mac_admin
from lxc.cap.drop as apparmor has/will have support for namespaces

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: use -iquote instead of -I
Greg Kurz [Thu, 10 Nov 2011 08:41:46 +0000 (09:41 +0100)] 
lxc: use -iquote instead of -I

To avoid name collisions between local and system header
files. For example, if you try to include the <pty.h>
system file, you end up including the one from lxc...

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: fix erroneous includes
Greg Kurz [Thu, 10 Nov 2011 08:41:46 +0000 (09:41 +0100)] 
lxc: fix erroneous includes

The "" notation is preferrable if the header file is local.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoadd lxc-archlinux template
Alexander Vladimirov [Thu, 10 Nov 2011 08:41:46 +0000 (09:41 +0100)] 
add lxc-archlinux template

Hi, here's the patch which adds Arch linux container template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix lxc-destroy
Daniel Lezcano [Thu, 10 Nov 2011 08:41:46 +0000 (09:41 +0100)] 
fix lxc-destroy

Add missing 'localstatedir' directory definition.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-fedora.in: Fix fetching of the fedora-release rpm
Tuomas Suutari [Fri, 28 Oct 2011 21:55:38 +0000 (23:55 +0200)] 
lxc-fedora.in: Fix fetching of the fedora-release rpm

The hardcoded URL seems to be broken and 404 error was not
checked. Now the mirror is selected from mirrorlist (instead of
hardcoding to funet.fi) and fetch errors are checked.

Also added a retry loop (with 3 tries) to find a working mirror, since
some of the mirrors are not OK.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-fedora.in: Use i386 instead of i686
Tuomas Suutari [Fri, 28 Oct 2011 21:55:38 +0000 (23:55 +0200)] 
lxc-fedora.in: Use i386 instead of i686

There is no i686 variant of Fedora, but Ubuntu seems to return i686
from the arch command.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-fedora.in: Add missing default release variable
Tuomas Suutari [Fri, 28 Oct 2011 21:55:38 +0000 (23:55 +0200)] 
lxc-fedora.in: Add missing default release variable

The text says that 14 is default, but release=14 was not set anywhere
in the script.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agotemplates: update openSUSE template for openSUSE 12.1
Frederic Crozat [Tue, 25 Oct 2011 09:25:18 +0000 (11:25 +0200)] 
templates: update openSUSE template for openSUSE 12.1

rely on "build" package, to ensure chroot can be created with
distribution older than 12.1

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoDrop resolvconf from oneiric container package list
Serge E. Hallyn [Mon, 24 Oct 2011 22:02:33 +0000 (00:02 +0200)] 
Drop resolvconf from oneiric container package list

It prevents containers from getting a good resolv.conf without doing
ifdown eth0; ifup eth0.

(see pad.lv/880020)

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoextend the struct lxc_arguments
Cedric Le Goater [Mon, 24 Oct 2011 12:56:30 +0000 (14:56 +0200)] 
extend the struct lxc_arguments

This patch adds a private argument to extend the struct
lxc_arguments. This is useful to develop custom lxc commands
outside mainline lxc.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc: introduce lxc_execute()
Greg Kurz [Mon, 24 Oct 2011 12:56:30 +0000 (14:56 +0200)] 
lxc: introduce lxc_execute()

This patch allows to create application containers with liblxc.so directly.

Some code cleanups on the way:
- separate ops for lxc_execute() and lxc_start(): the factorisation is wrong
  here as we may have specific things to do if we're running an application
  container. It deserves separate ops.
- lxc_arguments_dup() is merged in the pre-exec operation: this is a first
  use for the execute op introduced just above. It's better to build the
  arguments to execvp() where they're really used.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
13 years agohandle kernel 3.x in lxc-checkconfig
Frederic Crozat [Thu, 13 Oct 2011 09:26:56 +0000 (11:26 +0200)] 
handle kernel 3.x in lxc-checkconfig

Make sure to correctly detect kernel 3.x for file capabilities.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoalt linux template
Alexey Shabalin [Mon, 24 Oct 2011 12:55:13 +0000 (14:55 +0200)] 
alt linux template

Updates.

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

13 years agolxc-ubuntu: stop early if a bad user is specified in -b option
Serge E. Hallyn [Mon, 24 Oct 2011 12:47:58 +0000 (14:47 +0200)] 
lxc-ubuntu: stop early if a bad user is specified in -b option

Otherwise we end up with a bad container fstab and a container
that won't boot.  See
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/879052

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoDon't list containers w/ active console sessions multiple times
Rainer Weikusat [Mon, 24 Oct 2011 12:47:58 +0000 (14:47 +0200)] 
Don't list containers w/ active console sessions multiple times

The lxc-ls shell script uses netstat -xa to get a listing of AF_UNIX
sockets it then parses in order to determine the names of presently
running containers. This is wrong because it will list the
listening socket and all sockets created by accepting connections on
that. This causes the script to display the names of containers with
active lxc-console sessions 1 + n times, n being the number of active
console sessions. The patch below fixes this by using netstat -xl
instead which only displays the listening sockets.

Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoubuntu template: allow containers to create tap devices
Serge E. Hallyn [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
ubuntu template: allow containers to create tap devices

Thought I had sent this before, but I don't find it anywhere.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoAccurately detect whether a system supports clone_children
Serge E. Hallyn [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
Accurately detect whether a system supports clone_children

If multiple cgroups are mounted under /sys/fs/cgroup, then the
original check ends up looking for /sys/fs/cgroup/cgroup.clone_children,
which does not exist because that is just a tmpfs.

So make sure to check an actual cgroupfs.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoLet sshd template work on ubuntu systems.
Serge E. Hallyn [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
Let sshd template work on ubuntu systems.

/dev/shm is a symlink to /run/shm, so we need /run/shm
to exist in the container rootfs.  Also, /dev/mqueue does
not exist on the host, and can't be created by the container.
But we don't really need it so ignore that.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoubuntu template: disallow cap_sys_module (by popular demand)
Serge E. Hallyn [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
ubuntu template: disallow cap_sys_module (by popular demand)

This isn't particularly reassuring, and will be moot with user
namespaces, but as people are asking for it, turn off sys_module.
While we're at it, turn off mac_admin and mac_override.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agolxc-clone: fix dhclient.conf send hostname command
Serge E. Hallyn [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
lxc-clone: fix dhclient.conf send hostname command

End the command with ';', which is needed, and put the hostname in
quotes (which doesn't really seem needed, but shown in man page).

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix more broken paths in lxc-*.in scripts
Greg Kurz [Mon, 24 Oct 2011 12:38:30 +0000 (14:38 +0200)] 
fix more broken paths in lxc-*.in scripts

There are still some sequels from commit:

1c41ddcb4af633ac906f1d7c9ef1dc7d121d7850

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix broken lxc-*.in scripts
Greg Kurz [Tue, 20 Sep 2011 09:18:39 +0000 (11:18 +0200)] 
fix broken lxc-*.in scripts

Commit 92c7f6295518decd3989b2790d758888551e7d9a broke the following scipts:
- lxc-setcap
- lxc-setuid
- lxc-create

This patch adds the missing variables to be substitued by the configure
script.

Cheers.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoSet the utsname on the debian template
Tzafrir Cohen [Tue, 13 Sep 2011 13:08:04 +0000 (15:08 +0200)] 
Set the utsname on the debian template

Signed-off-by: Tzafrir Cohen <tzafrir@cohens.org.il>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoonly warn for inherited file descriptors
Greg Kurz [Tue, 13 Sep 2011 13:08:04 +0000 (15:08 +0200)] 
only warn for inherited file descriptors

As discussed in thread:

http://sourceforge.net/mailarchive/forum.php?thread_name=4E5618C3.5060507%40free.fr&forum_name=lxc-devel

We think it's better for now to only warn the user about a fd leaking into
the container. Also remove the call to readlink() as it isn't really useful
now: since the container will start anyway, the user can look into /proc/../fd
or use lsof or whatever.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofixes for rpmbuild
Greg Kurz [Tue, 13 Sep 2011 13:08:04 +0000 (15:08 +0200)] 
fixes for rpmbuild

This patch fixes some makefile/specfile issues when running
rpmbuild with the distributed lxc specfile:

- fixes usage of installation directories for config files,
  rootfs, templates and lxc-init so that they're calculated
  at make time instead of configure time. Thanks to this,
  all installed items go under $RPM_BUILD_ROOT when running
  rpmbuild
- introduce --disable-rpath option to configure to avoid
  check-rpaths errors when building non-root.
- introduce a lxc-libs package in the default spec file
  to allow concurrent installation of 32 bit and 64 bit
  libraries.

v2: - fix circular reference in lxc.pc
    - ship lxc.pc with lxc-devel

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoremove the check for container path as it's done in lxc-create
InformatiQ [Thu, 1 Sep 2011 20:24:30 +0000 (22:24 +0200)] 
remove the check for container path as it's done in lxc-create

Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agoif after freezing the container the snapshot/rsync fails, unfreeze before exiting
InformatiQ [Tue, 30 Aug 2011 22:20:09 +0000 (00:20 +0200)] 
if after freezing the container the snapshot/rsync fails, unfreeze before exiting

Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
13 years ago*add the new opts to help() *set container_running=false
InformatiQ [Tue, 30 Aug 2011 22:20:09 +0000 (00:20 +0200)] 
*add the new opts to help() *set container_running=false

Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
13 years ago* allow cloning of non-snapshot lvm devices
InformatiQ [Tue, 30 Aug 2011 22:20:09 +0000 (00:20 +0200)] 
* allow cloning of non-snapshot lvm devices

Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
13 years agolxc-fedora.in
Ramez Hanna [Tue, 30 Aug 2011 22:20:09 +0000 (00:20 +0200)] 
lxc-fedora.in

* if not running on fedora host amd -R is not set, use fedora 14 as default
* trap SIGHUP SIGINT SIGTERM, and cleanup before exiting

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 years agofix for missing EOF and fstab contents
Ramez Hanna [Tue, 30 Aug 2011 22:20:09 +0000 (00:20 +0200)] 
fix for missing EOF and fstab contents

 templates/lxc-fedora.in |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 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>
13 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>
13 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>
13 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>
13 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>
14 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>
14 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>
14 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>
14 years agoVersion 0.7.5 lxc-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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 years agoAdd initial oneiric template
Stéphane Graber [Tue, 24 May 2011 18:19:09 +0000 (14:19 -0400)] 
Add initial oneiric template

14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>