Commit Graph

6350 Commits

Author SHA1 Message Date
Christian Brauner
ece913fe14
confile: improve legacy update message
Closes #1938.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-22 23:25:38 +01:00
Felix Abecassis
b523655057 lxc-oci: write /etc/hosts
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Felix Abecassis
bc2c91ae99 lxc-oci: write /etc/hostname
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Felix Abecassis
51c80577e0 lxc-oci: support unprivileged umoci unpacking
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Christian Brauner
0ad2353255
Merge pull request #1936 from Cypresslin/user-del-mute
lxc-test-unpriv: check user existence before removing it
2017-11-22 12:48:19 +01:00
Christian Brauner
27b54094d0
Merge pull request #1935 from flx42/confile-overlapping-strncpy
confile_utils: fix overlapping strncpy
2017-11-22 12:33:57 +01:00
Po-Hsu Lin
438c96e96a lxc-test-unpriv: check user existence before removing it
Check the test user (lxcunpriv) before calling deluser command,
otherwise it will print unnecessary error message:
/usr/sbin/deluser: The user 'lxcunpriv' does not exist.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2017-11-22 03:11:46 -05:00
Felix Abecassis
ee3e84df78 confile_utils: fix overlapping strncpy
In the case of "lxc.net.0.type", the pointers passed to strncpy were
only 2 elements apart, resulting in undefined behavior.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-21 22:33:01 -08:00
Christian Brauner
ba715de0b5
Merge pull request #1933 from 3XX0/init-control-tty
lxc_init: set the control terminal in the child session
2017-11-21 13:31:01 +01:00
Jonathan Calmels
0cf42eddd2 lxc_init: set the control terminal in the child session
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2017-11-20 17:30:45 -08:00
Jonathan Calmels
27234deb3a hooks: add dhclient hooks
Add new hooks leveraging dhclient from the host to automatically
configure the container interfaces. This is especially useful for
application containers which rely on an IPAM driver for network
configuration (e.g. Docker).

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2017-11-20 16:54:16 -08:00
Stéphane Graber
a848f32a94
Merge pull request #1931 from brauner/2017-11-20/fix_state_socket
commands: fix state socket implementation
2017-11-20 17:21:25 -05:00
Christian Brauner
f6fc156515
commands: fix state socket implementation
Remove dead state clients from state client list. Consider the following
scenario:

01 start container
02 issue shutdown request
03 state_client_fd is added to lxc_handler
03 container doesn't respond to shutdown request
04 user aborts shutdown request
05 lxc_cmd_fd_cleanup() removes state_client_fd from lxc_mainloop
06 invalid state_client_fd is still recorded in the lxc_handler
07 user issues lxc_cmd_stop() request via SIGKILL
08 container reaches STOPPED state and sends message to state_client_fd
09 state_client_fd number has been reused by lxc_cmd_stop_callback()
10 invalid data gets dumped to lxc_cmd_stop()

Reproducer:
Set an invalid shutdown signal to which the init system does not respond with a
shutdown via lxc.signal.halt e.g. "lxc.signal.halt = SIGUSR1". Then do:

1. start container
    root@conventiont|~
    > lxc-start -n a1

2. try to shutdown container
    root@conventiont|~
    > lxc-stop -n a1

3. abort shutdown
^C

4. SIGKILL the container (lxc.signal.stop = SIGKILL)
    root@conventiont|~
    > lxc-stop -n a1 -k
    lxc-stop: a1: commands.c: lxc_cmd_rsp_recv: 165 File too large - Response data for command "stop" is too long: 12641 bytes > 8192

To not let this happen we remove the state_client_fd from the lxc_handler when
we detect a cleanup event in lxc_cmd_fd_cleanup().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:40 +01:00
Christian Brauner
c1a3e54736
lxccontainer: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:29 +01:00
Christian Brauner
9dfa4041c7
commands: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:27 +01:00
Christian Brauner
4671db7abf
Merge pull request #1930 from lifeng68/Fix_parse_err
Fix lxc_inherit_namespace function error
2017-11-20 11:19:08 +01:00
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