Commit Graph

4149 Commits

Author SHA1 Message Date
Christian Brauner
f43d63bc66 lxc-attach: add logging option to manpage
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-11 18:14:16 +02:00
Serge Hallyn
9f616d8453 Merge pull request #963 from brauner/2016-04-11/lxc_create_best_storage
lxc-create: fix -B best option
2016-04-11 10:28:54 -05:00
Christian Brauner
e2a348395a Merge pull request #961 from staticfox/iterations
Use size_t as an iteration point over int
2016-04-11 17:25:32 +02:00
Christian Brauner
fb5ab35bfa lxc-create: fix -B best option
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-11 17:15:21 +02:00
staticfox
84760c1183 Use size_t as an iteration point over int
This cleans up some sign-compare warnings as well as avoids any
possibilities of unintended signed offsets for indices during
iteration.

Signed-off-by: Matt Ullman <staticfox@staticfox.net>
2016-04-11 11:06:22 -04:00
Serge Hallyn
aa5470485e Merge pull request #958 from brauner/2016-04-08/lxc_attach_simplify_and_log
adapt lxc-attach tests
2016-04-10 18:00:19 -05:00
Christian Brauner
e96e50345b adapt lxc-attach tests & add test for pty logging
The current tests for lxc-attach pty allocation and I/O redirection rely on the
standard file descriptors of the test script to refer to a pty. If they do not
the tests are effectively useless with respect to pty allocation. We need a test
environment with the standard file descriptors refering to a pty as well. One
solution is to run this test under the script command.

This commit also adds a test whether pty logging works. This test is only
executed when all standard file descriptors refer to a pty.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-10 23:06:24 +02:00
Christian Brauner
bebc48f196 Merge pull request #956 from hallyn/2016-04-08/cgnfs-defer
cgfsng: defer to cgfs if needed subsystems are not available
2016-04-08 23:52:25 +02:00
Serge Hallyn
457ca9aa85 cgfsng: defer to cgfs if needed subsystems are not available
This requires us to check that at cgfsng_ops_init, rather than
cgfs_init.  Cache the hierarchy and cgroup.use info globally
rather than putting it into the per-container info, as cgmanager
does.  This is ok as both cgroup.use and the list of usable
hierarchies are in fact global to a lxc run.

Closes #952

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-08 16:32:15 -05:00
Serge Hallyn
32036de0dc Merge pull request #954 from brauner/2016-04-08/lxc_attach_simplify_and_log
use lxc_read_nointr() and lxc_write_nointr()
2016-04-08 14:11:25 -05:00
Christian Brauner
e66b6c96ac fix lxc_console_cb_tty_*()
Clean exit when read() == -1 && errno != EINTR or read() == 0.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-08 20:38:49 +02:00
Christian Brauner
3e6580ec3a use lxc_read_nointr() and lxc_write_nointr()
Using EPOLLHUP to determine when to exit the loop is unreliable. Let's exit
clean when read() returns -1 && errno != EINTR or 0.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-08 20:30:57 +02:00
Serge Hallyn
6a874d31a7 Merge pull request #953 from brauner/2016-04-08/lxc_attach_simplify_and_log
simplify pty allocation and implement pty logging
2016-04-08 10:20:08 -05:00
Christian Brauner
da41561c72 simplify pty allocation and implement pty logging
lxc-attach allocated a pty in a manner that relied on ts->stdinfd and
ts->stdoutfd to be set. We had to resort to a trick to get it working when
output is redirected. The new implementation gets rid of the black magic and
also simplifies the code.

This commit also implements pty logging for lxc-attach. Users will now be able
to log commands and corresponding output to a file given that lxc-attach
allocates a pty.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-08 16:01:55 +02:00
Serge Hallyn
aa3ea4d3cc Merge pull request #951 from brauner/2016-04-07/lxc_attach_sigwinch_handler
lxc-attach: attach even without sigwinch handler
2016-04-07 14:23:15 -05:00
Christian Brauner
341c2aed46 lxc-attach: attach even without sigwinch handler
lxc_console_create() calls lxc_console_peer_default() which in turn calls
lxc_console_sigwinch_init() which sets up the lxc_tty_state struct for the
current pty. Prior to this commit lxc_console_sigwinch_init() would consider
failures to install a SIGWINCH handler fatal and and return NULL. This commit
makes failures to install a SIGWINCH handler non-fatal. In such cases the
lxc_tty_state struct will still be set up but the sigfd member, which contains
the fd which receives SIGWINCH events, will be set to -1. (This also entails
that the sigset_t oldmaks field is meaningless.) Callers of
lxc_console_sigwinch_init() and lxc_console_sigwinch_fini() should thus make
sure that sigfd >= 0 or sigfd != -1 before trying to register a SIGWINCH handler
in e.g. an lxc_mainloop or resetting the sigmask (cf. lxc_attach.c).

These changes also imply that lxc_console_sigwinch_init() only fails with
ENOMEM. Thus, all cases where lxc_console_sigwinch_init() returns NULL are to be
considered fatal. This wasn't the case before this commit.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-07 21:01:18 +02:00
Stéphane Graber
823765e50b change version to 2.0.0 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-04-06 13:41:56 -04:00
Stéphane Graber
39c9dc029c Merge pull request #950 from brauner/2016-04-06/fix_memory_leak
lxc_mount_auto_mounts(): free memory on failure
2016-04-06 09:38:35 -04:00
Stéphane Graber
e3df7a88eb Merge pull request #948 from brauner/bugfix_branch
lxc-create: bugfixes and small improvements
2016-04-06 09:38:12 -04:00
Christian Brauner
b2f44b4d9a lxc_mount_auto_mounts(): free memory on failure
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-06 13:08:06 +02:00
Christian Brauner
66c26578bc Merge pull request #949 from Blub/netlink_open_error
netlink_open: close socket on error
2016-04-06 11:26:46 +02:00
Wolfgang Bumiller
b73e5969ae netlink_open: close socket on error
All uses of netlink_open() assume that on error the
nl_handler doesn't need to be closed, but some error cases
happen after the socket was opened successfully and used to
simply return -errno.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2016-04-06 11:06:28 +02:00
Christian Brauner
a7c36c83ee lxc-create: bugfixes and small improvements
- call lxc_container_put() before we exit()
- reorder includes
- use EXIT_FAILURE and EXIT_SUCCESS macros

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-06 10:25:34 +02:00
Stéphane Graber
5c218031b6 Merge pull request #947 from brauner/bugfix_branch
add more error handling + cleanup copy_storage()
2016-04-05 18:39:44 -04:00
Christian Brauner
763429b6bf add more error handling + cleanup copy_storage()
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-05 23:53:49 +02:00
Serge Hallyn
bd08898fe5 Merge pull request #945 from brauner/bugfix_branch
set lxc.rootfs.backend on container creation
2016-04-05 14:09:51 -05:00
Christian Brauner
8869eb5f83 set lxc.rootfs.backend on copy/snapshot as well
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-05 20:43:02 +02:00
Christian Brauner
39460be89e set lxc.rootfs.backend on container creation
Since specifying lxc.rootfs.backend can lead to performance improvements we
always set it during container creation.

This also fixes a bug. do_bdev_create() tried to be smart and retrieve the lower
directory when bdev->type == overlayfs or aufs thereby cutting the path.
However, this operation is done in ovl_mount() and aufs_mount() and both
functions need the full src path for this. The bug didn't show before because
when creating a overlayfs container with e.g.:

	lxc-create -n c -t busybox -B overlayfs

still left bdev->type set to dir and so the code for retrieving the lower dir in
do_bdev_create() was skipped. But by setting lxc.rootfs.backend on container
creation we force bdev->type to be set to e.g. overlayfs and the code gets
executed thereby exposing the bug.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-05 19:23:12 +02:00
Serge Hallyn
a3ff5b5639 Merge pull request #944 from brauner/bugfix_branch
use correct "overlayfs" instead of "ovl"
2016-04-05 09:24:36 -05:00
Christian Brauner
a5b84c6d1a use correct "overlayfs" instead of "ovl"
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-05 16:05:29 +02:00
Stéphane Graber
486c5f03f5 Merge pull request #943 from tenforward/japanese
doc: Add lxc.rootfs.backend in Japanese lxc.container.conf(5)
2016-04-04 22:44:50 -04:00
KATOH Yasufumi
933acbed73 doc: Add lxc.rootfs.backend in Japanese lxc.container.conf(5)
Update for commit f903986

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2016-04-05 11:04:59 +09:00
Stéphane Graber
6f72255b08 Merge pull request #942 from ysbnim/master
Add a document of lxc.rootfs.backend in Korean manpage
2016-04-03 23:04:53 -04:00
Sungbae Yoo
780821f8f6 Add a document of lxc.rootfs.backend in Korean manpage
Update for commit f903986

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
2016-04-04 11:26:19 +09:00
Stéphane Graber
b34944b2ec Merge pull request #941 from evgeni/spelling
fix spelling mistakes spotted by Debian's lintian
2016-04-03 12:57:22 -04:00
Evgeni Golov
e9555a6bc7 fix spelling mistakes spotted by Debian's lintian
Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-03 18:50:16 +02:00
Christian Brauner
7b193c81ac Merge pull request #936 from overlayfs/btrfs_recursive_destroy
fix btrfs_recursive_destroy
2016-04-03 18:35:11 +02:00
Oleg Freedholm
58232f8c30 store errno immediately after ioctl
Signed-off-by: Oleg Freedholm <overlayfs@gmail.com>
2016-04-04 01:15:58 +10:00
Stéphane Graber
89f6299a64 Merge pull request #940 from hallyn/2016-04-02/bdev.4
switch user facing name to lxc.rootfs.backend
2016-04-02 23:52:04 -04:00
Serge Hallyn
f9039861c0 document lxc.rootfs.backend
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 22:05:09 -05:00
Serge Hallyn
327a1e78e7 switch user facing name to lxc.rootfs.backend
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 21:32:34 -05:00
Christian Brauner
e82104d3f8 Merge pull request #939 from hallyn/2016-04-02/bdev.3
rootfs.bdev_type: implement get and clear
2016-04-03 04:03:26 +02:00
Serge Hallyn
6a21d4aeac rootfs.bdev_type: implement get and clear
clear is just set(x, ""), but before this patch that didn't work bc
"" is nota valid bdev type.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 20:43:35 -05:00
Christian Brauner
c78de02c27 Merge pull request #938 from hallyn/2016-04-02/bdev.2
use more accurate bdev_type name for rootfs.bdev
2016-04-02 23:29:07 +02:00
Serge Hallyn
b3b8c97f08 use more accurate bdev_type name for rootfs.bdev
It'll make future code reading easier.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 16:08:39 -05:00
Christian Brauner
f0a71c4a5d Merge pull request #937 from hallyn/2016-04-02/bdev
2016 04 02/bdev
2016-04-02 23:06:58 +02:00
Serge Hallyn
984bd6203a honor lxc.rootfs.bdev
If that is specified, then we only use the specified backing store type.

This can be useful if you know that lxc.rootfs is a directory type and
you do not want lxc to waste time searching for zfs, btrfs, etc.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 15:47:43 -05:00
Serge Hallyn
bfd77214f6 add a lxc.rootfs.bdev option (not yet honored)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-02 15:41:24 -05:00
Oleg Freedhom
8ba6dc5e53 fix btrfs_recursive_destroy
A change in kernel 4.2 caused btrfs_recursive_destroy to
fail to delete unprivileged containers.  This patch restores
the pre-kernel-4.2 behaviour.  Ref: Issue 935.

Signed-off-by: Oleg Freedhom <overlayfs@gmail.com>
2016-04-02 16:18:54 +00:00
Stéphane Graber
55c91e8367 change version to 2.0.0.rc15 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-31 18:10:51 -04:00