]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
10 years agoMake ubuntu templates squid-deb-proxy-client aware
Chris Glass [Thu, 9 Jan 2014 16:40:12 +0000 (16:40 +0000)]
Make ubuntu templates squid-deb-proxy-client aware

This makes the ubuntu and ubuntu-cloud templates automatically aware of apt
proxy settings when the LXC host has "squid-deb-proxy-client" installed. This
makes installations *much* faster when a suitable squid-deb-proxy is
found on the network (or installed on the host).

Signed-off-by: Chris Glass <tribaal@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agohandle simple bashisms:
Elan Ruusamäe [Mon, 13 Jan 2014 08:26:09 +0000 (10:26 +0200)]
handle simple bashisms:

- [[ ]] -> [ ]
- == -> =
- source -> .
- redirect of fd 200 is error in mksh, use fd 9
- &> /dev/null -> > /dev/null 2>&1
- useless function keyword
- echo -e -> printf

still left bash shebang which did not validate with checkbashism, mostly
due 'type' being reported as bashism

Signed-Off-By: Elan Ruusamäe <glen@delfi.ee>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-start-ephemeral: Fix syntax error in aufs
Åsmund Grammeltvedt [Mon, 13 Jan 2014 22:34:57 +0000 (23:34 +0100)]
lxc-start-ephemeral: Fix syntax error in aufs

Signed-off-by: Åsmund Grammeltvedt <asmundg@snap.tv>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodownload: Improve cache handling
Stéphane Graber [Tue, 14 Jan 2014 20:02:42 +0000 (15:02 -0500)]
download: Improve cache handling

This adds a new --force-cache parameter which will force use of the
cache even for expired images.

An expired image is now only flushed from the cache once a new one is
successfuly downloaded (to avoid destroying the local cache when the
host doesn't have internet connectivity).

The ID of the build in cache is also tracked so that we don't
re-download something we already have (should only happen if we don't
have a new build published by the time the previous one expires).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodownload: Support listing available images
Stéphane Graber [Tue, 14 Jan 2014 19:48:24 +0000 (14:48 -0500)]
download: Support listing available images

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodownload: Don't use an hardcoded exclude list
Stéphane Graber [Tue, 14 Jan 2014 19:12:33 +0000 (14:12 -0500)]
download: Don't use an hardcoded exclude list

Instead of hardcoding --exclude=./dev/*, use a new metadata file
"excludes" which lists all the paths or patterns to exclude during
extraction (one per line).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodownload: Fix download_sig logic
Stéphane Graber [Tue, 14 Jan 2014 18:56:04 +0000 (13:56 -0500)]
download: Fix download_sig logic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Update lxc.conf(5)
KATOH Yasufumi [Tue, 14 Jan 2014 06:51:47 +0000 (15:51 +0900)]
doc: Update lxc.conf(5)

* Update Japanese lxc.conf(5) for commit 508c263ee6ed2fac73f6979af287caba38963b4b
* Remove duplicate line in English lxc.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodownload: don't download signatures when --no-validate given
Dwight Engen [Tue, 14 Jan 2014 01:04:56 +0000 (20:04 -0500)]
download: don't download signatures when --no-validate given

- show full path to failed download location

- change test to -f in case meta.tar.xz:templates has a blank line it
  won't attempt to sed a directory

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd minimal userns config for plamo
Stéphane Graber [Mon, 13 Jan 2014 22:06:01 +0000 (17:06 -0500)]
Add minimal userns config for plamo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgroup: move all some functions into cgroup.h
Serge Hallyn [Mon, 13 Jan 2014 21:26:49 +0000 (15:26 -0600)]
cgroup: move all some functions into cgroup.h

Some functions which wanted to know about cgroup paths were located
in other files.  Move them into cgroup.c, so that all knowledge of
the cgroup backend can be colocated.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoinclude: remove duplicates
Luka Perkov [Mon, 13 Jan 2014 17:46:55 +0000 (17:46 +0000)]
include: remove duplicates

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoinclude: cleanup unnecessary getline defines
Luka Perkov [Mon, 13 Jan 2014 17:46:50 +0000 (17:46 +0000)]
include: cleanup unnecessary getline defines

The removed chunk is already defined in utils.h which
is included in modified files.

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix bug setting autodef in config
Dwight Engen [Mon, 13 Jan 2014 17:46:55 +0000 (12:46 -0500)]
fix bug setting autodef in config

Introduced in commit df2d4205.

Reported-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agointroduce a simple test for testing add_device_node and remove_device_node
S.Çağlar Onur [Mon, 13 Jan 2014 05:34:13 +0000 (00:34 -0500)]
introduce a simple test for testing add_device_node and remove_device_node

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoThis change introduce mac address templating.
Serge Hallyn [Mon, 13 Jan 2014 16:02:29 +0000 (10:02 -0600)]
This change introduce mac address templating.

By setting lxc.network.hwaddr to something like fe:xx:xx:xx:xx:xx each
"x" will be replaced by a random value.  If less significant bit of
first byte is "templated", it will be set to 0.

This change introduce also a common randinit() function that could be
used to initialize random generator.

Signed-off-by: gza <lxc@zitta.fr>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoplamo: Update template to use lxc.include and add plamo.common.conf
KATOH Yasufumi [Mon, 13 Jan 2014 11:57:53 +0000 (20:57 +0900)]
plamo: Update template to use lxc.include and add plamo.common.conf

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agointroduce lxc-unpriv test
Serge Hallyn [Mon, 13 Jan 2014 02:45:00 +0000 (20:45 -0600)]
introduce lxc-unpriv test

It simply creates a test user and tries to create and start
a container as that user.  Tries to lxc-attach to that
container to test network connectivity.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agousernsexec: don't fail if we can't open pty
Serge Hallyn [Mon, 13 Jan 2014 02:44:32 +0000 (20:44 -0600)]
usernsexec: don't fail if we can't open pty

It's nice if we can do it, but not required.  Exiting on this
failure causes lxc-create started by root as a less-privileged
userid to fail.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoensure all config items are duplicated on clone/write_config
Dwight Engen [Thu, 9 Jan 2014 20:36:13 +0000 (15:36 -0500)]
ensure all config items are duplicated on clone/write_config

Since previously I had found a config item that wasn't being propagated
by lxc-clone, I went through all the config items and made sure that:
 a) Each item is documented in lxc.conf
 b) Each item is written out by write_config

The only one that isn't is lxc.include, which by its nature only pulls
in other config item types.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroup: recursively delete cgroups when asked
Serge Hallyn [Sat, 11 Jan 2014 06:14:26 +0000 (00:14 -0600)]
cgroup: recursively delete cgroups when asked

Currently when a container is shut down, lxc walks the set of all
cgroup paths it created, in reverse order, and tries to remove them.
This doesn't suffice if the container has also created new cgroups.

It'd be impolite to recursively remove all the cgroup paths we created,
since this can include '/lxc' and thereunder all other containers
started since.

This patch changes container shutdown to only delete the container's own
path, but do so recursively.  Note that if we fail during startup,
the container won't have created any cgroup paths so it the old
way works fine.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodownload: Initial template
Stéphane Graber [Fri, 10 Jan 2014 22:28:07 +0000 (17:28 -0500)]
download: Initial template

This adds a new template called "download". It's a fairly simple
template with a minimal set of dependency which will grab any pre-built
image available on https://images.linuxcontainers.org
Note that the serverside is still work in progress (missing SSL support).

Access is done over https by default with a warning being emitted if
fallback to http was required (may be needed for testing, when behind
proxy and with private servers). All index files and tarballs are
gpg-signed with the default pubkeyid contained in the template itself.

The main benefit of this template is to be entirely
distribution-agnostic, any template that can be integrated with the
server build infrastructure will then work on any LXC machine when using
the download template. This template is also compatible with user
namespaces and will hopefully help widden the number of distros that may
work in unprivileged LXC.

This commit also bundles a small change to the template configs to have
the ubuntu template (used by the download template) to work with
unprivileged LXC.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix some typos
Stéphane Graber [Sun, 12 Jan 2014 20:48:48 +0000 (15:48 -0500)]
Fix some typos

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoOne more rename of the system options
Stéphane Graber [Fri, 10 Jan 2014 20:33:33 +0000 (15:33 -0500)]
One more rename of the system options

This should be the last change of name for those options. This change
basically move them all to lxc.bdev.<backend>.<option>.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix bug in preserve_ns
Serge Hallyn [Sat, 11 Jan 2014 03:48:30 +0000 (21:48 -0600)]
Fix bug in preserve_ns

If /proc/self/ns does not exist, then preserve_ns was failing to
initialize the saved_ns[i] to -1.  This caused attach_ns() to try
and attach, and of course fail.

Initialize the saved ns values before returning an error.

The return values of preserve_ns and attach_ns were also being
ignored.  Honor them.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoDrop usage of LXC_DEFAULT_CONFIG in our code
Stéphane Graber [Thu, 9 Jan 2014 23:05:22 +0000 (18:05 -0500)]
Drop usage of LXC_DEFAULT_CONFIG in our code

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRe-organize API for global lxc.conf config
Stéphane Graber [Thu, 9 Jan 2014 22:31:52 +0000 (17:31 -0500)]
Re-organize API for global lxc.conf config

Instead of having one function for each possible key in lxc.conf which
doesn't really scale and requires an API update for every new key,
switch to a generic lxc_get_global_config_item() function which takes a
key name as argument.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd lxc.default_config to LXC's own config
Stéphane Graber [Thu, 9 Jan 2014 22:05:25 +0000 (17:05 -0500)]
Add lxc.default_config to LXC's own config

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRename all lxc.conf options to lxc.<key>
Stéphane Graber [Thu, 9 Jan 2014 21:54:37 +0000 (16:54 -0500)]
Rename all lxc.conf options to lxc.<key>

This is a first step in bringing the lxc.conf configfile in line with
the container's format.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Remove unneeded "SEE ALSO" part in lxc-ls(1)
KATOH Yasufumi [Thu, 9 Jan 2014 06:53:40 +0000 (15:53 +0900)]
doc: Remove unneeded "SEE ALSO" part in lxc-ls(1)

The old version of lxc-ls is the wrapper of ls(1). But now it is
python script, so "see also ls(1)" is not needed.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoSupport large bdevs on 32-bit; MB units by default.
Stephen Ayotte [Thu, 2 Jan 2014 19:30:26 +0000 (14:30 -0500)]
Support large bdevs on 32-bit; MB units by default.

Change all instances of "unsigned long" where referring to a bdev size
to uint64_t; this fixes some overflows on 32-bit machines, where
"unsigned long" is uint32_t. Support all unit-sizes supported by LVM
except 's' and 'e' [bkmgt]. Print a warning and use default bdev-size if
invalid unit-size specified.

Signed-off-by: Stephen Ayotte <stephen.ayotte@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ls.sgml.in: fix the format issue
Qiang Huang [Wed, 8 Jan 2014 09:11:20 +0000 (17:11 +0800)]
lxc-ls.sgml.in: fix the format issue

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotravis: Use NOTICE instead of PRIVMSG on IRC
Stéphane Graber [Tue, 7 Jan 2014 17:14:15 +0000 (12:14 -0500)]
travis: Use NOTICE instead of PRIVMSG on IRC

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoMove pkg-config init to way earlier
Stéphane Graber [Tue, 7 Jan 2014 16:24:36 +0000 (11:24 -0500)]
Move pkg-config init to way earlier

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: add perl-base to prerequisities
Jiri Slaby [Fri, 20 Sep 2013 14:39:50 +0000 (16:39 +0200)]
lxc-opensuse: add perl-base to prerequisities

It is needed by insserv-compat.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconfigure: find seccomp using pkg-config
Jiri Slaby [Wed, 24 Apr 2013 08:46:21 +0000 (10:46 +0200)]
configure: find seccomp using pkg-config

On suse we have the header in a subdir inside /usr/include, so
pkgconfig has to be used to find out proper CFLAGS.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoman: Fix comment syntax
Stéphane Graber [Tue, 7 Jan 2014 15:26:16 +0000 (10:26 -0500)]
man: Fix comment syntax

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxclock: fix stupid scope error
Serge Hallyn [Tue, 7 Jan 2014 15:20:25 +0000 (09:20 -0600)]
lxclock: fix stupid scope error

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxclock: fall back to /tmp if xdg_rundir is not writeable
Serge Hallyn [Tue, 7 Jan 2014 05:39:02 +0000 (23:39 -0600)]
lxclock: fall back to /tmp if xdg_rundir is not writeable

This happens for instance if you run a test under sudo which
then runs lxc commands under 'su - <someuser>'

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese lxc-stop(1), lxc.conf(5), lxc-start-ephemeral(1)
KATOH Yasufumi [Tue, 7 Jan 2014 12:54:15 +0000 (21:54 +0900)]
doc: Update Japanese lxc-stop(1), lxc.conf(5), lxc-start-ephemeral(1)

* nokill option of lxc-stop (commit 84fbfcb434f5a59680b7f017bbc1d0db0b81a39d)
* lxc.haltsignal in lxc.conf (commit f0f1d8c076ae93d8ecf735c2eeae471e27ca6abd)
* fix sgml (commit d438f5a0ef0f304917e227405d26aef6e7b30303)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoSetting lxc.console = none causes startup failures for the containers that runs in...
S.Çağlar Onur [Mon, 6 Jan 2014 21:01:10 +0000 (16:01 -0500)]
Setting lxc.console = none causes startup failures for the containers that runs in user namespace

Setting "lxc.console = none" causes following failure during startup

      lxc-start 1389039861.061 INFO     lxc_start_ui - using rcfile lxcpath/original/config
      lxc-start 1389039861.062 INFO     lxc_confile - read uid map: type u nsid 0 hostid 260000 range 10000
      lxc-start 1389039861.062 INFO     lxc_confile - read uid map: type g nsid 0 hostid 260000 range 10000
      lxc-start 1389039861.062 WARN     lxc_log - lxc_log_init called with log already initialized
      lxc-start 1389039861.065 INFO     lxc_lsm - LSM security driver AppArmor
      lxc-start 1389039861.066 DEBUG    lxc_conf - allocated pty '/dev/pts/0' (5/6)
      lxc-start 1389039861.066 DEBUG    lxc_conf - allocated pty '/dev/pts/7' (7/8)
      lxc-start 1389039861.066 DEBUG    lxc_conf - allocated pty '/dev/pts/8' (9/10)
      lxc-start 1389039861.066 DEBUG    lxc_conf - allocated pty '/dev/pts/9' (11/12)
      lxc-start 1389039861.066 INFO     lxc_conf - tty's configured
      lxc-start 1389039861.066 DEBUG    lxc_start - sigchild handler set
      lxc-start 1389039861.066 ERROR    lxc_conf - Error chowning
      lxc-start 1389039861.066 ERROR    lxc_conf - Failed to chown
      lxc-start 1389039861.066 ERROR    lxc_start - Failed to shift tty into container
      lxc-start 1389039861.066 ERROR    lxc_start - failed to initialize the container
      lxc-start 1389039861.067 INFO     lxc_monitor - using monitor sock name lxc/0863ffed81827105/lxcpath

fix it by checking the console.name before using it.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodisable generating documentation for travis
S.Çağlar Onur [Mon, 6 Jan 2014 20:05:24 +0000 (15:05 -0500)]
disable generating documentation for travis

doxygen and graphviz causes travis vm to download ~400 MB from internet
and causes travis builds to timeouts occasionally.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoallow multiple types of init scripts to be configured
Dwight Engen [Mon, 6 Jan 2014 19:05:12 +0000 (14:05 -0500)]
allow multiple types of init scripts to be configured

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconfigure.ac: add docbook-to-man to dbparsers
Qiang Huang [Mon, 6 Jan 2014 02:53:15 +0000 (10:53 +0800)]
configure.ac: add docbook-to-man to dbparsers

Debian and Ubuntu uses docbook2x-man, but some other distr like suse
uses docbook-to-man. I think all of them should work on LXC.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd lxc.haltsignal for soft shutdown
Dwight Engen [Mon, 6 Jan 2014 17:30:02 +0000 (12:30 -0500)]
add lxc.haltsignal for soft shutdown

- use this in the busybox template since busybox's init expects
  to receive SIGUSR1 to halt

- fix lxc.stopsignal to be output by write_config so lxcapi_clone()
  and lxcapi_save_config() will output it

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoUse the cgroup name for cpuset for lxc-ps
Nick Huber [Tue, 31 Dec 2013 20:05:50 +0000 (12:05 -0800)]
Use the cgroup name for cpuset for lxc-ps

On my Ubuntu 13.10 system, lxc-ps was always giving empty output. The
output of /proc/$initpid/cgroup was

11:name=systemd:/user/1000.user/c3.session
10:hugetlb:/container
9:perf_event:/container
8:blkio:/container
7:freezer:/container
6:devices:/container
5:memory:/container
4:cpuacct:/container
3:cpu:/container
2:cpuset:/container

Using the cpuset line should be a safer option.

Signed-off-by: Nick Huber <nicholashuber@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-start-ephemeral: fix the man page
Qiang Huang [Mon, 6 Jan 2014 03:33:38 +0000 (11:33 +0800)]
lxc-start-ephemeral: fix the man page

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agorename lxc-stop shutdown argument to nokill
Dwight Engen [Fri, 3 Jan 2014 19:36:43 +0000 (14:36 -0500)]
rename lxc-stop shutdown argument to nokill

This makes the arguments between lxc-stop and lxc-autostart more
consistent, so that --shutdown doesn't have two different meanings.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update man pages to the latest information
KATOH Yasufumi [Mon, 6 Jan 2014 09:05:39 +0000 (18:05 +0900)]
doc: Update man pages to the latest information

* lxc-attach(1): Update to the status of kernel 3.8 or higher
* lxc-create(1), lxc-destroy(1): Now lxc-ls don't have "-l" option, so remove
* lxc(7): update description of lxc-ls and lxc-info to current version
* see-also: fix lxc(1) to lxc(7)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese lxc-autostart(1)
KATOH Yasufumi [Mon, 6 Jan 2014 05:45:55 +0000 (14:45 +0900)]
doc: Update Japanese lxc-autostart(1)

Update for commit a771fe18d28890cfc545995fb818aa7472744fde

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocheck pthread_atfork and thread-local storage
S.Çağlar Onur [Sat, 4 Jan 2014 05:00:04 +0000 (00:00 -0500)]
check pthread_atfork and thread-local storage

Add pthread_atfork check to configure.ac and uses it when necessary,
Introduces tls.m4 macro for checking thread-local storage support, Puts
values array into thread-local storage
(lxc_global_config_value@src/lxc/utils.c), Removes
static_lock/static_unlock from LXC code.

Lastly, it introduces a warning for bionic users about multithreaded
usage of LXC.

(requires 64b1be2903078ef9e9ba3ffcbc30a4dc9bc5cc6c to be reverted first)

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoRevert "Revert "Use pthread_atfork() to unlock mutexes after fork()""
Stéphane Graber [Mon, 6 Jan 2014 14:45:18 +0000 (09:45 -0500)]
Revert "Revert "Use pthread_atfork() to unlock mutexes after fork()""

This reverts commit 64b1be2903078ef9e9ba3ffcbc30a4dc9bc5cc6c.

Reverting in preparation for another implementation which is
bionic-compatible.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd lxc-autostart support for sysv init systems
Dwight Engen [Tue, 31 Dec 2013 19:21:55 +0000 (14:21 -0500)]
add lxc-autostart support for sysv init systems

This change updates the way init scripts get installed so that more
than one init system can be supported. Instead of installing the
systemd service file from the spec file, it should be installed at
make install time, so that someone compiling from source also gets
the unit file installed.

Update the plamo template to use a lock file not named just
/var/lock/subsys/lxc since the presence of that file is used by
sysv init rc file to know if it should run the K01lxc script. This
also makes it consistent with the other templates which use
/var/lock/subsys/lxc-$template-name.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agosnapshot: enforce keeping same backing store type (v2)
Serge Hallyn [Wed, 1 Jan 2014 19:43:35 +0000 (13:43 -0600)]
snapshot: enforce keeping same backing store type (v2)

Stéphane noticed that lxc-snapshot of a dir-backed container
created an overlayfs container.  The expectation is that the
user can continue to modify the original container and later make
a new snapshot, but this doesn't work with the existing behavior -
the overlayfs clone will end up with the modified contents.

So add a 'LXC_CLONE_KEEPBDEVTYPE' flag, which c->snapshot()
passes to c->clone().

Also add a LXC_CLONE_MAYBE_SNAPSHOT.  If this is set and a
backing store does not support snapshotting, then proceed with
a copy clone.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agochange lxc-autostart shutdown to behave like lxc-stop
Dwight Engen [Tue, 31 Dec 2013 19:21:49 +0000 (14:21 -0500)]
change lxc-autostart shutdown to behave like lxc-stop

It is desirable to have a mode where a soft shutdown is requested,
but then do a hard shutdown if after some time period the container
has not shut down. This the default behaviour of lxc-stop, but is
not currently possible with lxc-autostart. This change makes this
the default behaviour when shutdown is specified to lxc-autostart.
This will be very useful for init scripts.

An indefinte wait for soft shutdown (though I'm not sure how that
would be useful) is still possible by passing a timeout of 0.

Change default timeout value to 60 seconds to match lxc-stop

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdditional logic for dealing with container shutdown / reboot
Michael H. Warfield [Sat, 28 Dec 2013 17:35:05 +0000 (12:35 -0500)]
Additional logic for dealing with container shutdown / reboot

Additional logic for dealing with container shutdown / reboot

Fix a problem with CentOS containers and legacy Fedora (<16) containers
not shutting down or rebooting properly.  Copy /etc/init.d/halt to
/etc/init.d/lxc-halt, deleting everything from the "hwclock save" and
all after and append a force halt or reboot at the end of the new
script, to prevent reexecing init.  Link that script in as
S00lxc-halt in rc0.d and S00lxc-reboot in rc6.d to intercept the
shutdown process before it gets to S01halt / S01reboot causing the hang.

Fixed some typos in the CentOS template that were introduced in the
previous patch for hwaddr settings and missed in regression testing.

Cleaned up some instruction typos and tabs from previous patch.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoBring static and const to tests too
Andrey Mazo [Wed, 25 Dec 2013 12:03:43 +0000 (16:03 +0400)]
Bring static and const to tests too

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoMark functions as static and arguments/arrays as const where possible
Andrey Mazo [Tue, 24 Dec 2013 17:08:13 +0000 (21:08 +0400)]
Mark functions as static and arguments/arrays as const where possible

Mark most of functions that are used within only one file as static.
After 95ee490bbdb97ab2b4f1dfa63a0a26e0dd1c2f17 it's easy to prove they
are not in public API.
Several arrays and structs are also marked static.
This prevents them from being exported from liblxc.so

List of removed previously exported symbols:
bdevs
btrfs_ops
check_autodev
create_partial
dir_ops
dump_stacktrace
get_mapped_rootid
get_next_index
lock_mutex
loop_ops
lvm_ops
lxc_abort
lxcapi_clone
lxc_attach_drop_privs
lxc_attach_get_init_uidgi
lxc_attach_getpwshell
lxc_attach_remount_sys_pr
lxc_attach_set_environmen
lxc_attach_to_ns
lxc_clear_saved_nics
lxc_config_readline
lxc_devs
lxc_free_idmap
lxc_global_config_value
lxc_poll
lxc_proc_get_context_info
lxc_set_state
lxc_spawn
mk_devtmpfs
mount_check_fs
ongoing_create
overlayfs_destroy
overlayfs_ops
prepend_lxc_header
remove_partial
save_phys_nics
setup_pivot_root
signames
static_mutex
thread_mutex
unlock_mutex
unpriv_assign_nic
zfs_ops

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoRevert "Use pthread_atfork() to unlock mutexes after fork()"
Serge Hallyn [Thu, 2 Jan 2014 15:40:16 +0000 (09:40 -0600)]
Revert "Use pthread_atfork() to unlock mutexes after fork()"

This reverts commit 84e9e197933e601b66480da578b92630ebedfc72, because
it breaks bionic builds.  The patch is desirable so hopefully we can
come up with a solution or alternate patch soon.

10 years agodoc: Improve Japanese man pages
KATOH Yasufumi [Fri, 27 Dec 2013 16:35:22 +0000 (01:35 +0900)]
doc: Improve Japanese man pages

* Improve Japanese translation
* Fix mis-translation
* Insert linefeed between paragraph, because some paragraph is too
  long, so sometimes git send-email could not use.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoUse pthread_atfork() to unlock mutexes after fork()
Andrey Mazo [Mon, 30 Dec 2013 11:06:25 +0000 (15:06 +0400)]
Use pthread_atfork() to unlock mutexes after fork()

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadjust include statements (v2)
S.Çağlar Onur [Wed, 25 Dec 2013 19:27:11 +0000 (14:27 -0500)]
adjust include statements (v2)

Use "#include <somefile.h>" style for external or exported headers only.

changes since v1:
 - adjusted formatting as Stéphane suggested

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agotravis: Configure notifications
Stéphane Graber [Wed, 25 Dec 2013 16:36:19 +0000 (17:36 +0100)]
travis: Configure notifications

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotravis: Enable tests and add missing dependencies
Stéphane Graber [Wed, 25 Dec 2013 16:24:10 +0000 (17:24 +0100)]
travis: Enable tests and add missing dependencies

 - Add doxygen and graphviz for the API doc build.
 - Pass --enable-tests to have the tests built (off by default)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix version checking typos in Fedora template.
Michael H. Warfield [Thu, 19 Dec 2013 16:37:24 +0000 (11:37 -0500)]
Fix version checking typos in Fedora template.

Backported typo fixes from CentOS template back to Fedora Template
Bumped default rev from Fedora 18 to Fedora 19

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix version checking and deal with pam_loginuid in CentOS template.
Michael H. Warfield [Thu, 19 Dec 2013 16:36:08 +0000 (11:36 -0500)]
Fix version checking and deal with pam_loginuid in CentOS template.

This deals with a reported issue when running and building containers
on a CentOS host system.

Fixed various typos in version checking when running on a CentOS system.
Added logic for differences between point releases (6.5) and rolling (6).
Added version detection logic when running on RHEL systems as well.
Fixed cpe detection string (CentOS is not adhering to their own registration).
Added logic to disable the pam_loginuid.so binary in containers.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoRemove unused functions
Andrey Mazo [Tue, 24 Dec 2013 17:08:14 +0000 (21:08 +0400)]
Remove unused functions

After 95ee490bbdb97ab2b4f1dfa63a0a26e0dd1c2f17 they are not in public
API and are not used throughout the lxc codebase.
This has a bonus of removing workaround for bionic.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAllow use of public API from C++
Andrey Mazo [Tue, 24 Dec 2013 17:08:12 +0000 (21:08 +0400)]
Allow use of public API from C++

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoplamo: Improve template for lxc-stop
KATOH Yasufumi [Wed, 25 Dec 2013 04:45:24 +0000 (13:45 +0900)]
plamo: Improve template for lxc-stop

patch /etc/inittab in plamo container to shutdown when it receives SIGPWR.
(By default, plamo shutdowns to single user mode after 5minutes)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd travis-ci support to LXC github repo (v2)
S.Çağlar Onur [Tue, 24 Dec 2013 19:04:10 +0000 (14:04 -0500)]
add travis-ci support to LXC github repo (v2)

Travis is a free hosted CI platform for the open source community. It integrates
well with github and enables continous builds/tests for both repository itself
and all the pull requests so that one can quickly see the result of the possible
merge.

This yml file is one of the few required steps to enable travis-ci support for
LXC github repo. One of you guys still need to sign in travis-ci through GitHub OAuth
and enable travis support from its profile page https://travis-ci.org/profile

As an example https://travis-ci.org/caglar10ur/lxc-upstream/builds/15872074 can be seen

changes since v1;
 - All external dependencies are now innstalled via before_install section
 - Dropped all configure flags as Stéphane suggested

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-autostart: don't set timeout if user requested -s
KATOH Yasufumi [Tue, 24 Dec 2013 14:33:04 +0000 (23:33 +0900)]
lxc-autostart: don't set timeout if user requested -s

same as the commit 25070b660187b61aa4e969db01b55d1360639543

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: make sure not to close file handle twice
Serge Hallyn [Tue, 24 Dec 2013 16:03:43 +0000 (10:03 -0600)]
coverity: make sure not to close file handle twice

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoUse getmntent_r() for thread-safety
Andrey Mazo [Tue, 24 Dec 2013 10:44:54 +0000 (14:44 +0400)]
Use getmntent_r() for thread-safety

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoRemove process_lock() except where actually needed
Andrey Mazo [Tue, 24 Dec 2013 10:44:53 +0000 (14:44 +0400)]
Remove process_lock() except where actually needed

Functions like open(), close(), socket(), socketpair(), pipe() and mkdir()
are generally thin wrappers around kernel-provided system calls.
It's the kernel not libc, who ensures race-free handling of file
descriptors.
Thus locking around these functions is unnecessary even on somewhat buggy libcs.

fopen(), fclose() and other stdio functions may maintain internal lists
of open file handles and thus can be prone to race-conditions.
Hopefully, most libcs utilize proper locking or other ways to ensure
thread-safety of these functions.
Bionic used to have non-thread-safe stdio [2] but that must be fixed
since android 4.3 [3, 4].

S.Çağlar Onur showed [1] that openpty() (because of nsswitch) is not thread-safe though.
So we workaround it by protecting openpty() calls with process_lock()/process_unlock().

Because of the need to guard openpty() with process_lock()/process_unlock(),
process_unlock() is still used after fork().

This commit reverts most of 025ed0f3911836b71f498d8368725c77a7e1932a.

[1] https://github.com/lxc/lxc/pull/106#issuecomment-31077269
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=687367
[3] https://android.googlesource.com/platform/bionic/+/f582340a6a48588aa50da17e1620e8f91b146941
[4] https://android.googlesource.com/platform/bionic/+/6b3f49a5374305ce9690c3c5ca2aadc90f54c521

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Fix the description of -n option in lxc-info(1)
KATOH Yasufumi [Tue, 24 Dec 2013 06:56:23 +0000 (15:56 +0900)]
doc: Fix the description of -n option in lxc-info(1)

Commit 5444216 revised -n option from allowing to specify multiple
containers using regex to specifying only one container. But
lxc-info(1) remains original. so
- mark -n required
- remove the description of -n that is included in common options

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese lxc-stop(1) for -s option
KATOH Yasufumi [Tue, 24 Dec 2013 04:46:35 +0000 (13:46 +0900)]
doc: Update Japanese lxc-stop(1) for -s option

Update for commit 25070b660187b61aa4e969db01b55d1360639543

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconfigure: Disable python3 builds with clang
Stéphane Graber [Mon, 23 Dec 2013 21:11:58 +0000 (22:11 +0100)]
configure: Disable python3 builds with clang

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoconfigure: Add GnuTLS to configure overview
Stéphane Graber [Mon, 23 Dec 2013 21:12:17 +0000 (22:12 +0100)]
configure: Add GnuTLS to configure overview

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix invalid free() in lxc_global_config_value().
Andrey Mazo [Mon, 23 Dec 2013 17:17:10 +0000 (21:17 +0400)]
Fix invalid free() in lxc_global_config_value().

Commit 4878dac496543dae0a26f5c1156bbfda63c8ea62 introduced possible
incorrect usage of free().
Also remove unneeded strdup().

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoRevert "coverity-detected bug: don't free "/""
Serge Hallyn [Mon, 23 Dec 2013 18:32:23 +0000 (12:32 -0600)]
Revert "coverity-detected bug: don't free "/""

This reverts commit 5cad2f04bec614a84e872f68697b5092a409d5a1.

10 years agoRevert "remove static_lock()/static_unlock() and start to use thread local storage...
Serge Hallyn [Mon, 23 Dec 2013 18:27:32 +0000 (12:27 -0600)]
Revert "remove static_lock()/static_unlock() and start to use thread local storage (v2)"

This reverts commit 95b422fccfed6e6f5973c768c0cfdbca65c68e67.

Conflicts:
src/lxc/utils.c

10 years agocoverity-detected bug: don't free "/"
Serge Hallyn [Mon, 23 Dec 2013 17:14:58 +0000 (11:14 -0600)]
coverity-detected bug: don't free "/"

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-stop: don't set timeout if user requested -s
Serge Hallyn [Mon, 23 Dec 2013 16:23:38 +0000 (10:23 -0600)]
lxc-stop: don't set timeout if user requested -s

A timeout means wait this long before killing the container.
-s means don't kill the container.  timeout defaults to 60
seconds.  So if a shutdown is requested, then set timeout to
0.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoSet default paths for unprivileged use (v2)
Stéphane Graber [Fri, 20 Dec 2013 13:28:32 +0000 (14:28 +0100)]
Set default paths for unprivileged use (v2)

When running unprivileged (euid != 0), LXC will now use the following paths:
 - Default lxc path: ~/.local/share/lxc/
 - Default config path: ~/.config/lxc/lxc.conf

Those two paths are based on standard XDG paths (though ignoring all the
possible override paths for now at least) and so probably don't need to
be configurable at build time.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoremove LXC_CLONE_COPYHOOKS and make lxcapi_clone to copy hooks unconditionally (v3)
S.Çağlar Onur [Sat, 21 Dec 2013 19:48:41 +0000 (14:48 -0500)]
remove LXC_CLONE_COPYHOOKS and make lxcapi_clone to copy hooks unconditionally (v3)

changes since v1;
incorporated Serge's changes
changes since v2;
added missing Signed-off-by

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoplamo: Update template since rc script of plamo was updated
KATOH Yasufumi [Sun, 22 Dec 2013 12:02:05 +0000 (21:02 +0900)]
plamo: Update template since rc script of plamo was updated

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Improve Japanese translation of lxc-stop(1)
KATOH Yasufumi [Sat, 21 Dec 2013 12:00:18 +0000 (21:00 +0900)]
doc: Improve Japanese translation of lxc-stop(1)

Signed-off-by: Kouhei Maeda <mkouhei@gmail.com>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix coverity-detected memory leak
Stéphane Graber [Fri, 20 Dec 2013 15:09:07 +0000 (16:09 +0100)]
Fix coverity-detected memory leak

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Add Japanese lxc-autostart(1) and update lxc.conf(5)
KATOH Yasufumi [Fri, 20 Dec 2013 12:27:45 +0000 (21:27 +0900)]
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>
10 years agoconf.c: fix unprivileged network case
Serge Hallyn [Thu, 19 Dec 2013 21:33:22 +0000 (15:33 -0600)]
conf.c: fix unprivileged network case

If unprivileged users are using a veth nic, then ifindex is still 0
at lxc_assign_network() (because lxc_create_network() was skipped).
So check for that case before we use lxc->ifindex to decide if we
have an empty network namespace.

We probably should change the !netdev->ifindex check to a
netdev->type == LXC_NET_EMPTY check, but I've been making enough
mistakes today not to risk that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgroup: don't set clone_children when it is already 1
Serge Hallyn [Thu, 19 Dec 2013 21:18:24 +0000 (15:18 -0600)]
cgroup: don't set clone_children when it is already 1

In particular, if it's already 1, and we can't change it, we currently
fail out.  That's silly.

I was going to just always continue, but if clone_children is not 1,
then the container *will* fail to start later on, so I'd rather stop
earlier on so the original cause doesn't get lost in the noise.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoCatch the python packages when building them.
Michael H. Warfield [Thu, 19 Dec 2013 16:38:53 +0000 (11:38 -0500)]
Catch the python packages when building them.

If we have "with_python" we want to add the resulting packages to
the resulting rpm.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd lxc-autostart
Stéphane Graber [Mon, 16 Dec 2013 20:32:47 +0000 (15:32 -0500)]
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>
10 years agolxc-ls: Add workaround for nested containers
Stéphane Graber [Mon, 16 Dec 2013 20:09:07 +0000 (15:09 -0500)]
lxc-ls: Add workaround for nested containers

When accessing nested containers, hardcode the path to their config.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-ls: Add lxc.start.auto and lxc.group support
Stéphane Graber [Mon, 16 Dec 2013 19:51:37 +0000 (14:51 -0500)]
lxc-ls: Add lxc.start.auto and lxc.group support

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoautostart: Define lxc.start.* and lxc.group
Stéphane Graber [Sun, 22 Sep 2013 01:30:06 +0000 (21:30 -0400)]
autostart: Define lxc.start.* and lxc.group

First patch in the set of changes required for container autostart.

This commit adds the new configuration keys and parsers that will then
be used by lxc-start and lxc-stop.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
10 years agofix lxc-usernsexec regression
Serge Hallyn [Thu, 19 Dec 2013 19:59:30 +0000 (13:59 -0600)]
fix lxc-usernsexec regression

In what should have been a straightforward fix for a bug found by
priority, I sent 1 instead of '1' from parent to child, while the
child checked for '1'.  Fix.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoremove static_lock()/static_unlock() and start to use thread local storage (v2)
S.Çağlar Onur [Thu, 19 Dec 2013 05:08:51 +0000 (00:08 -0500)]
remove static_lock()/static_unlock() and start to use thread local storage (v2)

While testing https://github.com/lxc/lxc/pull/106, I found that concurrent starts
are hanging time to time. I then reproduced the same problem in master and got following;

 [caglar@oOo:~] sudo gdb -p 16221
 (gdb) bt
 #0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
 #1  0x00007f495526515c in _L_lock_982 () from /lib/x86_64-linux-gnu/libpthread.so.0
 #2  0x00007f4955264fab in __GI___pthread_mutex_lock (mutex=0x7f49556d4600 <static_mutex>) at pthread_mutex_lock.c:64
 #3  0x00007f49554b27a6 in lock_mutex (l=l@entry=0x7f49556d4600 <static_mutex>) at lxclock.c:78
 #4  0x00007f49554b2dac in static_lock () at lxclock.c:330
 #5  0x00007f4955498f71 in lxc_global_config_value (option_name=option_name@entry=0x7f49554c02cf "cgroup.use") at utils.c:273
 #6  0x00007f495549926c in default_cgroup_use () at utils.c:366
 #7  0x00007f49554953bd in lxc_cgroup_load_meta () at cgroup.c:94
 #8  0x00007f495548debc in lxc_spawn (handler=handler@entry=0x7f49200af300) at start.c:783
 #9  0x00007f495548e7a7 in __lxc_start (name=name@entry=0x7f49200b48a0 "lxc-test-concurrent-4", conf=conf@entry=0x7f49200b2030, ops=ops@entry=0x7f49556d3900 <start_ops>, data=data@entry=0x7f495487db90,
    lxcpath=lxcpath@entry=0x7f49200b2010 "/var/lib/lxc") at start.c:951
 #10 0x00007f495548eb9c in lxc_start (name=0x7f49200b48a0 "lxc-test-concurrent-4", argv=argv@entry=0x7f495487dbe0, conf=conf@entry=0x7f49200b2030, lxcpath=0x7f49200b2010 "/var/lib/lxc") at start.c:1048
 #11 0x00007f49554b68f1 in lxcapi_start (c=0x7f49200b1dd0, useinit=<optimized out>, argv=0x7f495487dbe0) at lxccontainer.c:648
 #12 0x0000000000401317 in do_function (arguments=0x1aa80b0) at concurrent.c:94
 #13 0x0000000000401499 in concurrent (arguments=<optimized out>) at concurrent.c:130
 #14 0x00007f4955262f6e in start_thread (arg=0x7f495487e700) at pthread_create.c:311
 #15 0x00007f4954f8d9cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

It looks like both parent and child end up with locked mutex thus deadlocks.

I ended up placing values in the thread local storage pool, instead of doing "unlock the lock in the child" dance

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agosshd: Don't bind-mount /sbin/init read-write
Stéphane Graber [Wed, 18 Dec 2013 22:06:25 +0000 (23:06 +0100)]
sshd: Don't bind-mount /sbin/init read-write

lxc-sshd was mounting itself (the template script) as /sbin/init in the
container using a writable bind-mount.

This shouldn't be needed and could lead to quite a few problems should
one of those containers overwrite /sbin/init for some reason.

Instead simply move to a read-only bind-mount which should prevent any
accidental dammage.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd Japanese man pages for lxc-user-nic
KATOH Yasufumi [Wed, 18 Dec 2013 07:25:45 +0000 (16:25 +0900)]
Add Japanese man pages for lxc-user-nic

Update for commit df3415e02282317348bbd5f9ce66d03e1c81eeec

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>