Commit Graph

178 Commits

Author SHA1 Message Date
Stéphane Graber
2bc93759f6 configure: Disable python3 builds with clang
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-12-23 16:06:56 -06:00
Stéphane Graber
d8d446599e configure: Add GnuTLS to configure overview
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-12-23 16:06:54 -06:00
KATOH Yasufumi
28f2ab26ea doc: Add Japanese lxc-autostart(1) and update lxc.conf(5)
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-12-20 13:48:05 +01:00
Stéphane Graber
a6adab20ff Add lxc-autostart
This introduces a new lxc-autostart binary (and associated manpage)
which will let you start/shutdown/kill/restart any container that's
marked as lxc.start.auto=1. It respects the lxc.start.delay value,
sorts by lxc.start.order and filters by lxc.group.

By default it'll affect all containers that DO NOT have lxc.group
set. If -g is specified, ONLY containers in those group will be
affected. To have a command applied to all containers, the -a
argument can be used.

A -L flag is also offered for distributions wishing to start the
containers themselves while still using LXC's calculated order and
wait delays. Instead of performing the action, it'll print the container
name and (if relevant for the action) the wait time.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-12-19 21:56:25 +01:00
KATOH Yasufumi
07ece60087 Add Japanese man pages for lxc-user-nic
Update for commit df3415e022

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-12-18 12:31:03 +01:00
Stéphane Graber
713893cdbc
change version to 1.0.0.beta1 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-12-17 14:25:02 -05:00
Serge Hallyn
df3415e022 add manpages for lxc-user-nic
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-12-17 11:15:57 -06:00
Stéphane Graber
f91d5e4e3f configure.ac: Make our configure more consistent
This commit does the following changes:
 - Disable rpath by default
 - Switch all of our options to --enable-FEATURE in the help
 - Add auto-detection of libcap availability
 - Add auto-detection of python3 availability
 - Always specify the default value in --help
 - Add a configuration overview at the end

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-12-16 08:14:23 -06:00
Stéphane Graber
f2a95ee1bf Move some common Ubuntu config
This introduces a new /usr/share/lxc/config directory containing common
configuration snippets.

The two Ubuntu templates are then simplified to just include the
relevant entries avoiding a whole lot of hardcoded cgroup, capabilities
and mount points configuration.

An extra comment is also added at the top of all generated configuration
files telling the user to look at lxc.conf(5) for more information.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-12-06 11:21:46 -05:00
S.Çağlar Onur
a22185ddda
Add LXC version information to version.h
So that applications can get the LXC version number at compile time.

This can be used to make applications/bindings that support compiling against
multiple versions of LXC.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-12-02 18:17:21 -05:00
Michael H. Warfield
164105f656
Added templates/lxc-centos for CentOS containers.
This adds an lxc-centos template for crreating CentOS 5+ templates.  It
does NOT create CentOS 4 or earlier containers as these are way past
end of life and no longer supported.  It is based on the work of
Fajar A. Nugraha <github@fajar.net> who modified an earlier Fedora
template.  His work has been brought LARGELY into congruence with
the current Fedora template.  It still lacks the distro agnostic
bootstrap and systemd code from the Fedora template but those should
only be relevant with CentOS 7 when that can of worms pops open
sometime next year or so.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-11-26 13:48:24 -05:00
James Hunt
953e611cea Add '--enable-api-docs' for doxygen-generated public API docs.
Signed-off-by: James Hunt <james.hunt@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-11-25 11:50:01 -05:00
Serge Hallyn
59328d58d3 remove HAVE_NEWUIDMAP and NEWUIDMAP
Always build lxc-usernsexec.  Else we require having uidmap
installed on the build host for no good reason.  And we never
actually used the NEWUIDMAP path we detected.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-11-22 08:32:37 -06:00
Stéphane Graber
dceb6c8018
change version to 1.0.0.alpha3 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-11-15 16:08:17 -05:00
S.Çağlar Onur
052616ebc6 valgrind drd tool shows conflicting stores happening at lxc_global_config_value@src/lxc/utils.c (v2)
Conflict occurs between following lines

[...]
269         if (values[i])
270                 return values[i];
[...]

and

[...]
309         /* could not find value, use default */
310         values[i] = (*ptr)[1];
[...]

fix it using a specific lock dedicated to that problem as Serge suggested.

Also introduce a new autoconf parameter (--enable-mutex-debugging) to convert mutexes to error reporting type and to provide a stacktrace when locking fails.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-11-01 16:40:00 -05:00
Serge Hallyn
9588a6cecb rpm spec: fix version numbering when building alpha, beta, rc
We want to ensure smooth upgrades when doing rpm -U throughout the
release cycle so this change implements the scheme documented at:
http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-29 14:50:07 -04:00
Stéphane Graber
8b54fb4de8
change version to 1.0.0.alpha2 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 18:11:53 -04:00
Alexander Khryukin
6e7e54d902 Change configure, replacing mandriva by openmandriva
The latest Mandriva distro release was in 2011 and nowadays distro named
OpenMandriva Lx.

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 12:25:45 -04:00
Alexander Khryukin
9aad9d12c9 Add an OpenMandriva distro lxc-openmandriva template
Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-10 13:32:02 -04:00
KATOH Yasufumi
cab7912308 template: Add Plamo Linux template
This template allows to create Plamo Linux container on Plamo
Linux. Plamo Linux is Japanese distribution, which is originally based
on Slackware Linux.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-09 22:51:49 -04:00
KATOH Yasufumi
ebe0aeb19c doc: Generate Japanese lxc-snapshot(1) man page
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-08 12:08:43 -04:00
Serge Hallyn
025f59ab98 add basic lxc-test-ubuntu (v3)
Some features of lxc - networking and LSM configuration for instance -
are generally configured by the distro packages.  This program
tests the Ubuntu configuration.

changelog v2:
  Switch to lxc-info -i to detect ip address as stgraber suggested
  Don't look for 'expect' as I'm not using it yet.
changelog v3:
  Make sure to only read one ip address from container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-03 12:23:07 -05:00
Dwight Engen
fe4de9a66d refactor AppArmor into LSM backend, add SELinux support
Currently, a maximum of one LSM within LXC will be initialized and
used. If in the future stacked LSMs become a reality, we can support it
without changing the configuration syntax and add support for more than
a single LSM at a time to the lsm code.

Generic LXC code should note that lsm_process_label_set() will take
effect "now" for AppArmor, and upon exec() for SELinux.

- fix Oracle template mounting of proc and sysfs, needed when using SELinux

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-25 17:12:36 -05:00
KATOH Yasufumi
7cb14f34a9 doc: Japanese man pages is not generated when docbook-utils is used
Character encoding of Japanese man pages is UTF-8. But docbook-utils
can't treat it (and don't have --encoding option that use in
Makefile). So change to Japanese man pages is not generated when
docbook-utils is used.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-25 09:50:26 -04:00
Stéphane Graber
c75c30ec73 Add some missing comments to configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-23 15:30:24 -05:00
Serge Hallyn
813a483765 snapshots: add man page and fix up help info a bit.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-12 15:49:16 -05:00
Christian Seiler
6e16552de7 Add cgroup.pattern global configuration option
Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-10 18:19:21 -04:00
KATOH Yasufumi
57da8c32f8 Add Japanese man pages.
Japanese man pages is installed under $mandir/ja.
At this time, it is based on version 0.9.0.
2013-09-10 18:19:20 -04:00
Daniel Lezcano
4213373fe5 change version to 1.0.0.alpha1 in configure.ac
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
2013-09-10 23:55:26 +02:00
Natanael Copa
f756cda05c configure: enable Lua if found and continue without if not
Search for Lua if no --enable-lua/--disable-lua specified but continue
without if not found.

If --enable-lua is specified and Lua is not found then return error.

If --disable-lua is specified, then don't search for Lua.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-06 15:19:15 -04:00
Natanael Copa
69c757b343 lua: fix logic to enable lua support in configure
When there is no --enable-lua or --with-lua-pc, Lua should not be
enabled.

This fixes a bug introduced with 12e93188 (configure/makefile:
Allow specify Lua pkg-config file with --with-lua-pc) that caused
configure script to fail if lua headers was missing.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-06 09:14:28 -04:00
Dwight Engen
3a1675bf08 add AS_VAR_COPY for older autoconf versions
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-05 19:59:05 -04:00
Natanael Copa
12e93188de configure/makefile: Allow specify Lua pkg-config file with --with-lua-pc
Enable support for both Lua 5.1 and 5.2 by letting user specify the Lua
pkg-config package name. By default it will use 'lua' and try figure
out which version it is.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-05 19:57:52 -04:00
Stéphane Graber
511a6936c7 Allow building without confstr
We use confstr to grab the default PATH value. If it's not there, just
use a standard one with bin and sbin for /, /usr and /usr/local.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-08-19 14:33:31 +02:00
Stéphane Graber
7f3e12f3e5 Use srand/rand instead of initstate/random
initstate/random doesn't work on bionic, srand/rand works on everything,
so let's use that.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-08-19 14:33:21 +02:00
Stéphane Graber
4ba0d9af63 Add a local implementation of ifaddrs.h
This adds a local ifaddrs implementation to be used on Bionic or other C
libraries that don't come with a getifaddrs implementation.

This code was written by Kenneth MacKay and is under a two-clause BSD
license (copyright information in the file headers).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-08-19 14:32:41 +02:00
Alexander Vladimirov
d007f8ab3d Add subdir-objects option to AM_INIT_AUTOMAKE
Fix build with automake 1.14 and newer, since it requires explicit
setting now.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-08-15 15:33:35 -05:00
Serge Hallyn
070a4b8e68 lxc-user-nic: specify config and db files in autoconf
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-08-14 10:50:46 -05:00
Serge Hallyn
d155b47dac define lxc-usernsexec
It uses the newuidmap and newgidmap program to start a shell in
a mapped user namespace.  While newuidmap and newgidmap are
setuid-root, lxc-usernsexec is not.

If new{ug}idmap are not available, then this program is not
built or installed.  Otherwise, it will be used to support creating,
starting, destroying, etc containers by unprivileged users using
their authorized subuids and subgids.

Example:
	usernsexec -m u:0:100000:1 -- /bin/bash

will, if the user is authorized to use subuid 100000, start a
bash shell in a user namespace where 100000 on the host is
mapped to root in the namespace, and the shell is running as
(privileged) root.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-07-23 08:09:35 -05:00
Serge Hallyn
3ce746862b lxc_create: prepend pretty header to config file (v2)
Define a sha1sum_file() function in utils.c.  Use that in lxcapi_create
to write out the sha1sum of the template being used.  If libgnutls is
not found, then the template sha1sum simply won't be printed into the
container config.

This patch also trivially fixes some cases where SYSERROR is used after
a fclose (masking errno) and missing consts in mkdir_p.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-07-15 16:34:00 -05:00
Serge Hallyn
0a18b5458b Define LXC_DEFAULT_CONFIG
And use it in place of the various ways we were deducing /etc/lxc/default.conf.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-31 11:14:33 -05:00
Serge Hallyn
3a647d582d configure/makefile: rename default_conf to distro_conf
configure/makefile: rename default_conf to distro_conf, since it is a per-distro
default.  Then we'll be able to use the symbol LXC_DEFAULT_CONF in the code to
refer to the installed file.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-05-31 11:14:26 -05:00
Serge Hallyn
1897e3bcd3 Move container creation fully into the api
1. implement bdev->create:

python and lua: send NULL for bdevtype and bdevspecs.
They'll want to be updated to pass those in in a way that makes
sense, but I can't think about that right now.

2. templates: pass --rootfs

If the container is backed by a device which must be mounted (i.e.
lvm) then pass the actual rootfs mount destination to the
templates.

Note that the lxc.rootfs can be a mounted block device.  The template
should actually be installing the rootfs under the path where the
lxc.rootfs is *mounted*.

Still, some people like to run templates by hand and assume purely
directory backed containers, so continue to support that use case
(i.e. if no --rootfs is listed).

Make sure the templates don't re-write lxc.rootfs if it is
already in the config.  (Most were already checking for that)

3. Replace lxc-create script with lxc_create.c program.

Changelog:
May 24: when creating a container, create $lxcpath/$name/partial,
and flock it.  When done, close that file and unlink it.  In
lxc_container_new() and lxcapi_start(), check for this file.  If
it is locked, create is ongoing.  If it exists but is not locked,
create() was killed - remove the container.

May 24: dont disk-lock during lxcapi_create.  The partial lock
is sufficient.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-25 19:27:07 -05:00
Serge Hallyn
60bf62d4ae destroy: implement in the api
This requires implementing bdev->ops->destroy() for each of the backing
store types.  Then implementing lxcapi_clone(), writing lxc_destroy.c
using the api, and removing the lxc-destroy.in script.

(this also has a few other cleanups, like marking some functions
static)

Changelog:
	fold into destroy: fix zfs destroy
	destroy: use correct program name in help

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 23:37:04 -05:00
Serge Hallyn
3e625e2d2e lxc-stop: use api, remove lxc_shutdown, extend lxc-stop functionality
implement c->reboot(c) in the api.

Also if the container is not running, return -2.  Currently
lxc-stop will return 0, so you cannot tell the difference
between successfull stopping and noop.

Per stgraber's email:

 - Remove lxc-shutdown
 - Change lxc-stop so that:
   * Default behaviour is to call shutdown(), wait 15s for STOPPED, if
not STOPPED, print a message to the user and call stop() [ NOTE:
actually 60 seconds per followup thread]
   * We have a -r option to reboot the container (with proper check that
the container indeed rebooted within the next 15s)
   * We have a -s option to shutdown the container without the automatic
fallback to stop()
   * Add a -k option allowing a user to just kill a container
(equivalent to old lxc-stop, no shutdown() call and no delay).

and update manpages.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-24 23:31:28 -05:00
Serge Hallyn
58a46e0621 add lxc-cirros
Add a template to create a cirros container.  One great thing about
cirros is that the image you download is 3.5M.

Thanks smoser!

Note by default /etc/inittab doesn't have a /dev/console entry, so you
don't get a login on the lxc-start console.  Adding

console::respawn:/sbin/getty 115200 console

makes that work, but ctrl-c still gets forwarded to init which then
reboots.  So I didn't bother adding console as part of the template
(yet).  Instead I simply lxc-start -d, then lxc-console.

Signed-off-by: Scott Moser <scott.moser@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-05-14 08:15:16 -05:00
Serge Hallyn
b164a17f9b remove lxc-clone-sh
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-04-30 14:25:11 -05:00
Serge Hallyn
9be5377379 implement backend drivers and container clone API (v3)
1. commonize waitpid users to use a single helper.  We frequently want
to run something in a clean namespace, or fork off a script.  This
lets us keep the function doing fork:(1)exec(2)waitpid simpler.

2. start a blockdev backend implementation.  This will be used for
mounting, copying, and snapshotting container filesystems.

3. implement btrfs, lvm, directory, and overlayfs backends.

4. For overlayfs, support a new lxc.rootfs format of
'bdevtype:<extra>'.  This means you can now use overlayfs-based
containers without using lxc-start-ephemeral, by using
lxc.rootfs = overlayfs:/readonly-dir:writeable-dir

5. add a set of simple clone testcases

6. Write a new lxc_clone.c based on api clone.

Still to do (there's more, but off top of my head):

1. support zfs, aufs
2. have clone handle other mount entries (right now it only clones
the rootfs)
3. python, lua, and go bindings (not me :)
4. lxc-destroy: if lvm backing store, check for snapshots of it.
   (what about directories which have overlayfs clones?)

Changes since v2:
	Initialize random generator when picking new macaddr (reported
	  by caglar@10ur.org)
	Fix wrong use of bitmask flags
	On copy-clone of btrfs, create a subvolume
	lxc_clone.c: respect the command line usage of the old script
	lxc-clone(1): update documentation
	Refuse to try changing backing stores expect to overlayfs, as
	  it is not implemented (yet) anyway.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>

Conflicts:
	src/lxc/utils.h
2013-04-30 09:12:42 -05:00
Dwight Engen
7f95145833 fix building docs
Commit 69fe23ff added checking for the older docbook2man back into
configure, but this breaks building the docs on at least Oracle Linux and
Fedora when docbook2X is not installed as docbook2man will be found but the
docs don't actually build with that tool.

This change makes it so the docs can be built with either the older
docbook2man or the newer 2X tools by using configure to set the dtd
string to an appropriate value depending on use of docbook2man or
db2x_docbook2man.

Also fixed a small error in lxc-destroy.sgml.in that was noticed
by the old tools.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-04-30 08:19:37 -05:00
Peter Simons
69fe23ff07
configure: support for the "docbook2man" utility to build the documentation
This adds docbook2man as an alternative name for the docbook compiler.
As that name was used on Debian based systems for an older version of the tool,
this change also adds a check so that docbook2man is never used on Debian based
systems.

Reported-by: Peter Simons <simons@cryp.to>
Reported-by: Christian Bühler christian@cbuehler.de
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-04-25 15:29:51 +02:00