Commit Graph

6084 Commits

Author SHA1 Message Date
LiFeng
716495668b Fix namespace config parse error
Signed-off-by: LiFeng <lifeng68@huawei.com>
2017-11-20 06:42:30 -05:00
Serge Hallyn
c4e7852b3c
Merge pull request #1925 from brauner/2017-11-14/console_config_keys
console: add lxc.console.buffer.size, lxc.console.buffer.logfile, lxc.console.rotate
2017-11-17 18:04:59 -06:00
Christian Brauner
8a2404e982
test: expand console log tests
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
966b9ecd95
commands: rotate console log file
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
cf685555b3
commands: truncate console ringbuffer log file
When a "clear" request is sent to the console ringbuffer we should truncate the
console log file as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
a030916834
console: split console setup into logical parts
The lxc_console_create() function used to munge the ringbuffer setup and the
log file setup already. This made somewhat sense when we didn't have a separate
ringbuffer log file. Now it's just plain confusing. So split this into logical
helpers that future maintainers can understand:

- lxc_console_create_log_file()
- lxc_console_create_ringbuf(console);
- lxc_console_create_ringbuf_log_file(console);

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
5928191e83
commands: only set ringbuffer datalen when needed
If we do it unconditionally a request to only clear the ringbuffer and not read
or write anything will fail.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:55 +01:00
Christian Brauner
d91adfa612
confile: add lxc.console.rotate
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:52 +01:00
Christian Brauner
3a784510e3
confile: add lxc.console.buffer.logfile
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:17:46 +01:00
Christian Brauner
28f3b1cdbe
confile: add lxc.console.buffer.size
Determines the size of the ringbuffer.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:17:44 +01:00
Serge Hallyn
05e1745cc1
Merge pull request #1920 from brauner/2017-11-12/console_exit_clean_on_sigterm
console: exit mainloop on SIGTERM
2017-11-13 09:28:46 -06:00
Serge Hallyn
f03e93fb3c
Merge pull request #1922 from brauner/2017-11-13/generate_new_uuid_for_xfs_and_btrfs_snapshots
lvm: generate new UUID for xfs + btrfs filesystems
2017-11-13 09:28:24 -06:00
Christian Brauner
d59f08f3ac
lvm: generate new UUID for xfs + btrfs filesystems
Closes #1909.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-13 15:03:19 +01:00
Christian Brauner
1349e92e4d
console: exit mainloop on SIGTERM
This allows cleanly exiting a console session without control sequences.

Relates to https://github.com/lxc/lxd/pull/4001 .

Note that the existence of a signal handler now doesn't guarantee that ts->node
is allocated. Instead, ts->node will now only be added to if stdinfd is a tty.
New checks need to take that into account.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-13 08:32:13 +01:00
Christian Brauner
0519b5cce7
console: prepare for generic signal handler
Non-functional changes to enable handling more signals.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-13 08:32:13 +01:00
Serge Hallyn
af73a0bf5a
Merge pull request #1919 from brauner/2017-11-11/console_fix_escape_sequence
console: use correct escape sequence check
2017-11-11 22:38:34 -06:00
Christian Brauner
525e2117f0
console: use correct escape sequence check
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-11 23:06:33 +01:00
Serge Hallyn
72615674fc
Merge pull request #1918 from brauner/2017-11-11/daemonized_execute
lxccontainer: enable daemonized execute
2017-11-10 21:41:29 -06:00
Serge Hallyn
ed18666164
Merge pull request #1907 from brauner/2017-11-08/cgfsng
cgroups/cgfsng: adapt to new cgroup2 delegation
2017-11-10 18:54:26 -06:00
Christian Brauner
be44259825
tools: add "--daemonize/-d"
This lets's users run daemonized application containers with our minimal init
as pid 1 and the requested program as pid 2.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-11 00:22:09 +01:00
Christian Brauner
9605460f1c
lxccontainer: enable daemonized app containers
This enables daemonized application containers with our minimal init running as
pid one and the requested program running as second pid.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-11 00:21:09 +01:00
Stéphane Graber
94b308f72a
Merge pull request #1917 from brauner/2017-11-10/report_console_detach_only_when_needed
console: report detach message on demand
2017-11-10 14:22:44 -05:00
Christian Brauner
686df16690
console: report detach message on demand
When users pass -1 there's there won't be an escape sequence to exit the
console so no need to print a misleading info message about how to detach.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-10 19:51:57 +01:00
Stéphane Graber
c83280b79e
Merge pull request #1916 from brauner/2017-11-10/fix_console_info_output
console: fix console info message
2017-11-10 13:28:32 -05:00
CC-Hsu
b79628fcfb
Add missing dependency libunistring
Hi,

I try to create a Slackware container in a Slackware64 14.2 current and
find that wget depends on libunistring.

So I add libunistring to the package list.

Closes #1915

Signed-off-by: Chia-Chun Hsu a12321aabb@gmail.com
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2017-11-10 13:17:02 -05:00
Christian Brauner
6834f80577
console: fix console info message
Now it will be displayed nicely formatted:

a1 login: chb@conventiont|~
> lxc console a1

Connected to tty 0
Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

Ubuntu 17.10 a1 console

a1 login:

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-10 19:07:38 +01:00
Stéphane Graber
c99b8a658f
Merge pull request #1910 from brauner/2017-11-08/attach_without_conf
attach: allow attach with empty conf
2017-11-10 02:16:52 -05:00
Stéphane Graber
04c4ceba61
Merge pull request #1914 from flx42/lxc-oci-fix-url-long-option
lxc-oci: correctly handle --url
2017-11-10 02:16:23 -05:00
Felix Abecassis
960f15bffe lxc-oci: correctly handle --url
Fix: #1898
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-09 22:49:35 -08:00
Christian Brauner
c3b3643ac7
Merge pull request #1913 from AustinReichert/remove-api-calls
First tools/ refactor for review
2017-11-10 01:19:26 +01:00
Austin Reichert
f0ccfa1371 tools/lxc_attach: removed api logging
Signed-off-by: Austin Reichert <austinskyreichert@utexas.edu>
2017-11-09 17:33:29 -06:00
Christian Brauner
d4624e9497
Merge pull request #1908 from Cypresslin/fix-overlayfs
lxc-test-unpriv: fix the overlayfs mount error
2017-11-09 19:44:10 +01:00
Serge Hallyn
5cc2545c5d
Merge pull request #1871 from brauner/2017-10-21/api_extension_console_ringbuffer
API: add console ringbuffer extension
2017-11-08 16:20:24 -06:00
Christian Brauner
ba773996a5
attach: allow attach with empty conf
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-08 22:31:52 +01:00
Po-Hsu Lin
706f1101ab lxc-test-unpriv: fix the overlayfs mount error
This patch fixes the missing workdir issue for the overlayfs mount command in
the lxc-test-unpriv test.

Bug link: https://bugs.launchpad.net/bugs/1730915

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2017-11-08 04:14:18 -05:00
Christian Brauner
0e17357c37
cgroups/cgfsng: adapt to new cgroup2 delegation
In order to enable proper unprivileged cgroup delegation on newer kernels we not
just need to delegate the "cgroup.procs" file but also "cgroup.threads". But
don't report an error in case it doesn't exist. Also delegate
"cgroup.subtree_control" to enable delegation of controllers to descendant
cgroups.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-08 01:53:31 +01:00
Serge Hallyn
29e4eb3123
Merge pull request #1891 from brauner/2017-10-31/cgfsng_fixes
cgroups/cgfsng: fixes, features, and improved cgroup2 handling
2017-11-07 13:16:48 -06:00
Serge Hallyn
ce8cab746a
Merge pull request #1903 from brauner/2017-11-06/storage_new_default_fs
storage: switch to ext4 as default fs
2017-11-07 12:23:12 -06:00
Serge Hallyn
562924dc20
Merge pull request #1893 from brauner/2017-11-01/attach_handle_namespace_inheritance
attach: handle namespace inheritance
2017-11-07 12:18:39 -06:00
Christian Brauner
a52c1c68cf
tests: add tests for console_log()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:54 +01:00
Christian Brauner
33b4b4115f
console: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:54 +01:00
Christian Brauner
63b74cdaf7
console: add "write_logfile" to console_log struct
If a console log file was specified this flag indicates whether the contents of
the ringbuffer should be written to the logfile when a request is sent to the
ringbuffer.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:54 +01:00
Christian Brauner
40117d0531
console: write ringbuffer to disk
When users request that the container keep a console ringbuffer we will not
continously write to the on-disk logfile as mirroring the contents of the
in-memory ringbuffer on-disk is costly and complicated. Instead, we dump the
ringbuffer contents on-disk when the container stops or fails to start. This
way users can still diagnose problems or retrieve the last contents of the
ringbuffer on-disk.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:53 +01:00
Christian Brauner
3b988b33d9
console: move ringbuffer into lxc_console_create()
This makes the whole setup more flexible.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:53 +01:00
Christian Brauner
69629c8243
console: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:53 +01:00
Christian Brauner
191d43cca9
lxccontainer: add console_log() API extension
commands: add LXC_CMD_CONSOLE_LOG

Closes #1870.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:53 +01:00
Christian Brauner
fe84a562c2
commands: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:53 +01:00
Christian Brauner
0d8e40c687
config: remove SIGRTMIN+14 as lxc.signal.stop
We want to be able to SIGKILL an Archlinux container.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:28 +01:00
Christian Brauner
49ff395882
cgroupfs/cgfsng: improve cgroup2 handling
This fixes a bunch of bugs.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:28 +01:00
Christian Brauner
e2deb1d83d
cgroups/cgfsng: fix get_controllers() for cgroup2
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-07 00:54:28 +01:00