Commit Graph

6961 Commits

Author SHA1 Message Date
Stéphane Graber
f55cf89e9d
Merge pull request #1947 from brauner/2017-11-24/fix_cap_sys_admin_declaration
conf: move CAP_SYS_* definitions to utils.h
2017-11-24 11:00:06 -05:00
Christian Brauner
478fb51d4e
conf: move CAP_SYS_* definitions to utils.h
Closes #1946.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-24 13:25:51 +01:00
Christian Brauner
dc3de87251
Merge pull request #1944 from dnegreira/lxc_spec_in_typo_fix
Fixed typo on lxc.spec.in
2017-11-23 21:34:51 +01:00
David Negreira
e82021215f Fixed typo on lxc.spec.in
Signed-off-by: David Negreira David@otherreality.net
2017-11-23 21:23:14 +01:00
Stéphane Graber
a122de392b
Merge pull request #1939 from brauner/2017-11-22/more_elaborate_config_update_message
doc: documents lxc.namespace.[namespace identifier] + confile: improve legacy update message
2017-11-23 12:28:08 -05:00
Christian Brauner
b151c7e532
Merge pull request #1941 from flx42/lxc-oci-improve-import
Improve lxc-oci.in
2017-11-23 13:20:33 +01:00
Christian Brauner
f3c9f12290
doc: document lxc.namespace.[namespace identifier]
Closes #1924.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-23 12:34:23 +01:00
Felix Abecassis
797f99c6c9 lxc-oci: add support for registry authentication
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:13 -08:00
Felix Abecassis
d7c685c6be lxc-oci: import common.conf and userns.conf
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:13 -08:00
Felix Abecassis
996202e74a lxc-oci: import the environment variables
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:03 -08:00
Felix Abecassis
ce59e4ca31 lxc-oci: add utility function to retrieve the path of the config file
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:53:57 -08:00
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