]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
10 years agotests: Fix shutdown test
Stéphane Graber [Fri, 24 Jan 2014 02:16:48 +0000 (21:16 -0500)]
tests: Fix shutdown test

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Speed up lxc-test-usernic
Stéphane Graber [Fri, 24 Jan 2014 01:45:27 +0000 (20:45 -0500)]
tests: Speed up lxc-test-usernic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Tweak lxc-test-ubuntu to be faster
Stéphane Graber [Fri, 24 Jan 2014 01:43:51 +0000 (20:43 -0500)]
tests: Tweak lxc-test-ubuntu to be faster

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Rework lxc-test-usernic
Stéphane Graber [Fri, 24 Jan 2014 01:08:37 +0000 (20:08 -0500)]
tests: Rework lxc-test-usernic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Fix cleanup in lxc-test-unpriv
Stéphane Graber [Fri, 24 Jan 2014 01:04:39 +0000 (20:04 -0500)]
tests: Fix cleanup in lxc-test-unpriv

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Update lxc-test-unpriv
Stéphane Graber [Thu, 23 Jan 2014 22:56:59 +0000 (17:56 -0500)]
tests: Update lxc-test-unpriv

Update lxc-test-unpriv to be a bit simpler and more reliable.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoget_mapped_rootid: fix description
Serge Hallyn [Thu, 23 Jan 2014 20:51:36 +0000 (14:51 -0600)]
get_mapped_rootid: fix description

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoget_mapped_rootid: avoid using (uid_t) -1
Serge Hallyn [Thu, 23 Jan 2014 20:48:28 +0000 (14:48 -0600)]
get_mapped_rootid: avoid using (uid_t) -1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-clone: support unprivileged use
Serge Hallyn [Thu, 23 Jan 2014 00:18:04 +0000 (18:18 -0600)]
lxc-clone: support unprivileged use

This also fixes unprivileged use of lxc-snapshot and lxc-rename.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgm_get: support NULL value
Serge Hallyn [Thu, 23 Jan 2014 19:35:50 +0000 (13:35 -0600)]
cgm_get: support NULL value

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoDrop runapitests.sh
Stéphane Graber [Thu, 23 Jan 2014 18:51:36 +0000 (13:51 -0500)]
Drop runapitests.sh

This script is outdated and unused.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRevert "cgroupfs: support older kernels without cgroup.clone_children"
Serge Hallyn [Thu, 23 Jan 2014 19:03:11 +0000 (13:03 -0600)]
Revert "cgroupfs: support older kernels without cgroup.clone_children"

This reverts commit 0a4d93787d4be78dc5e2873cf7c605c01d383792.

10 years agoRevert "bionic: Replace rindex by strrchr"
Serge Hallyn [Thu, 23 Jan 2014 19:03:05 +0000 (13:03 -0600)]
Revert "bionic: Replace rindex by strrchr"

This reverts commit 86f0eb65a0abc651c656ff602b823ba693f675c5.

10 years agoRevert "cgroup.c: clean up for handle_cgroup_settings"
Serge Hallyn [Thu, 23 Jan 2014 19:02:25 +0000 (13:02 -0600)]
Revert "cgroup.c: clean up for handle_cgroup_settings"

This reverts commit 032e28b7675fd03dc19c7af0182ddb93807c2f96.

10 years agoRevert "cgroupfs: get rid of the redundant error info"
Serge Hallyn [Thu, 23 Jan 2014 19:02:15 +0000 (13:02 -0600)]
Revert "cgroupfs: get rid of the redundant error info"

This reverts commit a8117b3361c9caf1397f4dc9bbb5e6de3af3cdff.

10 years agoRevert "cgroupfs: need the full path to setup cpuset"
Serge Hallyn [Thu, 23 Jan 2014 19:02:08 +0000 (13:02 -0600)]
Revert "cgroupfs: need the full path to setup cpuset"

This reverts commit 47f5ede0ec09b393779a7755aa36dc665e2e8fa5.

10 years agodoc: Add manpage for lxc-config
Stéphane Graber [Thu, 23 Jan 2014 16:38:47 +0000 (11:38 -0500)]
doc: Add manpage for lxc-config

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroupfs: need the full path to setup cpuset
Qiang Huang [Thu, 23 Jan 2014 06:56:54 +0000 (14:56 +0800)]
cgroupfs: need the full path to setup cpuset

Function file_exists() needs a absolute full path, but we are using
current_entire_path which is not. It will get the wrong result from
file_exists() and case Segmentation fault when we fopen a non-exist
file and try to fscanf from it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroupfs: get rid of the redundant error info
Qiang Huang [Thu, 23 Jan 2014 07:16:25 +0000 (15:16 +0800)]
cgroupfs: get rid of the redundant error info

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Add Japanese lxc.container.conf(5), lxc.system.conf(5) and update lxc.conf(5)
KATOH Yasufumi [Thu, 23 Jan 2014 10:56:41 +0000 (19:56 +0900)]
doc: Add Japanese lxc.container.conf(5), lxc.system.conf(5) and update lxc.conf(5)

* update for commit 55fc19a1042bca36ae431cb4a51c2abc0ca4d801
* fix typo in English lxc.system.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.coM>
10 years agocgroup.c: clean up for handle_cgroup_settings
Qiang Huang [Mon, 20 Jan 2014 08:37:06 +0000 (16:37 +0800)]
cgroup.c: clean up for handle_cgroup_settings

Clean up the nesting if, make the logic similar for memory
and cpuset, and the error message should sent from inside,
for better extendibility.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Try to clear some confusion about lxc.conf
Stéphane Graber [Wed, 22 Jan 2014 21:13:24 +0000 (16:13 -0500)]
doc: Try to clear some confusion about lxc.conf

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start-ephemeral: require root
Stéphane Graber [Thu, 23 Jan 2014 01:33:21 +0000 (20:33 -0500)]
lxc-start-ephemeral: require root

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_init: don't fail on bad signals
Serge Hallyn [Thu, 23 Jan 2014 02:49:55 +0000 (20:49 -0600)]
lxc_init: don't fail on bad signals

Changelog: Jan 22: as Michael Warfield pointed out, we should only
ignore EINVAL, since EFAULT points to a more serious problem.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobionic: Replace rindex by strrchr
Stéphane Graber [Thu, 23 Jan 2014 02:25:05 +0000 (21:25 -0500)]
bionic: Replace rindex by strrchr

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgroupfs: support older kernels without cgroup.clone_children
Serge Hallyn [Wed, 22 Jan 2014 16:49:00 +0000 (10:49 -0600)]
cgroupfs: support older kernels without cgroup.clone_children

When creating a cgroup, detect whether cgroup.clone_children
exists.  If not, then manually copy the parent's cpuset.cpus
and cpuset.mems values.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoplamo: Improve template
KATOH Yasufumi [Wed, 22 Jan 2014 17:29:42 +0000 (02:29 +0900)]
plamo: Improve template

allow not to specify a variable that is related installed packages

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 agodaemon: fix the wrong pid in daemon model
Qiang Huang [Wed, 22 Jan 2014 04:11:38 +0000 (12:11 +0800)]
daemon: fix the wrong pid in daemon model

When you start a container in daemon model, you have at least
3 processes:
 1. The command the user start (lxc-start -d)
 2. The backgrounded fork of that command after start() is done
 3. The container init process

In PID file, we need (2), but currently we are writing (1),
this is wrong because (1) exits as soon as the container is
started, it's complately useless.

So we write pid after daemonize, so that we'll always write
the right pid to PID file.

Reported-by: Stephane Graber <stgraber@ubuntu.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start: store PID file to lxc_container
Qiang Huang [Wed, 22 Jan 2014 04:11:37 +0000 (12:11 +0800)]
lxc-start: store PID file to lxc_container

So we can remove PID file untill lxc_container_free.

This also fix bug: https://github.com/lxc/lxc/issues/89

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoapi_start: don't get a container reference for the daemonized case
Serge Hallyn [Sun, 19 Jan 2014 18:17:42 +0000 (12:17 -0600)]
api_start: don't get a container reference for the daemonized case

In the daemonized case we will fork, so the anonymous container memlock
will not be shared between parent and child.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix handling of empty config keys
Stéphane Graber [Wed, 22 Jan 2014 22:14:10 +0000 (17:14 -0500)]
Fix handling of empty config keys

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: cgm_set: return the length we found
Serge Hallyn [Wed, 22 Jan 2014 19:53:04 +0000 (13:53 -0600)]
cgmanager: cgm_set: return the length we found

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc.spec: package bash completion, lxc-monitord move
Dwight Engen [Wed, 22 Jan 2014 19:56:21 +0000 (14:56 -0500)]
lxc.spec: package bash completion, lxc-monitord move

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxcapi_get_interfaces and lxcapi_get_ips: stricter read check
Serge Hallyn [Wed, 22 Jan 2014 19:16:59 +0000 (13:16 -0600)]
lxcapi_get_interfaces and lxcapi_get_ips: stricter read check

Coverity warns of the danger of a short read otherwise.

(Untested, but should be correct; Tossing over to you :)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Cc: S.Çağlar Onur <caglar@10ur.org>
Acked-by: S.Çağlar Onur <caglar@10ur.org>
10 years agolxc-download: Add interactive mode
Stéphane Graber [Wed, 22 Jan 2014 19:18:01 +0000 (14:18 -0500)]
lxc-download: Add interactive mode

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: free gw when not used
Serge Hallyn [Wed, 22 Jan 2014 19:04:42 +0000 (13:04 -0600)]
coverity: free gw when not used

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: close userns file when done
Serge Hallyn [Wed, 22 Jan 2014 19:02:42 +0000 (13:02 -0600)]
coverity: close userns file when done

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: close netns file when done
Serge Hallyn [Wed, 22 Jan 2014 18:57:53 +0000 (12:57 -0600)]
coverity: close netns file when done

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: setup_limits: return true if there are no settings
Serge Hallyn [Wed, 22 Jan 2014 18:36:18 +0000 (12:36 -0600)]
cgmanager: setup_limits: return true if there are no settings

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-info: Limit information when not running
Stéphane Graber [Wed, 22 Jan 2014 18:09:51 +0000 (13:09 -0500)]
lxc-info: Limit information when not running

Don't try to print the PID, IP addresses or statistics for a container
that's not current running.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoRemove lxc-version, lxc-ps and lxc-netstat
Stéphane Graber [Tue, 21 Jan 2014 17:16:04 +0000 (12:16 -0500)]
Remove lxc-version, lxc-ps and lxc-netstat

lxc-ps and lxc-netstat have an unfortunate tendency to break every so
often, produce mostly unreadable output and should be replaced by a
lxc-attach call in 99% of the cases.

In an effort to cleanup the lxc-* namespace, I think those two should
go, so this patch gets rid of them as well as any reference to them in
our documentation.

I also think that lxc-version should disappear as it's only a one line
shell script printing the version string, so having a whole command just
for that seems to be a bit of a waste.

Instead, this patch introduces a new --version common option which all
binaries will automatically inherit and that'll print LXC_VERSION on
stdout and exit 0.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd bash auto completion
Stéphane Graber [Tue, 21 Jan 2014 04:49:19 +0000 (23:49 -0500)]
Add bash auto completion

This adds a basic bash auto-completion profile.

It supports 3 things at this time:
 - Auto-complete of container name (-n or -o)
 - Auto-complete of template name (-t)
 - Auto-complete of state names (-s)

It's configured in a way to be as little disruptive as possible, any
argument that's not explicitly handled by the profile will fallack to
bash's default completion.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoUnset lxc.devttydir for userns CentOS
Stéphane Graber [Wed, 22 Jan 2014 16:38:59 +0000 (11:38 -0500)]
Unset lxc.devttydir for userns CentOS

Without this, the container entirely fails to start.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoUpdate Fedora and CentOS templates for common conf includes.
Michael H. Warfield [Tue, 21 Jan 2014 16:56:56 +0000 (11:56 -0500)]
Update Fedora and CentOS templates for common conf includes.

This updates the Fedora and CentOS templates to utilize a common
included config.  This is largely based on the changes in the Oracle
template with some exceptions.

Dropping of setpcap (present in the Oracle template) is commented out in
the Fedora template.  It seems to cause problems, such as large login
delays with Fedora 20 containers (but not Fedora 19 - strange).

The Fedora template is further modified to disable systemd-journald.service
as it is unnecessary in a container and causes serious problems when
running in a Fedora 20 container.

The Fedora template is also updated to default to Fedora 20 when running
on a non-Fedora host.

Regards,
Mike

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agomake lxcapi_get_interfaces and lxcapi_get_ips unprivileged container aware
S.Çağlar Onur [Tue, 21 Jan 2014 00:57:28 +0000 (19:57 -0500)]
make lxcapi_get_interfaces and lxcapi_get_ips unprivileged container aware

Based on Stéphane's suggestion, those two API methods now;

* fork a new process,
* switch to appropriate namespace(s),
* do what we want,
* return the data over a pipe to the parent which returns the result to the original caller.

For the whole thread please see;

 https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-January/007362.html

This patch also makes lxc-ls and lxc-info call those functions.

I'm adding Stéphane as an author here since both the idea as well as
the initial setns code come from him.

Author: S.Çağlar Onur <caglar@10ur.org>
Author: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoplamo: Improve template
KATOH Yasufumi [Tue, 21 Jan 2014 07:46:46 +0000 (16:46 +0900)]
plamo: Improve template

Allow to specify additional packages

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 agoremove no-longer neeeded check from lxcapi_attach_run_waitl
S.Çağlar Onur [Tue, 21 Jan 2014 04:43:35 +0000 (23:43 -0500)]
remove no-longer neeeded check from lxcapi_attach_run_waitl

commit f4364484454c754ed905bfb85bd2727a0a5d0475 introduced attach
functionality to unprivileged containers so remove this check like
the rest of the attach functions.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoMove lxc-user-nic and lxc-monitord to libexec
Stéphane Graber [Tue, 21 Jan 2014 02:40:54 +0000 (21:40 -0500)]
Move lxc-user-nic and lxc-monitord to libexec

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoutils: Drop trailing / in lxcpath
Stéphane Graber [Mon, 20 Jan 2014 20:57:16 +0000 (15:57 -0500)]
utils: Drop trailing / in lxcpath

This fixes command line tools and functions which use
lxc_global_config_value o get lxcpath but don't strip the trailing /
leading to mismatching command path (as lxc_container_new does strip the
path).

As lxcpath is typically a const and so can't easily be changed by the
caller, add the trick directly into lxc_global_config_value (having to
juggle a bit in there too to avoid trying to alter a const).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoattach: Support unprivileged containers
Stéphane Graber [Mon, 20 Jan 2014 20:26:15 +0000 (15:26 -0500)]
attach: Support unprivileged containers

This change makes lxc-attach and the matching API functions work
properly with unprivileged containers.

The trick needed to make that possible was to always start with the
userns when attaching and also relocate the cgroup management code so
that the intermediate process is moved to the cgroup before attaching to
the container's namespace as doing so later would fail due to missing
permissions.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing doxygen tag
Stéphane Graber [Tue, 21 Jan 2014 03:01:08 +0000 (22:01 -0500)]
Add missing doxygen tag

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ubuntu-cloud: Default to trying released channel
Dimitri John Ledkov [Fri, 13 Dec 2013 21:41:44 +0000 (21:41 +0000)]
lxc-ubuntu-cloud: Default to trying released channel

This adds a fallback to the daily channel if an image couldn't be found
in the released one.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoDon't forget network prefix information
Robert Vogelgesang [Mon, 20 Jan 2014 17:35:57 +0000 (18:35 +0100)]
Don't forget network prefix information

Include the IPv4/IPv6 prefix if it's set.

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agohandle unprivileged user calls more gracefully (v3)
S.Çağlar Onur [Sun, 19 Jan 2014 20:28:05 +0000 (15:28 -0500)]
handle unprivileged user calls more gracefully (v3)

Return an error if the function is not supposed to be called by an unprivileged user.
Otherwise those calls fail in the middle of their execution with different reasons.

changes since v2:
- am_unpriv is now a simple geteuid check,
- API functions are now providing error messages,
- lxc-info, lxc-attach are now checking geteuidi,
- lxc-ls is now calling get_ips only if the container is running

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agocgmanager: implement setting of cgroup limits
Serge Hallyn [Mon, 20 Jan 2014 15:09:36 +0000 (09:09 -0600)]
cgmanager: implement setting of cgroup limits

Also replace a wrong free of nih-allocated variable with nih_free.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd Japanese lxc-usernsexec(1) and fix typo English lxc-usernsexec(1)
KATOH Yasufumi [Mon, 20 Jan 2014 07:07:46 +0000 (16:07 +0900)]
Add Japanese lxc-usernsexec(1) and fix typo English lxc-usernsexec(1)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Remove the description of lxc-kill in Japanese lxc-execute(1)
KATOH Yasufumi [Mon, 20 Jan 2014 07:07:45 +0000 (16:07 +0900)]
doc: Remove the description of lxc-kill in Japanese lxc-execute(1)

Update for commit 33ddfc2adef00e3571137ef60d20de328e32d299

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoRevert "lxc-start: fix the container leak when daemonize"
Stéphane Graber [Sun, 19 Jan 2014 17:31:57 +0000 (12:31 -0500)]
Revert "lxc-start: fix the container leak when daemonize"

This reverts commit c3f0f139e155f53c83e0a81f14094e9d0f40e8e9.

Done as Serge Hallyn's request:
Nacked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: &existed for remove+create now returns -1 on failure
Serge Hallyn [Sun, 19 Jan 2014 15:17:23 +0000 (09:17 -0600)]
cgmanager: &existed for remove+create now returns -1 on failure

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start: fix the container leak when daemonize
Qiang Huang [Sat, 18 Jan 2014 06:59:58 +0000 (14:59 +0800)]
lxc-start: fix the container leak when daemonize

When start container with daemon model, we'll have a new daemon
process in lxcapi_start, whose c->numthreads is 2, inherited
from his father. Even his father return to main(), the
lxc_container_put won't affect son's numthreads.

So when daemon stops, he should return to main and do
lxc_container_put again, rather than exit and leave the
container alone.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoplamo: Improve template
KATOH Yasufumi [Sat, 18 Jan 2014 13:32:35 +0000 (22:32 +0900)]
plamo: Improve template

* make simple
* change default download site to http://ftp.ring.gr.jp

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 agoDeprecate lxc-checkpoint, lxc-kill and lxc-restart
Stéphane Graber [Fri, 17 Jan 2014 17:56:48 +0000 (12:56 -0500)]
Deprecate lxc-checkpoint, lxc-kill and lxc-restart

Checkpoint/restart isn't currently supported, so let's not carry those
binaries around until we have proper CRIU support in the API.

lxc-kill is redundant with lxc-stop -k and has been known to confuse user.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-usernsexec: add a manpage
Serge Hallyn [Fri, 17 Jan 2014 21:15:45 +0000 (15:15 -0600)]
lxc-usernsexec: add a manpage

and fix the help output in the program

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese lxc-ls(1) for -f and -F option
KATOH Yasufumi [Fri, 17 Jan 2014 08:12:14 +0000 (17:12 +0900)]
doc: Update Japanese lxc-ls(1) for -f and -F option

Update for commit c5afb6e455d9ec00af9f3399836152eaf9d0a4f5

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoinit: Simplify Makefile somehow
Stéphane Graber [Thu, 16 Jan 2014 22:31:05 +0000 (17:31 -0500)]
init: Simplify Makefile somehow

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoapparmor: Add profiles
Stéphane Graber [Thu, 16 Jan 2014 21:27:51 +0000 (16:27 -0500)]
apparmor: Add profiles

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoinit: Add upstart jobs and some more changes (v3)
Stéphane Graber [Thu, 16 Jan 2014 19:13:14 +0000 (14:13 -0500)]
init: Add upstart jobs and some more changes (v3)

This adds the 3 upstart jobs that we've had in Ubuntu for a while:
 - lxc.conf: Main upstart job, triggers lxc-net.conf based on config
 - lxc-instance.conf: Triggered by lxc.conf for each auto-started container
 - lxc-net.conf: Triggered by lxc.conf, sets up lxcbr0, NAT, mangling, ...

In addition, there are two extra config files in /etc/default:
 - lxc: Allows setting some values like http proxying, disabling autostart, ...
 - lxc-net: Network configuration for the lxcbr0 bridge

This change also disables the sysv script for all distros but Oracle as
the current script won't work on either Ubuntu nor Debian and I suspect
quite a few more distros, so it's not nearly as distro-agnostic as we
thought.

For Debian, only install the upstart jobs and systemd unit.
For Ubuntu, only install the upstart jobs.

This change also moves all the init related stuff to config/init/

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Update no-netns for lxc.network.type = none
Stéphane Graber [Thu, 16 Jan 2014 19:53:00 +0000 (14:53 -0500)]
doc: Update no-netns for lxc.network.type = none

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoexclude non-existing signals from the loop
S.Çağlar Onur [Thu, 16 Jan 2014 21:00:08 +0000 (16:00 -0500)]
exclude non-existing signals from the loop

32 and 33 are not defined and causing sigaction to fail. "kill -l" shows following
on my system

 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agopython3: binding update
Stéphane Graber [Thu, 16 Jan 2014 16:49:40 +0000 (11:49 -0500)]
python3: binding update

This adds rename(new_name) to the binding as well as two new const,
LXC_CLONE_KEEPBDEVTYPE and LXC_CLONE_MAYBE_SNAPSHOT.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: fix obvious braindeadnesses
Serge Hallyn [Thu, 16 Jan 2014 20:44:48 +0000 (14:44 -0600)]
cgmanager: fix obvious braindeadnesses

1. don't return bools for int-return functions
2. copy the filename to controller before using it
3. use full filename not just the key to pass to cgmanager

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-ls: Add -f and -F as aliases
Stéphane Graber [Thu, 16 Jan 2014 18:42:22 +0000 (13:42 -0500)]
lxc-ls: Add -f and -F as aliases

Alias -f to --fancy and -F to --fancy-format.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agopython3: Don't fail in list_containers on ValueError
Stéphane Graber [Thu, 16 Jan 2014 18:37:32 +0000 (13:37 -0500)]
python3: Don't fail in list_containers on ValueError

ValueError typically means that the user doesn't have permissions to
access the directory. Raising an exception there isn't consistent with
other error behaviour of list_containers which simple returns an empty
tuple.

So simply catch the exception and ignore it. An error message is already
printed by LXC itself anyway.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoaddress coverity-found memleak of data on error case
Serge Hallyn [Thu, 16 Jan 2014 16:26:18 +0000 (10:26 -0600)]
address coverity-found memleak of data on error case

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_init.c: error handing for sigaction and sigprocmask
Qiang Huang [Thu, 16 Jan 2014 07:30:01 +0000 (15:30 +0800)]
lxc_init.c: error handing for sigaction and sigprocmask

Look through all LXC code and seems like only here are missed.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update Japanese man pages
KATOH Yasufumi [Thu, 16 Jan 2014 07:38:27 +0000 (16:38 +0900)]
doc: Update Japanese man pages

* lxc-unshare(1): Update for commit c1bb25a831fdd568fb8c899b67a7be63c21f4a10 and 13d8bde96f0a21da92bcf353ad5db3f6f83172c2
* lxc.conf(5): Update for commit 04a243f11d5d4891b427107774d30d058bb191e7

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoskip rootfs pinning for unprivileged containers
S.Çağlar Onur [Thu, 16 Jan 2014 05:01:28 +0000 (00:01 -0500)]
skip rootfs pinning for unprivileged containers

This is perfectly safe since you cannot unmount the host fs from
a child userns.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoshut up freezer_state
Serge Hallyn [Thu, 16 Jan 2014 14:41:44 +0000 (08:41 -0600)]
shut up freezer_state

Not being able to get freezer state is perfectly valid - if the
container does not exist.  The old version of freezer_state
only reported an error on actually reading the cgroup file,
but not on not finding a cgroup file.  Leave it to the caller
to report the error if it is important, since we don't actually
know any useful info here anyway.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofix compilation error in cgmanager.c
S.Çağlar Onur [Thu, 16 Jan 2014 05:29:05 +0000 (00:29 -0500)]
fix compilation error in cgmanager.c

Currently it fails like following

gcc -DHAVE_CONFIG_H -I. -I../../src   -D_FORTIFY_SOURCE=2 -fPIC -DPIC -I../../src -DLXCROOTFSMOUNT=\"/usr/lib/x86_64-linux-gnu/lxc/rootfs\" -DLXCPATH=\"/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/etc/lxc/lxc.conf\" -DLXCINITDIR=\"/usr/libexec\" -DLXCTEMPLATEDIR=\"/usr/share/lxc/templates\" -DLOGPATH=\"/var/log/lxc\" -DLXC_DEFAULT_CONFIG=\"/etc/lxc/default.conf\" -DLXC_USERNIC_DB=\"/run/lxc/nics\" -DLXC_USERNIC_CONF=\"/etc/lxc/lxc-usernet\" -DDEFAULT_CGROUP_PATTERN=\"/lxc/%n\" -DHAVE_APPARMOR -DHAVE_CGMANAGER -DHAVE_SELINUX  -DHAVE_SECCOMP  -pthread  -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include     -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Werror -MT liblxc_so-cgmanager.o -MD -MP -MF .deps/liblxc_so-cgmanager.Tpo -c -o liblxc_so-cgmanager.o `test -f 'cgmanager.c' || echo './'`cgmanager.c
In file included from cgmanager.c:48:0:
cgmanager.c: In function ‘cgmanager_remove_cgroup’:
log.h:247:9: error: format ‘%s’ expects a matching ‘char *’ argument [-Werror=format=]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
cgmanager.c:142:3: note: in expansion of macro ‘INFO’
   INFO("cgroup removal attempt: %s:%s did not exist");
   ^
log.h:247:9: error: format ‘%s’ expects a matching ‘char *’ argument [-Werror=format=]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
cgmanager.c:142:3: note: in expansion of macro ‘INFO’
   INFO("cgroup removal attempt: %s:%s did not exist");
   ^
cc1: all warnings being treated as errors
make[3]: *** [liblxc_so-cgmanager.o] Error 1

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agostop cmd callback: unfreeze by path only
Serge Hallyn [Wed, 15 Jan 2014 19:40:53 +0000 (13:40 -0600)]
stop cmd callback: unfreeze by path only

in particular, regular unfreeze uses the cmd api to request the cgroup
of the container.  If we are already in the lxc-start monitor, we can't
use the cmd api.

(I knew when I started this would be a problem but then as it didn't
reliably crash, I forgot to handle it)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoimplement cgmanager_remove_cgroup
Serge Hallyn [Wed, 15 Jan 2014 18:09:18 +0000 (12:09 -0600)]
implement cgmanager_remove_cgroup

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoInitial support for cgmanager
Serge Hallyn [Tue, 14 Jan 2014 22:41:36 +0000 (16:41 -0600)]
Initial support for cgmanager

This patch splits out most of the cgroupfs-specific code, so that
cgroup-manager versions can be plugged in.  The case I did
not handle is cgroup_enter at lxc_attach.  I'm hoping that case can
be greatly simplified, but will worry about it after fleshing out the
cgroup manager handlers.

This also simplify the freezer functions.

This seems to not regress my common tests when running without
cgmanager, but I'd like to do a bit more testing before pushing.
However I was hoping to get some more eyes on this so am sending it
out now.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-ubuntu-cloud: Fix cache and lock location
Stéphane Graber [Thu, 16 Jan 2014 04:06:45 +0000 (23:06 -0500)]
lxc-ubuntu-cloud: Fix cache and lock location

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoubuntu: Don't fail on invalid locale
Stéphane Graber [Thu, 16 Jan 2014 03:29:12 +0000 (22:29 -0500)]
ubuntu: Don't fail on invalid locale

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-create: Don't print the help message twice
Stéphane Graber [Thu, 16 Jan 2014 03:53:20 +0000 (22:53 -0500)]
lxc-create: Don't print the help message twice

The forking logic was wrong, causing both the child and the parent to
call the template with -h.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing entry to dist target
Stéphane Graber [Thu, 16 Jan 2014 00:21:26 +0000 (19:21 -0500)]
Add missing entry to dist target

Apparently this file has gone over 5 years without getting into a dist
tarball!

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agochange version to 1.0.0.beta2 in configure.ac
Stéphane Graber [Thu, 16 Jan 2014 00:07:33 +0000 (19:07 -0500)]
change version to 1.0.0.beta2 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd local definition of sethostname to lxc_unshare
Stéphane Graber [Wed, 15 Jan 2014 23:29:57 +0000 (18:29 -0500)]
Add local definition of sethostname to lxc_unshare

sethostname doesn't exist on bionic, so copy/paste the definition of it
we have in conf.c

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-unshare: uid_t is unsigned.
Serge Hallyn [Wed, 15 Jan 2014 22:45:31 +0000 (16:45 -0600)]
lxc-unshare: uid_t is unsigned.

so we can't use uid==-1 as "don't do setuid"

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoTeach lxc_unshare about interfaces, mounts, hostname, daemonize
Seth Robertson [Wed, 4 Dec 2013 05:28:56 +0000 (00:28 -0500)]
Teach lxc_unshare about interfaces, mounts, hostname, daemonize

lxc_unshare now takes one or more '-i interfacename' arguments which
will move the named interfaces into the created container.

lxc_unshare now takes -M argument which will cause the standard mounts
(/proc /dev/shm /dev/mqueue) to be auto-mounted inside container.

lxc_unshare now takes '-H hostname' argument to automatically set
the hostname in the container.

lxc_unshare now takes -D argument to automatically daemonize and detach
from the created container, instead of waiting for the container to exit

Signed-off-by: Seth Robertson <srobertson@appcomsci.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_unshare -u argument useful even with USER namespace shared
Seth Robertson [Wed, 4 Dec 2013 05:24:08 +0000 (00:24 -0500)]
lxc_unshare -u argument useful even with USER namespace shared

Signed-off-by: Seth Robertson <srobertson@appcomsci.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodebian: Switch to config includes
Stéphane Graber [Wed, 15 Jan 2014 19:57:28 +0000 (14:57 -0500)]
debian: Switch to config includes

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoDisable logpath for unprivileged containers
Stéphane Graber [Wed, 15 Jan 2014 18:32:23 +0000 (13:32 -0500)]
Disable logpath for unprivileged containers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agooracle: Fix running template unprivileged
Stéphane Graber [Wed, 15 Jan 2014 18:25:48 +0000 (13:25 -0500)]
oracle: Fix running template unprivileged

Without this /dev/console won't exist and upstart will fail to start any
job marking as "console output" including the rather important rcS.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agooracle template: default to 6.5 when no release given or detected
Dwight Engen [Wed, 15 Jan 2014 17:21:57 +0000 (12:21 -0500)]
oracle template: default to 6.5 when no release given or detected

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agooracle template: don't sed /etc/init/tty.conf on older releases
Dwight Engen [Wed, 15 Jan 2014 17:21:52 +0000 (12:21 -0500)]
oracle template: don't sed /etc/init/tty.conf on older releases

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agooracle template: convert to common.conf style
Dwight Engen [Wed, 15 Jan 2014 17:21:44 +0000 (12:21 -0500)]
oracle template: convert to common.conf style

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc.conf: note the 'lxc.network.type = none' option
Serge Hallyn [Wed, 15 Jan 2014 17:13:39 +0000 (11:13 -0600)]
lxc.conf: note the 'lxc.network.type = none' option

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoplamo: Update template to use wget when download packages
KATOH Yasufumi [Wed, 15 Jan 2014 16:55:52 +0000 (01:55 +0900)]
plamo: Update template to use wget when download packages

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 agoFix small mistake with squid-deb-proxy hook
Chris Glass [Wed, 15 Jan 2014 15:37:46 +0000 (16:37 +0100)]
Fix small mistake with squid-deb-proxy hook

I unfortunately realized that I did not push the latest version of the
file. This fixes an issue in the case where we want to create the proxy
file in the container (not nested).

Signed-off-by: Chris Glass <tribaal@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>