Commit Graph

821 Commits

Author SHA1 Message Date
Serge Hallyn
623f98d8cc 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>
2011-07-25 00:22:50 +02:00
Serge Hallyn
c440536e7c 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>
2011-07-25 00:22:50 +02:00
Serge Hallyn
e7eb632cb4 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>
2011-07-25 00:22:50 +02:00
Joerg Gollnick
c011782c8d 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>
2011-07-25 00:22:50 +02:00
Serge E. Hallyn
bcbd102cba 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>
2011-07-04 00:42:06 +02:00
Frederic Crozat
c840b37de8 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>
2011-07-04 00:35:52 +02:00
Serge Hallyn
c1c75c04a6 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>
2011-06-25 15:17:47 +02:00
Serge Hallyn
7c3ab01ffd 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>
2011-06-25 15:17:47 +02:00
Serge Hallyn
c6992ecf0d 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>
2011-06-25 15:17:47 +02:00
Serge Hallyn
8339b4c86a 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>
2011-06-25 15:17:47 +02:00
Serge Hallyn
e2b4064f94 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>
2011-06-25 15:17:47 +02:00
Serge E. Hallyn
b722bed2da 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>
2011-06-24 00:42:24 +02:00
Serge E. Hallyn
be8b597242 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>
2011-06-24 00:42:24 +02:00
Serge E. Hallyn
e2e0ee2501 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>
2011-06-24 00:42:24 +02:00
Daniel Lezcano
9ccb2dbcd2 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>
2011-06-02 09:50:38 +02:00
Stéphane Graber
d755a9e6b4 Add initial oneiric template 2011-05-26 22:58:23 +02:00
Stéphane Graber
3930b7453e Convert all Debian (and derivative) templates from using 'arch' to using 'dpkg --print-architecture' as debootstrap does 2011-05-26 22:58:23 +02:00
Sven Wegener
77890c6d6b 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>
2011-05-23 23:12:24 +02:00
Sven Wegener
88d413d5b6 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>
2011-05-23 23:12:24 +02:00
Cedric Le Goater
820339bd96 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>
2011-05-20 11:37:16 +02:00
Daniel Lezcano
476d4cf175 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>
2011-05-13 22:29:34 +02:00
Daniel Lezcano
f66331efb0 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>
2011-05-07 01:33:33 +02:00
Serge E. Hallyn
f2b2ec3160 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>
2011-05-07 01:33:33 +02:00
Cedric Le Goater
dfafa5a513 lxc-execute: document the '--' option
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-05-05 12:07:51 +02:00
Cedric Le Goater
43de51b744 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>
2011-05-05 12:07:51 +02:00
Greg Kurz
25df6b78d2 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>
2011-04-06 13:41:44 +02:00
Cedric Le Goater
63e0f402aa 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>
2011-04-06 13:37:21 +02:00
Michel Normand
1a91da6ca6 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>
2011-03-22 15:17:21 +01:00
François-Xavier Bourlet
0411a75203 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>
2011-03-22 15:10:37 +01:00
Michael Santos
bf83c5b90b confile: check allocation succeeds
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-22 15:04:52 +01:00
Michael Santos
95642a1068 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>
2011-03-22 15:04:52 +01:00
Michael Santos
6d10f1fcdc arguments: check allocation succeeds
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-22 15:04:52 +01:00
Michael Santos
dae3fdf6b6 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>
2011-03-22 15:04:52 +01:00
Michael Santos
76f74594a1 lxc_unshare: edit help output
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-22 15:04:52 +01:00
Michael Santos
f3bc28bd61 Ensure monitored container name is null terminated
regexec() expects a null terminated name.

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-16 15:14:36 +01:00
Michael Santos
302aaa2b2d Exit if allocation fails
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-16 15:14:36 +01:00
Daniel Lezcano
071a2b8cc9 fix mount path
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-14 21:47:15 +01:00
Daniel Lezcano
d472214b83 rename physical device to the original name
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-07 02:08:47 +01:00
Daniel Lezcano
b84f58b9fb factor out networking configuration code
Change the name of the functions and factor some of them.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-03-07 02:08:47 +01:00
Daniel Lezcano
daa5d3fd90 lxc-0.7.4
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-26 10:18:19 +01:00
Jan Niehusmann
bb02d90eea Update file capa detection for kernels >=2.6.37
The comment containing the version number at the beginning of the kernel
config file changed its format with 2.6.37. This trivial patch makes the
grep less specific, so it triggers for both formats.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-26 10:18:19 +01:00
Amit Uttamchandani
7593bdfbe2 Fixed a small typo in lxc-debian template
"udpate" should be "update" in configure_debian().

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-19 09:45:32 +01:00
Rob Landley
a3e80ccc74 fix lxc-checkpoint and lxc-restart sgml labels
The patch fixes two build breaks in the sgml files:

lxc-checkpoint.sgml.in
Element Title in namespace '' encountered in refsect1, but no template
matches.

lxc-restart.sgml:58: parser error : AttValue: " or ' expected
      <arg
choice=req><option>--name=<replaceable>NAME</replaceable></option></a


Signed-off-by: Rob Landley <rlandley@parallels.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-17 10:07:44 +01:00
Daniel Lezcano
1b7d474304 Simplify broadcast computation
David Ward reported this computation could be written in a simpler
way.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-14 09:22:08 +01:00
Daniel Lezcano
955f4ce683 update configuration wrt to the broadcast address
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-06 21:30:18 +01:00
Daniel Lezcano
d8948a52c3 fix broadcast compution
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-06 21:29:13 +01:00
Daniel Lezcano
7b57e8b681 fix empty network configuration
The return statement is at the wrong place.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-02 21:55:49 +01:00
Daniel Lezcano
829dd9183c lxc-start can output the console to a file
Add the ability to specify a file to output the console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-01 14:49:40 +01:00
Daniel Lezcano
9dd97e4414 lxc-0.7.4-rc1
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-02-01 12:55:39 +01:00
Cedric Le Goater
dfb8f06a3b take into account new configure option --with-linuxdir
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
2011-02-01 12:54:17 +01:00