Commit Graph

4322 Commits

Author SHA1 Message Date
Baptiste Daroussin
204dfdf28b Add documentation for the new syslog logging mechanism
Signed-off-by: Baptiste Daroussin <bapt@gandi.net>
2016-07-29 23:31:48 +02:00
Baptiste Daroussin
64c57ea157 Add a new logger: syslog and Print the VM name in the logs
To activate it specify lxc.syslog = <afacility>
For now the available facilities are: daemon, local[0-7] others will be
rejected

syslog got only activated after the function that checks for inheritance
of fd is passed in order to make sure the syslog fd is not inherited
and prevent the creation of the fd is any log have been issued during
the checks (which would end up in an infinite loop)

Signed-off-by: Fatih ACAR <fatih.acar@gandi.net>
Signed-off-by: Ahmed Amamou <ahmed@gandi.net>
Signed-off-by: Baptiste Daroussin <bapt@gandi.net>
Signed-off-by: William Dauchy <william@gandi.net>
2016-07-29 23:31:48 +02:00
Christian Brauner
11b09c7aff Merge pull request #1102 from chenhaiq/master
attach: use setns instead of unshare
2016-07-28 13:23:58 +02:00
Stéphane Graber
42cbf5e246 Merge pull request #1104 from brauner/2016-07-27/fix_android_getline
Revert "Merge pull request #1103 from brauner/2016-07-27/fix_android_…
2016-07-28 12:30:27 +02:00
Christian Brauner
061f2b8a2b
Revert "Merge pull request #1103 from brauner/2016-07-27/fix_android_getline"
This reverts commit 2579641608, reversing
changes made to 813d7f1453.

Contrary to what we suspected the android build errors were not caused by
missing wrong relative include paths. Rather, they were caused by autoconf.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-28 10:56:46 +02:00
oc
dac862c015 attach: setns instead of unshare in lxc-attach
lxc-checkpoint will fail because process createdy by lxc-attach has
incorrect cgroup ns. It needs to use "setns" instead of "unshare"
to set cgroup ns.

Signed-off-by: Chen Haiquan <oc@yunify.com>
2016-07-28 09:13:30 +08:00
Stéphane Graber
2579641608 Merge pull request #1103 from brauner/2016-07-27/fix_android_getline
bdev: include own getline function in bdev.h
2016-07-27 12:28:53 -04:00
Christian Brauner
8c2e2e8f53
bdev: include own getline function in bdev.h
Fixes android build error:

bdev/bdev.c: In function 'detect_fs':
bdev/bdev.c:686:2: error: implicit declaration of function 'getline' [-Werror=implicit-function-declaration]
  while (getline(&line, &linelen, f) != -1) {
  ^

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-27 18:10:48 +02:00
Stéphane Graber
813d7f1453 Merge pull request #1101 from sergiusens/pkgconfig-prefix
Add a prefix to the lxc.pc
2016-07-26 05:16:46 -04:00
Sergio Schvezov
758243d8af Add a prefix to the lxc.pc
This allows installing to different locations and using
the lxc.pc to build using the generated includedir and
libdir.

Signed-off-by: Sergio Schvezov <sergio.schvezov@ubuntu.com>
2016-07-26 09:41:47 +02:00
Stéphane Graber
3dad8c43bf Merge pull request #1100 from brauner/2016-07-25/fix_cgfsng_lxcfs_and_cgroupfs_checkfuns
cgfsng: fix is_lxcfs() and is_cgroupfs()
2016-07-25 11:44:28 -04:00
Christian Brauner
2f62fb005b
cgfsng: fix is_lxcfs() and is_cgroupfs()
Both functions advertise that they return true when strncmp() == 0 and false
when strncmp() != 0 but so far they returned the exact opposite.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-25 17:17:39 +02:00
Christian Brauner
9d206b25f5 Merge pull request #1097 from jirutka/patch-1
lxc-alpine: mount tmpfs under /run
2016-07-23 21:31:24 +02:00
Jakub Jirutka
b5caaaa599
lxc-alpine: mount tmpfs under /run
When running under grsecurity kernel or userns, it can't be mounted from inside.

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
2016-07-23 21:26:33 +02:00
Stéphane Graber
5429ec248a Merge pull request #1094 from brauner/2016-07-22/fix_android_lxc_copy
lxc-copy: do not use mkostemp and dprintf
2016-07-22 22:30:50 +02:00
Christian Brauner
a8e279fd53
lxc-copy: do not use mkostemp and dprintf
Fixes android builds:

DSBINDIR=\"/data/lxc/lxc/sbin\"      -I/build/libcap/libcap/include/ -Wall -Werror -MT lxc_copy.o -MD -MP -MF $depbase.Tpo -c -o lxc_copy.o lxc_copy.c &&\
	mv -f $depbase.Tpo $depbase.Po
lxc_copy.c: In function 'mount_tmpfs':
lxc_copy.c:834:2: error: implicit declaration of function 'mkostemp' [-Werror=implicit-function-declaration]
  fd = mkostemp(premount, O_CLOEXEC);
  ^
lxc_copy.c:841:2: error: implicit declaration of function 'dprintf' [-Werror=implicit-function-declaration]
  ret = dprintf(fd, "#! /bin/sh\n"
  ^

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-22 21:59:24 +02:00
Stéphane Graber
bdf278a139 Merge pull request #1093 from brauner/2016-07-22/use_priu64
c/r: use PRIu64 format specifier
2016-07-22 17:10:20 +02:00
Christian Brauner
9b945f1320
c/r: use PRIu64 format specifier
Fixes build failures on arm:

criu.c: In function ‘exec_criu’:
criu.c:310:4: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
    ret = sprintf(ghost_limit, "%lu", opts->user->ghost_limit);
    ^
In file included from criu.c:42:0:
log.h:285:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
criu.c:312:5: note: in expansion of macro ‘ERROR’
     ERROR("failed to print ghost limit %lu", opts->user->ghost_limit);
     ^

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-22 11:16:43 +02:00
Stéphane Graber
3be6e5ff7c Merge pull request #1092 from LicoMonch/extend-debian-template
simple enhancements of lxc-debian-template-script
2016-07-21 22:50:44 +02:00
Andreas Freudenberg
ade83cbfd1 templates: make shellcheck (Ubuntu: 0.3.7-5 amd64) most possible happy
Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
2016-07-21 00:59:00 +02:00
Andreas Freudenberg
bf39edb39e templates: add more quotes to variables (at least $rootfs should now be covered)
Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
2016-07-21 00:58:49 +02:00
Andreas Freudenberg
e160e45018 templates: avoid noisy perl warnings caused by missing locales
Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
2016-07-21 00:58:19 +02:00
Christian Brauner
5de15f6ade Merge pull request #1091 from ysbnim/master
doc: Update Korean lxc-copy(1) to include tmpfs option
2016-07-20 11:10:25 +02:00
Sungbae Yoo
a84c8ed150 doc: Update Korean lxc-copy(1) to include tmpfs option
Update for commit a361e56

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
2016-07-20 18:00:26 +09:00
Christian Brauner
1bb4c7a5cd Merge pull request #1074 from vel21ripn/vlan_mtu
Set up MTU for vlan-type interfaces.
2016-07-20 10:32:36 +02:00
Christian Brauner
0b327c3add Merge pull request #1090 from tenforward/japanese
doc: Update Japanese lxc-copy(1) to include tmpfs option
2016-07-20 10:13:28 +02:00
KATOH Yasufumi
53a92bbcb6 doc: Update Japanese lxc-copy(1) to include tmpfs option
Update for commit a361e56

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2016-07-20 16:03:34 +09:00
Christian Brauner
e4203378cc Merge pull request #1089 from tych0/ghost-limit
c/r: add support for ghost-limit in CRIU
2016-07-20 00:26:30 +02:00
Tycho Andersen
b2b7b0d223 c/r: add support for ghost-limit in CRIU
This is an old option that we probably should have exposed long ago :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-07-19 14:27:26 -06:00
Serge Hallyn
bafda6b63b Merge pull request #1086 from brauner/detect_sigrtmin_3
[RFC]: lxccontainer: detect if we should send SIGRTMIN+3
2016-07-19 12:49:19 -05:00
Christian Brauner
330ae3d350
lxccontainer: detect if we should send SIGRTMIN+3
This is required by systemd to cleanly shutdown. Other init systems should not
have SIGRTMIN+3 in the blocked signals set.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-19 16:20:02 +02:00
Serge Hallyn
31c32ef270 Merge pull request #1087 from brauner/2016-07-16/clone_on_tmpfs
lxc-copy: update manpage to include tmpfs option
2016-07-19 08:07:47 -05:00
Christian Brauner
a361e56278
lxc-copy: update manpage to include tmpfs option
Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-19 00:04:10 +02:00
Serge Hallyn
897dcac41f Merge pull request #1084 from brauner/2016-07-16/clone_on_tmpfs
lxc-copy: allow snapshots to be placed on tmpfs
2016-07-18 13:45:50 -05:00
Christian Brauner
60a77c1822
lxc-copy: allow snapshots to be placed on tmpfs
Place an ephemeral container started with -e flag on a tmpfs. Restrictions are
that you cannot request the data to be kept while placing the container on a
tmpfs, that either overlay or aufs backing storage must be used, and that the
storage backend of the original container must be a directory.

For ephemeral snapshots backed by overlay or aufs filesystems, a fresh tmpfs
is mounted over the containers directory if the user requests it. This should
be the easiest options. Anything else would require us to change the current
mount-layout of overlay and aufs snapshots. (A standard overlay or aufs
snapshot clone currently has the layout:

	/var/lib/lxc/CLONE_SNAPSHOT/delta0      <-- upperdir
	/var/lib/lxc/CLONE_SNAPSHOT/rootfs
	/var/lib/lxc/CLONE_SNAPSHOT/olwork
	/var/lib/lxc/CLONE_SNAPSHOT/olwork/work <-- workdir

with the lowerdir being

	/var/lib/lxc/CLONE_PARENT/rootfs

The fact that upperdir and workdir are not placed in a common subfolder under
the container directory has the consequence that we cannot simply mount a fresh
tmpfs under upperdir and workdir because overlay expects them to be on the same
filesystem.)

Because we mount a fresh tmpfs over the directory of the container the updated
/etc/hostname file created during the clone residing in the upperdir (currently
named "delta0" by default) will be hidden. Hence, if the user requests that the
old name is not to be kept for the clone, we recreate this file on the tmpfs.
This should be all that is required to restore the exact behaviour we would get
with a normal clone.
NOTE: If the container is rebooted all changes made to it are lost. This is not
easy to prevent since each reboot remounts the rootfs again.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-18 20:40:13 +02:00
Vitaly Lavrov
b4fb7de1b6 Set up MTU for vlan-type interfaces.
Signed-off-by: Vitaly Lavrov <vel21ripn@gmail.com>
2016-07-18 21:25:33 +03:00
Christian Brauner
8783532601 Merge pull request #1082 from adrianreber/master
c/r: make local function static
2016-07-15 11:23:10 +02:00
Adrian Reber
c33b0338fa c/r: make local function static
This is a minimal commit which makes the function 'do_restore()' static
as it is not used anywhere else in the code. This also removes a
trailing space my editor complained about.

Signed-off-by: Adrian Reber <areber@redhat.com>
2016-07-15 10:54:30 +02:00
Christian Brauner
41a8036745 Merge pull request #1072 from adrianreber/master
c/r: drop in-flight connections during CRIU dump
2016-07-13 23:16:49 +02:00
Adrian Reber
f195450384 c/r: drop in-flight connections during CRIU dump
Shortly after CRIU 2.3 has been released a patch has been added to skip
in-flight TCP connections. In-flight connections are not completely
established connections (SYN, SYN-ACK). Skipping in-flight TCP
connections means that the client has to re-initiate the connection
establishment.

This patch stores the CRIU version detected during version check, so
that during dump/checkpoint options can be dynamically enabled depending
on the available CRIU version.

v2:
   * use the newly introduced criu version interface
   * add an option to disable skipping in-flight connections

Signed-off-by: Adrian Reber <areber@redhat.com>
2016-07-12 14:09:17 +02:00
Stéphane Graber
a4abe1bbb5 Merge pull request #1078 from brauner/2016-07-11/add_cgns
add missing cgroup namespace to ns_info struct
2016-07-12 08:01:01 -04:00
Christian Brauner
9e390993d4 Merge pull request #1077 from adrianreber/init
c/r: initialize migrate_opts properly
2016-07-11 22:52:26 +02:00
Christian Brauner
ceecc92c42 add missing cgroup namespace to ns_info struct
Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-11 22:48:48 +02:00
Adrian Reber
ebb088e115 c/r: initialize migrate_opts properly
The commit "c/r: add support for CRIU's --action-script" breaks
lxc-checkpoint on the command-line. It produces errors like:

 sh: $'\260\366\b\001': command not found

and then it fails. src/lxc/criu.c expects migrate_opts->action_script to
be either NULL, then it is ignored, or to actually contain the name of
an action scripts.

As the struct migrate_opts has not static storage is has to be explicitly
initialized or the value of the structure's members is indeterminate.

Signed-off-by: Adrian Reber <areber@redhat.com>
2016-07-11 22:03:07 +02:00
Serge Hallyn
c7d5c3e508 Merge pull request #1069 from rsampaio/rsampaio-nodev-dev
Add flag in mount_entry to skip NODEV in case of a persistent dev entry
2016-07-08 10:35:44 -05:00
Serge Hallyn
c80de904c9 Merge pull request #1073 from brauner/bugfix_branch
store criu version
2016-07-08 08:16:39 -05:00
Christian Brauner
b9aae26f1b Merge pull request #1075 from tych0/criu-action-script
c/r: add support for CRIU's --action-script
2016-07-08 01:11:27 +02:00
Tycho Andersen
b9ee6643cb c/r: add support for CRIU's --action-script
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-07-06 23:45:15 +00:00
Christian Brauner
5407e2abae store criu version
- If version != NULL criu_version_ok() stores the detected criu version in
  version. Allocates memory for version which must be freed by caller.
- If version == NULL criu_version_ok() will return true when the version
  matches, false in all other cases.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-07-06 16:07:34 +02:00
Christian Brauner
a715a9bcb2 Merge pull request #1070 from hallyn/2016-07-01/fixcg
cgfsng: don't pre-calculate path
2016-07-02 08:01:26 +02:00