Commit Graph

6329 Commits

Author SHA1 Message Date
Christian Brauner
f947066a5a
Merge pull request #2092 from lifeng68/modify_console_create
Create console when the rootfs is NULL
2018-01-22 10:40:15 +01:00
LiFeng
86530b0ae1 Fix comments and add check in lxc_poll.
Add check whether handler->conf->console.path is 'none'

Signed-off-by: LiFeng <lifeng68@huawei.com>
2018-01-22 06:29:34 -05:00
Christian Brauner
a346335eb9
Merge pull request #2100 from lifeng68/Modify_git_ignore
Modify .gitignore
2018-01-22 10:14:13 +01:00
LiFeng
adf077a360 Modify .gitignore
Add:
src/tests/lxc-test-api-reboot
src/tests/lxc-test-criu-check-feature
src/tests/lxc-test-raw-clone
src/tests/lxc-test-share-ns
src/tests/lxc-test-state-server

Signed-off-by: LiFeng <lifeng68@huawei.com>
2018-01-22 07:50:45 -05:00
Christian Brauner
13f9b45f6c
Merge pull request #2101 from tenforward/japanese
doc: Update Japanese lxc-attach(1) and lxc.container.conf(5)
2018-01-22 10:13:55 +01:00
KATOH Yasufumi
fb736bbe28 doc: Update Japanese lxc-attach(1) and lxc.container.conf(5)
* Update for commit ba2be1a (attach: move pty allocation into api)
* Update for commit 5757588 (manpage: correct lxc.log.file conf option)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-01-22 14:47:48 +09:00
Christian Brauner
1cce35e649
attach: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-21 15:23:20 +01:00
Christian Brauner
bb2ada6f4d
attach: setup /proc limits
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-21 15:20:19 +01:00
Christian Brauner
42b09f9429
start: fix mainloop cleanup goto statements
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-21 13:55:42 +01:00
Christian Brauner
d7af33e24e
coverity: #1426694
remove logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-21 01:54:29 +01:00
Christian Brauner
c8dcf77824
coverity: #1426734
do not call close on bad fd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-21 01:54:29 +01:00
Christian Brauner
a49cad59f8
coverity: #1427190
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:41:18 +01:00
Christian Brauner
2388737b2a
coverity: #1427191
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:41:06 +01:00
Christian Brauner
b21da190ec
coverity: #1427638
avoid (however unlikely) double free

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:35:35 +01:00
Christian Brauner
358b8c818b
coverity: #1427639
remove logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:30:17 +01:00
Christian Brauner
4d078b3c25
coverity: #1427668
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:26:33 +01:00
Christian Brauner
0072887d77
tools: fix android
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:21:41 +01:00
Christian Brauner
ce4a1a11c9
tools: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:21:40 +01:00
Christian Brauner
c948657b04
attach: init struct
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-20 21:21:38 +01:00
Christian Brauner
95220ee6e0
Merge pull request #2097 from mikemccracken/2018-01-19/report-storage-destroy
storage: treat return value from ops->destroy as int
2018-01-20 06:27:36 +01:00
Christian Brauner
e6dba51290
Merge pull request #2096 from mikemccracken/patch-1
manpage: correct lxc.log.file conf option
2018-01-20 00:42:16 +01:00
Christian Brauner
7c76f49546
Merge pull request #2095 from tych0/remove-lxc-init
unlink lxc-init
2018-01-19 18:49:21 +01:00
Michael McCracken
ed05aac829 storage: treat return value from ops->destroy as int
r->ops->destroy() returns an int, -1 on error.
When assigned to a bool, this becomes true and hides errors.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-19 08:44:04 -08:00
Tycho Andersen
58fb9c8efe unlink lxc-init
It's sort of an implementation detail that this exists at all, and we
should probably not pollute the container's mount tables or FS with this.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 16:43:38 +00:00
LiFeng
3dc035f1ab Adapt lxc_setup_console() to bind mount 'console'
Signed-off-by: LiFeng <lifeng68@huawei.com>
2018-01-19 11:23:35 -05:00
Michael McCracken
5757588f96 manpage: correct lxc.log.file conf option
lxc.log.file instead of just lxc.log

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
2018-01-19 04:32:16 -08:00
Serge Hallyn
2c3a005d73
Merge pull request #2094 from tych0/propagate-exit-code
Propagate exit code for app containers
2018-01-18 22:26:32 -06:00
Tycho Andersen
55e1311e4b set exit status to 1 in the unknown si_code case
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 04:23:48 +00:00
Tycho Andersen
f9eff95053 lxc-execute: actually exit with the status of the spawned task
Now that we have things propagated through init and liblxc correctly, at
least in non-daemon mode, we can exit with the actual exit status of the
task, instead of always succeeding, which is not so helpful.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:44:24 +00:00
Tycho Andersen
eb8085399c start: don't return false when the container's init exits nonzero
This seems slightly counter-intuitive, but IMO it's what we want.
Basically, ->start() should succeed if the container is spawned correctly
(similar to how golang's exec.Cmd.Start() returns nil if the thing spawns
correctly), and users can check error_num (i.e. golang's exec.Cmd.Wait())
to see how it exited.

This preserves previous behavior, which basically was that start was always
successful if the thing actually launched. Since we never kept track of
exit codes, this would always succeed too. Now that we do, it doesn't, and
this change is required.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:44:24 +00:00
Tycho Andersen
cd5177e9e3 remember the exit code from the init process
error_num seems to be trying to remember the exit code of the init process,
except that nothing actually keeps track of it anywhere. So, let's add a
field to the handler, so that we can keep track of the process' exit
status, and the propagate it to error_num in struct lxc_container so that
people can use it.

Note that this is a slight behavior change, essentially instead of making
error_num always == the return code from start, now it contains slightly
more useful information (the actual exit status). But, there is only one
internal user of error_num which I'll fix in later in the series, so IMO
this is ok.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:44:24 +00:00
Tycho Andersen
4f4530faa7 lxc.init: correctly exit with the app's error code
Based on the comments in the code (and the have_status flag), the intent
here (and IMO, the desired behavior) should be for init.lxc to propagate
the actual exit code from the real application process up through.
Otherwise, it is swallowed and nobody can access it.

The bug being fixed here is that ret held the correct exit code, but when
it went around the loop again (to wait for other children) ret is
clobbered. Let's save the desired exit status somewhere else, so it can't
get clobbered, and we propagate things correctly.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:21:10 +00:00
Tycho Andersen
19cfa02c4c fix lxc_error_set_and_log to match the docs
The documentation for this function says if the task was killed by a
signal, the return code will be 128+n, where n is the signal number. Let's
make that actually true.

(We'll use this behavior in later patches.)

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:20:48 +00:00
Tycho Andersen
3a9e949f6d start: don't log stop/continue for non-init processes
This non-init forwarding check should really be before all the log messages
about "init continued" or "init stopped", since they will otherwise lie
about some process that wasn't init being stopped or continued.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-19 03:18:02 +00:00
LiFeng
7bc5a80bad Create console when the rootfs is NULL
Signed-off-by: LiFeng <lifeng68@huawei.com>
2018-01-18 18:06:46 -05:00
Serge Hallyn
dc4f8fb11a
Merge pull request #2089 from brauner/2018-01-17/restore_blocking_wait
lxccontainer: restore blocking wait()
2018-01-17 17:44:24 -06:00
Christian Brauner
974a8abaf3
commands: add LXC_CMD_SERVE_STATE_CLIENTS
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-18 00:43:58 +01:00
Christian Brauner
fd5838e506
freezer: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-18 00:43:57 +01:00
Christian Brauner
f577e0613c
lxccontainer: restore blocking wait()
Closes #2027.
Closes lxc/go-lxc#98.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-18 00:43:57 +01:00
Serge Hallyn
e08bdcbcb8
Merge pull request #2061 from brauner/2017-12-23/attach_allocate_pty_in_api
attach: add LXC_ATTACH_ALLOCATE_PTY
2018-01-17 17:42:57 -06:00
Christian Brauner
c2229b24f9
utils: check suffix length
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-17 12:21:09 +01:00
Christian Brauner
99eafdd4f7
test: log error on failure
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-17 11:50:54 +01:00
Christian Brauner
a13560af7e
utils: do not rely on unitialized variable
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-17 11:19:05 +01:00
Christian Brauner
e7d7dd73d2
Merge pull request #2086 from kunkku/alpine-ptrace
lxc-alpine: allow retaining sys_ptrace per container
2018-01-16 15:25:43 +01:00
Kaarle Ritvanen
ecef04af71 lxc-alpine: allow retaining sys_ptrace per container
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
2018-01-16 16:02:49 +02:00
Christian Brauner
fbf4cc9548
Merge pull request #2085 from duguhaotian/master
[console] return wrong console logsize
2018-01-16 10:50:11 +01:00
duguhaotian
dcea90a033 [console] return wrong console logsize
get_config_console_logsize want console.buffer_size not c->autodev

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
2018-01-16 15:34:42 +08:00
Christian Brauner
060adc6137
tests: do not call close() on invalid fd
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-12 18:43:01 +01:00
Christian Brauner
dc5f6125d6
console: set SFD_CLOEXEC on signal fd
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-09 13:20:27 +01:00
Christian Brauner
df0795b1bd
start: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-09 13:20:25 +01:00