Commit Graph

656 Commits

Author SHA1 Message Date
Michel Normand
bcc23654af add capabilities for lxc-checkpoint
add capabilities for lxc-checkpoint

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 22:57:46 +01:00
Michel Normand
6e4bb2e01f lxc: move setup_fs to utils.c
This is not required immidiately but may be used by other init.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 22:57:46 +01:00
Daniel Lezcano
96c210bbbe fix container find the previously created configuration
The command specifies a configuration file => use it
The command does not specify a configuration but the container
was created before, use the configuration.
The command does not specify a configuration and the container
was not created before, use default.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 22:57:46 +01:00
Andrian Nord
a7856c5545 lxc-netstat should use @LXCPATH@ for lxcpath=
Typo ;)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 10:56:24 +01:00
Michael Tokarev
92db2bb00c batched reads for lxc_console
Instead of doing I/O one-byte-at-a-time in lxc_console,
which is slow, let's do it in batches.  Only for output
(from container to the host system), since input is most
likely one-byte-at-a-time anyway (from a keyboard).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 10:56:24 +01:00
Michael Tokarev
994f905eed host consoles/ttys in containers
I noticed that container's consoles aren't quite useable
(be it lxc-console or lxc-start with getty bound to /dev/console).
The main problem is a complete lack of window resizing support:
when I resize an xterm window with lxc-start or lxc-console, the
"guest" does not know about that and continues to think that the
terminal is 80x25 still.

Is it just a lack of functionality (missing implementation) or
something problematic?
 
Ok, the attached patch fixes this.
 
It moves the 'master' variable out of main function so it's
accessible from the signal handler, sets up SIGWINCH handler
to call a (newly created) winsz() function that gets the
current tty size using TIOCGWINSZ ioctl and if that works,
sets up the pty size using TIOCSWINSZ.  That same function
is called at the start as well, when setting up the signal
handler.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-By: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 10:56:24 +01:00
Andrian Nord
aef4ebcf22 Choose configuration directory
Maybe it will be more logical to keep configs into /etc/lxc/?

Or, maybe, just use --with-config-path=/some/path switch into configure,
which could be overridden as user wants to? Something like this one (in
assumption, that this is up to user to create corresponding directory):

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 10:56:23 +01:00
Cedric Le Goater
00b3c2e284 cleanup <lxc/lxc.h>
<lxc/lxc.h>  should only include what is needed. This patch removes
all useless headers from lxc.h and fixed other .c files.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-17 10:56:23 +01:00
Michel Normand
b0691f8179 typo in 4886240165 (V2)
without this correction, unable to create a container with a configuration file.
This is a side effect of commit 4886240165

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 22:55:23 +01:00
Daniel Lezcano
07ede90408 Fix lxc-netstat script
Recent changes around the configuration tree broke the current
implementation of the lxc-netstat.

Instead of retrieving the init_pid in the /var/lxc/<name>/...,
pick one in the cgroup tasks list.

There is still a restriction with this command making impossible
to run it as non-root, any idea is welcome :(

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Andrian Nord
3fb0a9bb6e Q: general lxc architecture
Patch moves etc/* contents into doc/examples/ and adds
--disable-examples configure switch which may be used not to install
examples. Default is to install them into ${docdir}/examples (commonly:
/usr/share/doc/lxc/examples)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Michel Normand
0079c6c0da lxc lxc-sshd using new lxc.mount.entry keyword
Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Michel Normand
70dd139727 lxc: remove lxc.mount setting in lxc-fedora script
This script do not use extract fstab (as done by lxc-debian)
so there is no reason to set the lxc.mount key in config file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Michel Normand <michel_mno@laposte.net>
2009-11-13 11:48:29 +01:00
Michel Normand
3f4a86bf0f lxc-debian using new lxc.mount.entry keyword
Fix script to not add a fstab file.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Michel Normand
e7938e9ee3 lxc: add a new lxc.mount.entry keyword
The purpose of this new keyword is to save in main config file
all the lines of a provided fstab file.
This will ultimately replace the the lxc.mount keyword
when lxc scripts will use the new keyword.

Warning: I did not validated this patch
in all conditions of provided malformed input string.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Michel Normand
88329c69cd stop config reading if cgroup setting failed
in today's code lxc-start to not stop if setup_cgroup is detecting an error

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Michel Normand
1846e71a27 lxc-debian to not use empty mount table
lxc should not save in config generated file the name of an
empty file if no additionnal mount point specified by user.

Signed-off-by: Michel Normand <michel_mno@laposte.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Daniel Lezcano
ab2d32f88c Replace create/destroy by a script
The simplification of the container configuration makes
pointless to have so much complexity in the container creation.
Let's remove that and replace by some scripts.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Daniel Lezcaon
4886240165 Allows a container to run without previous creation
When a container was created, its configuration is used.
When a container was not created, the configuration specified in
the command line is used, if not configuration file is used,
default values are used.

That allows to create 'volatile' container, like tmp files.
It is useful for example to spawn different container with the
same generic configuration file. That let the user to have its own
repository of configuration files.

And, more important, that fix temporary created container with
lxc-execute to be not deleted when the host crash or the command
is killed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Dhaval Giani
6dadd7dc71 liblxc: Fix compile failure
Fix compile failure

commit 884866b3c3 introduces a compile
failure,

make[3]: *** No rule to make target `lock.c', needed by `liblxc_so-lock.o'.  Stop.
make[3]: Leaving directory `/home/dhaval/work/lxc/lxc/src/lxc'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dhaval/work/lxc/lxc/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/dhaval/work/lxc/lxc/src'
make: *** [all-recursive] Error 1

Remove those entries from the Makefile

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-13 11:48:29 +01:00
Daniel Lezcano
adaeaa992a Fix abstract af_unix socket name
Fix a typo making the abstract af_unix socket name to be wrong.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-12 14:40:14 +01:00
Daniel Lezcano
884866b3c3 Remove the usage of a lock file
The lock is no longer needed as the mutual exclusion and
'is running' check is done via the af_unix command socket.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-12 14:40:14 +01:00
Cedric Le Goater
641c20a663 export log function so it can be used by library user
The log api may be used by an external component which needs to
access these functions.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-12 14:40:14 +01:00
Ryousei Takano
e43a27b4bf Remove an unnecessary entry in the spec file
Hi Daniel and all,

The rpmbuild command fails due to an unnecessary *.a entry in the %file list.
This patch removes it from the lxc.spec file.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-11 21:33:44 +01:00
Andrian Nord
7fa9074f13 ipv6 interfaces added with /0 prefix
Greetings, I've found a small typo into src/lxc/conf.c that leads to
nulled prefix for ipv6 addresses.

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-09 10:43:03 +01:00
Michel Normand
d5cf438682 lxc: lxc version to reflect string in AC_INIT (V2)
I changed the code to have lxc version to reflect the
string set in AC_INIT of configure.ac
rather than to report only the 3 first digits

update: use PACKAGE_VERSION in place of VERSION

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-04 15:14:30 +01:00
Andrian Nord
5c8f9bd849 configure.ac - allow user to switch off/on documentation generation
Andrian Nord <NightNord@gmail.com>:
>> > > As documentation requires docbook2man to be installed, which is not,
>> > > otherwise, required for proper LXC work or compilation process, it
>> > > might be usefull to be able to switch it off.

Michel Normand <normand@fr.ibm.com>:
> > For me, it is Ok to add a --enable/disable/-doc,
> > but not make configure to fail if no option specified
> > and no docbook2man package.
> > 
> > For me it should be optionnal.
> > I like the current behaviour where configure is running without option
> > and is enabling/disabling by itself the doc building.
> > Could you send a new patch with this idea ?

Andrian Nord <NightNord@gmail.com>:
Of course. You mean, that you what default behaviour to remain
auto-detection? That is:
--enable-doc: require docbook2man or fail, generate mans
--enable-doc=auto, or not specified (default): check for docbook2man,
generate mans if found, silently ignore if not found (I suppose
diagnostic message is redundant, as information already contains into
./configure --help)
--disable-doc: never check for docbook2man and don't gen mans

Here comes a patch what do this, as far as I see
(I'm sorry for violating post-rules in previous mail, now I'll do all
right, I hope. Should I attach patch anyway, as it might be usefull
for applying?)

Signed-off-by: Andrian Nord <NightNord@gmail.com>
Acked-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-04 14:03:44 +01:00
Michel Normand
422afdd240 lxc /cgroup/name/ not removed at container end
this is a side effect of my previous patch
that removed the LXCPATH/name/nsgroup file.
9f44c57836

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-11-03 11:40:42 +01:00
Daniel Lezcano
b9f94fc1e8 fix compilation error when buildir differs from srcdir
Fix the include path for compiling and clean the Makefile.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michel Normand <normand@fr.ibm.com>
2009-10-23 11:15:27 +02:00
Cedric Le Goater
5b46e19c3f lxc: kill libtool
This is useless in a Linux only environment. The .so version is
the version of the package.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
881450bbed use config.h to define the lxcpath and co
Instead of passing the LXCPATH definition in the compiler
command line, use configure.ac to define the value in the config.h
file and include this file where it is needed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
92d385229b remove test directory
These tests are not relevant now. It would be better to write
some real test cases with some script using the lxc cli in order
to check non regression.
I remove these annoying tests I have to port each time a function
prototype is changed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-22 15:33:40 +02:00
Daniel Lezcano
0e322d2295 mount /dev/mqueue
Mount always /dev/mqueue with lxc_init.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-15 14:17:14 +02:00
Daniel Lezcano
d685aa8049 clean up and factor out some code
Factor out some code and fix a memory corruption when
dupping the arguments.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a059591e9f Fix network prefix
Fix the missing network prefix. When no network prefix is specified,
the prefix is computed from the network class specified.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a1511e8d15 fix compilation error for tests
Fix test program compilation errors.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
a79cf70427 remove configure dead code
Remove the old configuration remaining code.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-12 22:02:06 +02:00
Daniel Lezcano
5e4a62bf32 fix tty creation using confdir
tty_create uses the old conf directory, fixing this.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
5f4535a3d9 fix netdev structure vs network structure
The netdev vs network structure is not well defined. Fix that.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
4bf1968d3c Factor out some network code
We can factor out the "ip addr add"

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
82d5ae15e7 Use the configuration structure for the network
We don't want to use anymore the configuration directory,
let's use the configuration structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
571e6ec89e Move configuration info to the structure
Move configuration informations from the handler structure to
the configuration structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
88d5514d16 Move the configuration file to the start function
We want to store more information in the configuration structure,
especially the ttys.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
102a53038a use the configuration structure for the cgroup
Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Michel Normand
9f44c57836 remove the LXCPATH/<name>/nsgroup file
There is no more need of this file so remove it.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Michel Normand
14ad6bfdf0 use the new nsgroup_path_get function in freezer.c
to avoid to use the LXCPATH/<name>/nsgroup

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Michel Normand
a6ddef6149 new lxc_cgroup_path_get function
remove the usage of LXCPATH/<name>/nsgroup
in get/set function.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Michel Normand
758437c558 place nscgroup path in lxc_handler
this also avoid to call two times get_cgroup_mount

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
52e3595723 use the configuration structure for the tty
Do not use the directory configuration

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00
Daniel Lezcano
1bc60a65c9 use configuration structure for the mount points
Do not use the directory configuration for the mount points.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2009-10-09 11:38:39 +02:00