]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
14 years agoREADME should not be a copy of lxc man page
Michel Normand [Wed, 2 Jun 2010 13:03:34 +0000 (15:03 +0200)]
README should not be a copy of lxc man page

so rewrite it to its minimum

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix busybox template
Daniel Lezcano [Tue, 1 Jun 2010 16:56:54 +0000 (18:56 +0200)]
fix busybox template

Fix various bug with the busybox template:
 * add a warning when busybox is not statically linked
 * delete the password for root (chpasswd is not available for all busybox)
 * add the new pts option

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange root passwd for debian template
Daniel Lezcano [Tue, 1 Jun 2010 16:56:54 +0000 (18:56 +0200)]
change root passwd for debian template

Change default root password to 'root' and generate locales
automatically

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix ubuntu template
Daniel Lezcano [Tue, 1 Jun 2010 16:56:54 +0000 (18:56 +0200)]
Fix ubuntu template

 - Fixed rootfs path.
 - Removed network section, it should to be passed to the lxc-create
configuration option in order to concatenate the configuration files
 - Generate en_US local instead of de_DE

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoubunutu template
Willem Meier [Tue, 1 Jun 2010 16:56:54 +0000 (18:56 +0200)]
ubunutu template

Ubuntu [lucid] template script.
Allows to create an ubuntu container with the template options.

Signed-off-by: Willem Meier <wilhelm.meier@fh-kl.de>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation warning
Daniel Lezcano [Tue, 1 Jun 2010 10:24:17 +0000 (12:24 +0200)]
fix compilation warning

Fix compilation warning:

lxc_console.c: In function ‘master_handler’:
lxc_console.c:175: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix compilation warnings
Daniel Lezcano [Tue, 1 Jun 2010 10:13:32 +0000 (12:13 +0200)]
fix compilation warnings

Fix the following warnings:

console.c: In function ‘console_handler’:
console.c:252: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
console.c:254: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
conf.c: In function ‘instanciate_veth’:
conf.c:1130: warning: ignoring return value of ‘mktemp’, declared with attribute warn_unused_result
conf.c:1135: warning: ignoring return value of ‘mktemp’, declared with attribute warn_unused_result
conf.c: In function ‘instanciate_macvlan’:
conf.c:1206: warning: ignoring return value of ‘mktemp’, declared with attribute warn_unused_result
af_unix.c: In function ‘lxc_af_unix_send_fd’:
af_unix.c:124: warning: dereferencing type-punned pointer will break strict-aliasing rules
af_unix.c: In function ‘lxc_af_unix_recv_fd’:
af_unix.c:169: warning: dereferencing type-punned pointer will break strict-aliasing rules
af_unix.c: In function ‘lxc_af_unix_send_credential’:
af_unix.c:195: warning: dereferencing type-punned pointer will break strict-aliasing rules
af_unix.c: In function ‘lxc_af_unix_rcv_credential’:
af_unix.c:237: warning: dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd restart framework
Cedric Le Goater [Tue, 1 Jun 2010 09:44:44 +0000 (11:44 +0200)]
add restart framework

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-unshare asprintf error checking
Michel Normand [Mon, 31 May 2010 09:56:47 +0000 (11:56 +0200)]
lxc-unshare asprintf error checking

same correction in lxc_unshare.c as already done
in lxc_start.c and lxc_restart.c by Nathan in
commit fa9ab20562649707d44bfff90df44b7bc1a9f8b3

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate man pages about logpriority
Michel Normand [Mon, 31 May 2010 09:56:47 +0000 (11:56 +0200)]
update man pages about logpriority

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate .gitignore w/ autogen.sh created files
Michel Normand [Mon, 31 May 2010 09:56:47 +0000 (11:56 +0200)]
update .gitignore w/ autogen.sh created files

remove trailing / for .pc and patches
that may be symbolic links.

and remove all test/* files that do not exist anymore since
commit 92d385229be040cf034ac6efd9405b7bdfe06a3e

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove remaining .cvsignore files
Michel Normand [Mon, 31 May 2010 09:56:47 +0000 (11:56 +0200)]
remove remaining .cvsignore files

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodisable rootfs automatic detection
Daniel Lezcano [Fri, 28 May 2010 15:39:11 +0000 (17:39 +0200)]
disable rootfs automatic detection

Avoid a warning at compile time by disabling temporary the code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix pivot umount algorithm
Daniel Lezcano [Fri, 28 May 2010 15:39:11 +0000 (17:39 +0200)]
fix pivot umount algorithm

Make a function and fix bad parameter to umount.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange repository url in MAINTAINERS
Daniel Lezcano [Fri, 28 May 2010 15:39:11 +0000 (17:39 +0200)]
change repository url in MAINTAINERS

Changed cvs to git url.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix lxc-execute man page
Daniel Lezcano [Fri, 28 May 2010 15:39:11 +0000 (17:39 +0200)]
fix lxc-execute man page

On buggy docbook-utils, old syntax leads to a bad formatting.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate checkpoint / restart man page
Daniel Lezcano [Fri, 28 May 2010 15:01:45 +0000 (17:01 +0200)]
update checkpoint / restart man page

Notify the checkpoint / restart commands do nothing for the moment.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate lxc-checkpoint / lxc-restart man
Daniel Lezcano [Fri, 28 May 2010 15:01:45 +0000 (17:01 +0200)]
update lxc-checkpoint / lxc-restart man

Add documentation for checkpoint / restart CLI.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoassertion on lxc_checkpoint() return value
Greg Kurz [Fri, 28 May 2010 12:29:05 +0000 (14:29 +0200)]
assertion on lxc_checkpoint() return value

Buggy behaviour always deserves an assertion.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix whitespace
Daniel Lezcano [Fri, 28 May 2010 09:49:25 +0000 (11:49 +0200)]
fix whitespace

Fix whitespace.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove unused field
Daniel Lezcano [Thu, 27 May 2010 14:27:15 +0000 (16:27 +0200)]
remove unused field

These fields were moved to another structure but not removed from
there.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse ptmxmode mount option
Cedric Le Goater [Thu, 27 May 2010 14:16:30 +0000 (16:16 +0200)]
use ptmxmode mount option

Save one call by using the ptmxmode mount option.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomove lxc-init to $libdir/lxc
Daniel Lezcano [Thu, 27 May 2010 12:27:13 +0000 (14:27 +0200)]
move lxc-init to $libdir/lxc

As specified by FHS:

   /usr/lib includes object files, libraries, and internal binaries that
   are not intended to be executed directly by users or shell scripts.

   Applications may use a single subdirectory under /usr/lib. If an
   application uses a subdirectory, all architecture-dependent data
   exclusively used by the application must be placed within that
   subdirectory.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange the rootfs mount location and add the README
Daniel Lezcano [Thu, 27 May 2010 12:27:13 +0000 (14:27 +0200)]
change the rootfs mount location and add the README

Previous path was $libdir/lxc, changed to $libdir/lxc/rootfs.
Added a README file to be placed in this directory, describing
the purpose of this empty directory. Having a file to be installed
in this directory makes the Makefile to automatically create the
directory at install time.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-kill man update about SIGSTOP and SIGKILL
Michel Normand [Thu, 27 May 2010 12:26:09 +0000 (14:26 +0200)]
lxc-kill man update about SIGSTOP and SIGKILL

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove obsolete lxc_utils.h
Michel Normand [Thu, 27 May 2010 10:17:40 +0000 (12:17 +0200)]
remove obsolete lxc_utils.h

This file is a duplicate of utils.h

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodrop capabilities in lxc-init (V2)
clg@linux.vnet.ibm.com [Thu, 27 May 2010 10:17:40 +0000 (12:17 +0200)]
drop capabilities in lxc-init (V2)

capabilities are reseted just after the filesystem is mounted.
lxc_setup_fs() is moved up, before the process is forked.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agointroduce a sync API
Cedric Le Goater [Wed, 26 May 2010 19:43:53 +0000 (21:43 +0200)]
introduce a sync API

The following patch wrap the calls on the synchronisation
socketpair in a lxc_sync_ API. It hopefully clarifies what
is done in the start sequence to the expense of more lines
of code ...

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomerge lxc_restart() and lxc_start()
Cedric Le Goater [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
merge lxc_restart() and lxc_start()

now that we have specific operations and specific arguments for each
sequence, lxc_restart() and lxc_start() can easily be merged under
a common subroutine.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreplace common start_arg by private start_arg
Cedric Le Goater [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
replace common start_arg by private start_arg

the following patch moves the start argument in private
structs which are opaque to lxc_spawn(). To achieve this goal,
we need to move the sv[2] socketpair and lxc_handler

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agostart sequence cleanups
Cedric Le Goater [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
start sequence cleanups

These are trivial changes:
start_arg->name is redundant with lxc_handler->name
sv[2] can be stored directly under start_arg

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agosimplify lxc_spawn() gotos
Cedric Le Goater [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
simplify lxc_spawn() gotos

label 'out_close' is used only once.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agointroduce struct lxc_operations
Cedric Le Goater [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
introduce struct lxc_operations

struct lxc_operations offers 2 operations : start and post_start
which are used by the lxc-start and lxc-restart sequences to
define specific actions.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
14 years agoAdd ops for start
Michel Normand [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
Add ops for start

In order to define a specific function for restart, let's create
an ops where we will be able to specify a function for restart too.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoprepare do_start for restart code
Michel Normand [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
prepare do_start for restart code

In order to be able to use a single 'start' function for start
and restart, let's prepare do_start to get an extra statefile parameter.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomove LXC_TTY_HANDLER_ADD/DEL out of init/fini in start.c
Michel Normand [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
move LXC_TTY_HANDLER_ADD/DEL out of init/fini in start.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agosigprocmask moved in fini of start.c
Michel Normand [Wed, 26 May 2010 14:54:48 +0000 (16:54 +0200)]
sigprocmask moved in fini of start.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix initial run level
Denis Rizaev [Mon, 24 May 2010 13:06:36 +0000 (15:06 +0200)]
fix initial run level

I did a little investigation about runlevels and i think we can assume
runlevels 2-5 as normal. So, we can check if system was in runlevel 2-5
and proc count is 1 and now we are in 0/6.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Denis Rizaev <Denis.Rizaev@trueoffice.ru>
14 years agocorrect asprintf error checking
Nathan Lynch [Wed, 19 May 2010 20:15:28 +0000 (22:15 +0200)]
correct asprintf error checking

asprintf(3) returns -1 (not 0) on error.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoDon't close fd 0, fd 1
Daniel Lezcano [Wed, 19 May 2010 20:15:28 +0000 (22:15 +0200)]
Don't close fd 0, fd 1

That breaks the reboot because when we reexec, fd 0 and fd 1 will be
closed and these one are created by lxc, not inherited.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoclose socket command
Daniel Lezcano [Wed, 19 May 2010 20:15:28 +0000 (22:15 +0200)]
close socket command

We don't close the command socket after the transaction, that leads
to a fd leak.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix indentation
Daniel Lezcano [Wed, 19 May 2010 20:15:28 +0000 (22:15 +0200)]
fix indentation

Indent the signalfd structure definition correctly.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadded locally modified files for broadcast support
Daniel Lezcano [Tue, 18 May 2010 17:13:26 +0000 (19:13 +0200)]
added locally modified files for broadcast support

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agosupport ipv4 broadcast specification
Daniel Lezcano [Tue, 18 May 2010 15:40:04 +0000 (17:40 +0200)]
support ipv4 broadcast specification

Add the broadcast specification, if none is specified, it is automatically
computed from the addr & mask.

syntax:
lxc.network.ipv4 = 172.20.0.2/24 172.20.255.255

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix typos in error messages
Ferenc Wagner [Wed, 12 May 2010 21:47:55 +0000 (23:47 +0200)]
fix typos in error messages

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove pivotdir only if it was created by us
Ferenc Wagner [Wed, 12 May 2010 21:47:55 +0000 (23:47 +0200)]
remove pivotdir only if it was created by us

The removal does not account for possible leading path components that
were also created during creation of pivotdir.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse defined rootfs mount point
Daniel Lezcano [Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)]
use defined rootfs mount point

As we defined a path where to mount the rootfs, we can use without
ambiguity because it is defined by default at compile time or by the
configuration.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd lxc.rootfs.mount config option
Daniel Lezcano [Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)]
add lxc.rootfs.mount config option

Define lxc.rootfs.mount option in order to override the default
mount point for rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoencapsulate rootfs data in a structure
Daniel Lezcano [Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)]
encapsulate rootfs data in a structure

We have pivot_dir and rootfs defined in lxc_conf structure.
Let's encapsulate them in a rootfs structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd a configure option to set a rootfs mount point
Daniel Lezcano [Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)]
add a configure option to set a rootfs mount point

Add a configure option to set a mount point path when using a rootfs,
that will replace the actual behavior which creates uneeded /tmp/lxc**
directories.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agowhitespace cleanup in configure.ac
Daniel Lezcano [Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)]
whitespace cleanup in configure.ac

Mindless changes by removing whitespace.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agono need to use a temporary directory for pivoting
Ferenc Wagner [Mon, 10 May 2010 09:50:10 +0000 (11:50 +0200)]
no need to use a temporary directory for pivoting

Ferenc Wagner <wferi@niif.hu> writes:

> Daniel Lezcano <dlezcano@fr.ibm.com> writes:
>
>> Ferenc Wagner wrote:
>>
>>> Daniel Lezcano <daniel.lezcano@free.fr> writes:
>>>
>>>> Ferenc Wagner wrote:
>>>>
>>>>> While playing with lxc-start, I noticed that /tmp is infested by
>>>>> empty lxc-r* directories: [...] Ok, this name comes from lxc-rootfs
>>>>> in conf.c:setup_rootfs.  After setup_rootfs_pivot_root returns, the
>>>>> original /tmp is not available anymore, so rmdir(tmpname) at the
>>>>> bottom of setup_rootfs can't achieve much.  Why is this temporary
>>>>> name needed anyway?  Is pivoting impossible without it?
>>>>
>>>> That was put in place with chroot, before pivot_root, so the distro's
>>>> scripts can remount their '/' without failing.
>>>>
>>>> Now we have pivot_root, I suppose we can change that to something cleaner...
>>>
>>> Like simply nuking it?  Shall I send a patch?
>>
>> Sure, if we can kill it, I will be glad to take your patch :)
>
> I can't see any reason why lxc-start couldn't do without that temporary
> recursive bind mount of the original root.  If neither do you, I'll
> patch it out and see if it still flies.

For my purposes the patch below works fine.  I only run applications,
though, not full systems, so wider testing is definitely needed.

Thanks,
Feri.

>From 98b24c13f809f18ab8969fb4d84defe6f812b25c Mon Sep 17 00:00:00 2001
Date: Thu, 6 May 2010 14:47:39 +0200

That was put in place before lxc-start started using pivot_root, so
the distro scripts can remount / without problems.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoMake dynamic busybox supported
Daniel Lezcano [Mon, 10 May 2010 09:50:10 +0000 (11:50 +0200)]
Make dynamic busybox supported

Bind mount host library path.
Weird but some distro provide busybox as a dynamically linked binary.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomake lxc-checkconfig more explicit
Guillaume Zitta [Mon, 10 May 2010 09:50:10 +0000 (11:50 +0200)]
make lxc-checkconfig more explicit

With a friend, we installed lxc on his server.
We spend 1 hour on the kernel config because we didn't knew :
- that lxc-checkconfig is a bash script and it can check a config before
running it
- which kernel config item whas not good
- that CONFIG_SECURITY_FILE_CAPABILITIES is obsolete since 2.6.33

So, here is a patch for lxc-checkconfig that could save time for lxc newbies

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Modified-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Guillaume Zitta <lxc@zitta.fr>
14 years agoadd missing /dev/pts directory
Daniel Lezcano [Mon, 10 May 2010 09:50:10 +0000 (11:50 +0200)]
add missing /dev/pts directory

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate INSTALL file
Daniel Lezcano [Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)]
update INSTALL file

"lxc configure does not exist. You need to run ./autogen.sh to create it.
I think it needs to either be documented in INSTALL or you provide ./configure"

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Jamal Hadi Salim <hadi@cyberus.ca>
14 years agofactor out pivot_root code
Daniel LEzcano [Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)]
factor out pivot_root code

Clean up and factor a bit the pivot_root code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix pivot_root temporary directory
Daniel Lezcano [Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)]
fix pivot_root temporary directory

First of all, when trying to start a container in a read-only root
lxc-start complains:
  lxc-start: Read-only file system - can't make temporary mountpoint

This is in conf.c:setup_rootfs_pivot_root() function.  That function
uses optional parameter "lxc.pivotdir", or creates (and later removes)
a temporary directory for pivot_root.  Obviously there's no way to
create a directory in a read-only filesystem.

But lxc.pivotdir does not work either. In the function mentioned above
it is used with leading dot (eg. if I specify "lxc.pivotdir=pivot" in
the config file the pivot_root() syscall will be made to ".pivot" with
leading dot, not to "pivot"), but later on it is used without that dot,
and fails:

  lxc-start: No such file or directory - failed to open /pivot/proc/mounts
  lxc-start: No such file or directory - failed to read or parse mount list '/pivot/proc/mounts'
  lxc-start: failed to pivot_root to '/stage/t'

(that's with "lxc.pivotdir = pivot" in the config file).  After symlinking
pivot to .pivot it still fails:

  lxc-start: Device or resource busy - could not unmount old rootfs
  lxc-start: failed to pivot_root to '/stage/t'

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
14 years agoFix console infinite loop
Daniel Lezcano [Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)]
Fix console infinite loop

When the client console exits, the mainloop goes in an infinite loop
as the handler is not removed and we are notified from the disconnection
indefinitely.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomore robustness against SIGCHLD
Daniel Lezcano [Fri, 7 May 2010 12:37:05 +0000 (14:37 +0200)]
more robustness against SIGCHLD

If the SIGCHLD is sent from a process different from the container's init
process we ignore it, otherwise we finish to wait it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodo not exit mainloop when child is stopped
Daniel Lezcano [Fri, 7 May 2010 12:37:05 +0000 (14:37 +0200)]
do not exit mainloop when child is stopped

When the init container is stopped, we don't check this condition
and we assume the child exited and we wait indefinitely for the child
to exit while this one is stopped.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd fd to ignore to lxc_check_inherited function
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
add fd to ignore to lxc_check_inherited function

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: move lxc_unlink_nsgroup out of lxc_fini
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: move lxc_unlink_nsgroup out of lxc_fini

to be able to have lxc_fini symetric with lxc_init

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: child failing before container rename
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: child failing before container rename

do the same checking as already done in lxc/restart.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: remove unused lxc_bridge_detach
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: remove unused lxc_bridge_detach

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: remove perror call in nl.c (V2)
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: remove perror call in nl.c (V2)

There is only one such perror call, so remove it in nl.c

In this same patch, verify that all functions of nl.c and network.c
are reporting a -errno value in case of error;
value that is reported in lxc log by the callers in conf.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: introduce lxc-kill command (v4)
gkurz@linux.vnet.ibm.com [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: introduce lxc-kill command (v4)

lxc-kill send a signal to the process 1 of the container.

If this command is used on an application container ran by
lxc-execute, the lxc-init will receive the signal and will forward it to
the process 2 which is the command specified in the command line.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoman update lxc.conf
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
man update lxc.conf

reformating given examples
and add reference to examples directory.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoman update lxc-create lxc-destroy
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
man update lxc-create lxc-destroy

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoman update lxc-execute and lxc-start (V2)
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
man update lxc-execute and lxc-start (V2)

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoman update lxc
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
man update lxc

update lxc man page to better explain:
* the notions of persistent and volatil container.
* the difference between lxc-execute and lxc-start commands

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: add usage and help to lxc-netstat (V2)
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: add usage and help to lxc-netstat (V2)

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: lxc-unshare to remove its /cgroup/<pid> (V3)
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
lxc: lxc-unshare to remove its /cgroup/<pid> (V3)

this is required to avoid to fill /cgroup
with pid number each time lxc-unshare is called.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove unused _config_console function
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
remove unused _config_console function

it's usage was removed by patch
28a4b0e55c659428bc8f495fde2e774fbd0fb03c
"open the console later"

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoget_init_pid moved to lxc/commands.c
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
get_init_pid moved to lxc/commands.c

as will be used later on in other patches.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreport error if statefd parm is not a digit
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
report error if statefd parm is not a digit

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd --statefd option to lxc-checkpoint/restart
Michel Normand [Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)]
add --statefd option to lxc-checkpoint/restart

This new option is to have user to pass a fd
in place of statefile name.

Simple usage with file open in bash:
===
$rm -f *.log; lxc-execute -n foo -- pi1  44444
$rm -rf /tmp/sf; lxc-checkpoint -n foo -k --statefd 3 3>/tmp/sf && lxc-restart -n bar --statefd 4 4</tmp/sf
===

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoclose fd 0 and 1 where not required
Michel Normand [Thu, 29 Apr 2010 08:03:58 +0000 (10:03 +0200)]
close fd 0 and 1 where not required

the fd 0,1 and 2 are still inherited
and we only need the fd 2 (stderr) after
the start/restart of the application.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoavoid compile warning lxc_init.c
Michel Normand [Thu, 29 Apr 2010 08:03:58 +0000 (10:03 +0200)]
avoid compile warning lxc_init.c

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFail gracefully with attach
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
Fail gracefully with attach

Fail when we try to attach to an non existing container

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agochange to the same directory when attaching
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
change to the same directory when attaching

This patch will try to change the default "/" directory to the
directory we were before attaching. In order to work correctly,
the path has to exist in the container, that makes sense with a
shared file system without rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofork/exec after attach
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
fork/exec after attach

The command to attach has to be fork/exec.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agorestart the container at reboot
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
restart the container at reboot

When the reboot is detected, reboot the container.
That needs to set all file descriptor opened by lxc-start
to be flagged with the close-on-exec flag, otherwise when
re-execing ourself, we inherit our own fd.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoshutdown the container when powering off the container
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
shutdown the container when powering off the container

This patch allows to shutdown the container when the system
is powered off in the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoStore the container name in the handler
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
Store the container name in the handler

Store the container in the handler, so it is accessible
everywhere.

Signed-off-by: Daniel Lezcano <dlezcan@fr.ibm.com>
14 years agocount the number of tasks in the container
Daniel Lezcano [Thu, 8 Apr 2010 07:44:23 +0000 (09:44 +0200)]
count the number of tasks in the container

This patch adds a function to count the number of tasks in the
container. The result is not reliable as it may change with a fork
or an exit, but in some cases, for example, there is only one task, or
the container is frozen, the result is accurate.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix when console is not specified
Daniel Lezcano [Fri, 2 Apr 2010 21:37:42 +0000 (23:37 +0200)]
fix when console is not specified

When no console is specified, do not try to setup the console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: add --statefile opt to lxc-checkpoint/restart
Michel Normand [Fri, 2 Apr 2010 16:45:47 +0000 (18:45 +0200)]
lxc: add --statefile opt to lxc-checkpoint/restart

based on patch from: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>

but also:
* remove the deprecated --directory one.
* change liblxc api of checkpoint/restart to use fd and not string.
* explicitely report error messages for the checkpoint/restart stub functions.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix lxc-setcap script for lxc-attach
Daniel Lezcano [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
fix lxc-setcap script for lxc-attach

Fix type and missing capability.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodo not use logfile in lxc_init (V2)
Michel Normand [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
do not use logfile in lxc_init (V2)

The log file in lxc-init is quite useless as the code is trivial.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agotypo in error message
Michel Normand [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
typo in error message

Wrong variable.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix lxc-attach returned error
Daniel Lezcano [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
fix lxc-attach returned error

When we try to attach to a container belonging to another user than us,
the command fails as expected but the return code is wrong, so we have
an "unknown error" instead of "permission denied".

The culprit is:

-                     strerror(command.answer.ret));
+                     strerror(-command.answer.ret));

The rest of the code is indentation without code impact.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <normand@fr.ibm.com>
14 years agolxc: enter / exec a command inside a container V2
Daniel Lezcano [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
lxc: enter / exec a command inside a container V2

This patch allows to execute a command or enter inside the container:
  * lxc-attach -n <name> [command]

If the <command is not specified>, the lxc-attach will retrieve your uid
and get your shell name and exec it in the container.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoopen the console later
Daniel Lezcano [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
open the console later

Open the console at the setup time, otherwise the openeded
file descriptor will be considered as an inherited fd and the
startup will fail.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc: forbid open fds upon startup
Cedric Le Goater [Mon, 22 Mar 2010 10:08:34 +0000 (11:08 +0100)]
lxc: forbid open fds upon startup

This patch modifies the startup of a container to forbid opened
fds, unless these are stdios.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
14 years agofix kill -1 process
Daniel Lezcano [Fri, 26 Feb 2010 20:12:31 +0000 (21:12 +0100)]
fix kill -1 process

In the process of rollbacking, the handler->pid is not set
we must not kill it. Otherwsise, kill(-1, SIGKILL), ouch ! ...

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd console.h to dist file
Daniel Lezcano [Fri, 26 Feb 2010 20:12:31 +0000 (21:12 +0100)]
add console.h to dist file

Add the console.h file in order to compile the dist file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix network devices cleanup on error
Daniel Lezcano [Thu, 25 Feb 2010 09:24:13 +0000 (10:24 +0100)]
fix network devices cleanup on error

Delete the network devices when an error occurs before they are moved
to the network namespace (network namespace destruction triggers the
network devices deletion). Otherwise they stay in the system.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix function prototype implementation
Daniel Lezcano [Thu, 25 Feb 2010 09:24:13 +0000 (10:24 +0100)]
fix function prototype implementation

Fix inconsistent function definition regarding the headers.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agodelete network devices by index
Daniel Lezcano [Thu, 25 Feb 2010 09:24:12 +0000 (10:24 +0100)]
delete network devices by index

Add a function to delete the network device by its index.

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