Commit Graph

2483 Commits

Author SHA1 Message Date
Serge Hallyn
3ec1648d8e idmap_add_id: fix broken behavior
The geteuid() addition is being made the first element of the lxc_list,
but the first element is just a head whose entry is ignored.  Therefore
userns_exec_1() was starting its tasks without the caller's uid mapped
into the namespace.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-24 11:52:42 -05:00
Dwight Engen
9f2fd74c7b add lua-alt-getopt dependency
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-24 11:52:39 -05:00
KATOH Yasufumi
3220ecebfc doc: Add Japanese lxc-config(1)
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-24 11:52:35 -05:00
Stéphane Graber
80a873c223 tests: Fix createtest
Drop 60s delay and clear config before loading it.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:45 -05:00
Stéphane Graber
0898897a3a tests: Remove containers after running clonetest
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:40 -05:00
Stéphane Graber
2ed29824dc tests: Drop 60s delay in shutdowntest
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:35 -05:00
Stéphane Graber
e8ff96bbf8 Fix destroy() crash when no config is loaded
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:31 -05:00
Stéphane Graber
068b3d0431 tests: Fix lxc-test-saveconfig cleanup
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:26 -05:00
Stéphane Graber
cc3afb1ef5 tests: Fix shutdown test
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:22 -05:00
Stéphane Graber
c85a40bc4d tests: Speed up lxc-test-usernic
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:18 -05:00
Stéphane Graber
8ced4fd4f7 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>
2014-01-24 11:33:13 -05:00
Stéphane Graber
0e17b9c69b tests: Rework lxc-test-usernic
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-24 11:33:07 -05:00
Stéphane Graber
7059802cf0 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>
2014-01-24 11:33:01 -05:00
Stéphane Graber
73d3e0903c 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>
2014-01-24 11:32:55 -05:00
Serge Hallyn
0b3a6504e5 get_mapped_rootid: fix description
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-23 14:51:42 -06:00
Serge Hallyn
2a9a80cb1c get_mapped_rootid: avoid using (uid_t) -1
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-23 14:50:18 -06:00
Serge Hallyn
1354955b02 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>
2014-01-23 15:09:17 -05:00
Serge Hallyn
f6639e3bee cgm_get: support NULL value
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-23 13:35:50 -06:00
Stéphane Graber
bfb1bb94c8 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>
2014-01-23 14:08:44 -05:00
Serge Hallyn
da10a5c6a2 Revert "cgroupfs: support older kernels without cgroup.clone_children"
This reverts commit 0a4d93787d.
2014-01-23 13:03:11 -06:00
Serge Hallyn
3e45c94884 Revert "bionic: Replace rindex by strrchr"
This reverts commit 86f0eb65a0.
2014-01-23 13:03:05 -06:00
Serge Hallyn
2edb53c7c8 Revert "cgroup.c: clean up for handle_cgroup_settings"
This reverts commit 032e28b767.
2014-01-23 13:02:25 -06:00
Serge Hallyn
f6ac3b9eca Revert "cgroupfs: get rid of the redundant error info"
This reverts commit a8117b3361.
2014-01-23 13:02:15 -06:00
Serge Hallyn
fec822c4a0 Revert "cgroupfs: need the full path to setup cpuset"
This reverts commit 47f5ede0ec.
2014-01-23 13:02:08 -06:00
Stéphane Graber
ff5e275105 doc: Add manpage for lxc-config
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-23 12:51:47 -05:00
Qiang Huang
47f5ede0ec 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>
2014-01-23 11:21:34 -06:00
Qiang Huang
a8117b3361 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>
2014-01-23 11:18:07 -06:00
KATOH Yasufumi
fb261f53fc doc: Add Japanese lxc.container.conf(5), lxc.system.conf(5) and update lxc.conf(5)
* update for commit 55fc19a104
* 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>
2014-01-23 10:53:06 -05:00
Qiang Huang
032e28b767 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>
2014-01-22 21:25:35 -06:00
Stéphane Graber
55fc19a104 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>
2014-01-22 22:16:20 -05:00
Stéphane Graber
ffa0e610dc lxc-start-ephemeral: require root
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 22:15:20 -05:00
Serge Hallyn
bba1fbe695 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>
2014-01-22 21:55:09 -05:00
Stéphane Graber
86f0eb65a0 bionic: Replace rindex by strrchr
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-22 21:25:29 -05:00
Serge Hallyn
0a4d93787d 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>
2014-01-22 20:01:36 -05:00
KATOH Yasufumi
8c3a756ed4 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>
2014-01-22 19:57:53 -05:00
Qiang Huang
6eaac3034e 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>
2014-01-22 19:53:22 -05:00
Qiang Huang
72cf75fa33 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>
2014-01-22 19:51:45 -05:00
Serge Hallyn
844f7a3874 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>
2014-01-22 18:28:13 -06:00
Stéphane Graber
2eee1b96c6 Fix handling of empty config keys
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 19:24:47 -05:00
Serge Hallyn
87b86add6c 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>
2014-01-22 15:19:59 -05:00
Dwight Engen
e0f2f5c764 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>
2014-01-22 15:19:59 -05:00
Serge Hallyn
358afd840d 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>
2014-01-22 13:57:00 -06:00
Stéphane Graber
b0f0932a94 lxc-download: Add interactive mode
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 14:52:34 -05:00
Serge Hallyn
c4e9c69f51 coverity: free gw when not used
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 13:04:42 -06:00
Serge Hallyn
452c91416b coverity: close userns file when done
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 13:02:42 -06:00
Serge Hallyn
32f4b9c77c coverity: close netns file when done
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 12:57:53 -06:00
Serge Hallyn
d966dd14f0 cgmanager: setup_limits: return true if there are no settings
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-22 12:39:45 -06:00
Stéphane Graber
2177dbc7e0 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>
2014-01-22 13:38:50 -05:00
Stéphane Graber
7f12cae956 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>
2014-01-22 13:38:46 -05:00
Stéphane Graber
0306de4f28 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>
2014-01-22 12:23:08 -05:00