Commit Graph

5283 Commits

Author SHA1 Message Date
walkerning
8513d8cd02 Check if stdout is a terminal in lxc-checkconfig
Let lxc-checkconfig write to non-tty stdout without color control
characters
Signed-off-by: walkerning <foxdoraame@gmail.com>
2016-05-01 10:05:10 +08:00
Serge Hallyn
1970a777ed Merge pull request #991 from brauner/2016-04-28/less_syscall_for_lxc_ls
2016 04 28/less syscall for lxc ls
2016-04-29 13:26:26 -05:00
Christian Brauner
688cd8439d lxc-ls: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-28 23:45:05 +02:00
Christian Brauner
6daa3ea5ba lxc-ls: use fewer syscalls when doing ipc
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-28 23:45:00 +02:00
Stéphane Graber
1bf4292e3f Merge pull request #978 from evgeni/lsb-init-scripts
don't make sysv init scripts dependant on distribution specifics
2016-04-25 15:55:49 +02:00
Christian Brauner
a14574ba84 Merge pull request #987 from tenforward/japanese
doc: Add logging option to Japanese lxc-attach(1)
2016-04-25 12:35:19 +02:00
KATOH Yasufumi
8359be8c82 doc: Add logging option to Japanese lxc-attach(1)
Update for commit f43d63b

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2016-04-25 19:30:03 +09:00
Stéphane Graber
53d6eeded2 Update maintainers
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-04-24 18:34:31 -04:00
Leonid Isaev
5590a671bc Initialize a pointer in split_init_cmd() to avoid gcc warnings
gcc -Wall warns about uninitialized variables (-Wmaybe-uninitialized), and
-Werror makes it fatal. This change allows the build to succeed by NULL'ifying
the pointer passed to strtok_r().

Note that strtok_r(3) anyway ignores a non-NULL arg3 pointer on the 1st call
with non-NULL arg1 string.

Signed-off-by: Leonid Isaev <leonid.isaev@jila.colorado.edu>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-22 16:29:13 -05:00
Serge Hallyn
1ee85fbcc4 Merge pull request #982 from brauner/2016-04-19/mimic_ssh
use raw settings of ssh for pty
2016-04-19 13:27:16 -05:00
Christian Brauner
a7c97a40ec use raw settings of ssh for pty
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-19 15:17:19 +02:00
Christian Brauner
cb730f0125 Merge pull request #981 from LynxChaus/master
Switch console pty to raw mode.
2016-04-18 21:25:41 +02:00
Andrey Jr. Melnikov
d389339970 Switch console pty to raw mode. Without this some ncurses-based programs behave incorrectly
Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
2016-04-18 19:16:08 +03:00
Evgeni Golov
3083782cf8 don't make sysv init scripts dependant on distribution specifics
- /etc(/rc.d)?/init.d/functions does not exist on all distributions
- LSB does not define a message function without an explicit status
- Debian-derived systems add a log_daemon_msg for that

lets define an own log_daemon_msg as echo and try to load LSB init
functions afterwards, which might overload it with a nicer version

that way the init scripts should work on any system, without hard
dependencies on neither LSB nor /etc/init.d/functions

Closes #309 #310 #311

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-15 21:23:57 +02:00
Christian Brauner
85145234e7 Merge pull request #976 from evgeni/drop-syslog.target
drop obsolete syslog.target from lxc.service.in
2016-04-15 13:11:29 +02:00
Evgeni Golov
a5747ee708 drop obsolete syslog.target from lxc.service.in
the target is obsolete since systemd v38 which everybody should have.

original patch by Daniel Baumann

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-14 18:03:29 +02:00
Stéphane Graber
da1eace1de Merge pull request #974 from ar45/lxc_python_create_with_tuple
Fixed python-lxc reference to var before assignment
2016-04-14 00:41:12 -04:00
Aron Podrigal
9cee41def4 Fixed python-lxc reference to var before assignment
```
>>> c = lxc.Container('ct')
>>> c.create('debian', args=('-r', 'jessie'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/lxc/__init__.py", line 229, in
create
    template_args['args'] = tuple(tmp_args)
UnboundLocalError: local variable 'tmp_args' referenced before
assignment
```

Signed-off-by: Aron Podrigal <aronp@guaranteedplus.com>
2016-04-14 00:24:08 -04:00
Stéphane Graber
8157403674 Merge pull request #972 from evgeni/lsb-headers
add missing lsb headers to sysvinit scripts
2016-04-13 18:47:53 -04:00
Christian Brauner
dd132eaa27 Merge pull request #973 from evgeni/debian-no-rootpw
do not set the root password in the debian template
2016-04-14 00:32:56 +02:00
Evgeni Golov
515fb8d20c do not set the root password in the debian template
closes #302

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-13 18:04:19 +02:00
Evgeni Golov
26ca5e5bcf add missing lsb headers to sysvinit scripts
original patch by Daniel Baumann

closes #308

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-13 17:55:48 +02:00
Serge Hallyn
ba03fa64b9 Merge pull request #970 from brauner/2016-04-13/lxc_attach_log
lxc-attach: error on -L/--pty-log + redirection
2016-04-13 10:19:03 -05:00
Christian Brauner
804bd6e32f only execute last test when we are a pty
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-13 16:54:15 +02:00
Christian Brauner
e4be55c41f Merge pull request #971 from hallyn/2016-04-12/nosystemd
cgfsng: don't require that systemd subsystem be mounted
2016-04-13 16:40:19 +02:00
Christian Brauner
c87524b77b lxc-attach: error on -L/--pty-log + redirection
pty logging only works correctly when stdout and stderr refer to a pty. If they
do not, we do not dup2() them and lxc_console_cb_con() will never write to the
corresponding log file descriptor.

When redirection on stdout and stderr is used we can safely assume that the user
is already logging to a file or /dev/null and creating an additional pty log
doesn't seem to make sense.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-13 15:23:35 +02:00
Stéphane Graber
c4828d7416 Merge pull request #966 from evgeni/SOURCE_DATE_EPOCH
nicer date format and support for SOURCE_DATE_EPOCH in LXC_GENERATE_DATE
2016-04-12 15:38:01 -04:00
Serge Hallyn
c30b61c376 cgfsng: don't require that systemd subsystem be mounted
Note that is_crucial_subsystem still lists name=systemd.  That is
used in cgfs and cgmanager.  Cgmanager is typically setup to create
name=systemd, so it is ok.  cgfs uses is_crucial_subsystem() only
to decide whether failure to create or chown a directory should be
terminal.  That's ok, because (a) if name=systemd is not mounted then
we won't hit that, and (b) if name=systemd is mounted, then we'd
really still like to set it up for containers.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-04-12 12:41:39 -05:00
Evgeni Golov
8d256e4de7 nicer date format and support for SOURCE_DATE_EPOCH in LXC_GENERATE_DATE
Using $(date) for LXC_GENERATE_DATE has various flaws:
* formating depends on the locale of the system we execute configure on
* the output is not really a date but more a timestamp

Let's use $(date --utc '+%Y-%m-%d') instead.

While at it, also support SOURCE_DATE_EPOCH [1] to make the build
reproducible

[1] https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-04-12 19:20:10 +02:00
Serge Hallyn
1f7c5761aa Merge pull request #964 from brauner/2016-04-11/lxc_attach_manpage
lxc-attach: add logging option to manpage
2016-04-12 10:22:41 -05:00
Serge Hallyn
3e9b7c1bde Merge pull request #965 from brauner/2016-04-12/lxc_destroy_avoid_double_print
lxc-destroy: avoid double print
2016-04-11 17:42:17 -05:00
Christian Brauner
446ca81091 lxc-destroy: avoid double print
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-04-12 00:02:21 +02:00
Serge Hallyn
d227bed9de Merge pull request #962 from staticfox/gitignore
Ignore temporary files generated by doxygen
2016-04-11 15:10:07 -05:00
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
staticfox
c3e258d18c Ignore temporary files generated by doxygen
Signed-off-by: Matt Ullman <staticfox@staticfox.net>
2016-04-11 10:54:44 -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