Commit Graph

4488 Commits

Author SHA1 Message Date
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
Serge Hallyn
0b6ca6e39b cgfsng: don't pre-calculate path
First, we're doing this so long a there is any cgroup config item -
even if no devices ones.  Then if devices is not available we fail.
This was leading to Rob E's mysterious startup failures.

Secondly, we're not even using this info.  The user was removed
awhile back.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2016-07-01 21:18:38 -05:00
Rodrigo Vaz
ae7a770e0a Add flag in mount_entry to skip NODEV in case of a persistent dev entry
Signed-off-by: Rodrigo Vaz <rodrigo@heroku.com>
2016-07-01 18:34:11 -07:00
Christian Brauner
df5512e5df Merge pull request #1065 from stgraber/master
Fix typo found by lintian
2016-06-29 23:19:16 +02:00
Stéphane Graber
3f3fd9e2ba Fix typo found by lintian
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-29 16:56:41 -04:00
Stéphane Graber
279354fc03 Merge pull request #1064 from terceiro/fix-wheezy
lxc-debian: fix regression when creating wheezy containers
2016-06-29 14:08:48 -04:00
Antonio Terceiro
f95776dffa lxc-debian: fix regression when creating wheezy containers
The regression was introduced by commit
3c39b0b7a2 which makes it possible to
create working stretch containers by forcinig `init` to be in the
included package list.

However, `init` didn't exit before jessie, so now for wheezy we
explicitly include `sysvinit`; sysvinit on wheezy is essential,
so it would already be included anyway.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
2016-06-29 15:04:57 -03:00
Stéphane Graber
60cfbd8a92 apparmor: Refresh generated file
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-28 15:35:58 -04:00
Stéphane Graber
d6c86f57fa Merge pull request #1063 from pdsouza/pdsouza/fix-bionic-lxcmntent
Include all lxcmntent.h function declarations on Bionic
2016-06-28 13:36:46 -04:00
Preetam D'Souza
702f5a1c64 Include all lxcmntent.h function declarations on Bionic
Newer versions of Android (5.0+, aka API Level 21+) include mntent.h,
which declares setmntent and endmntent. This hits an edge
case with the preprocessor checks in lxcmntent.h because HAVE_SETMNTENT
and HAVE_ENDMNTENT are both defined (in Bionic's mntent.h), but conf.c
always includes lxcmntent.h on Bionic! As a result, we get compiler
warnings of implicit function declarations for setmntent endmntent.

This patch always includes setmntent/endmntent/hasmntopt function
declarations on Bionic, which gets rid of these warnings.

Signed-off-by: Preetam D'Souza <preetamjdsouza@gmail.com>
2016-06-28 16:52:06 +00:00
Stéphane Graber
9aea6610d9 Merge pull request #1062 from tych0/fully-manage-cgroups
c/r: use criu's "full" mode for cgroups
2016-06-27 21:15:37 -04:00
Tycho Andersen
0a5fc6dfa7 c/r: use criu's "full" mode for cgroups
A while ago cgroup modes were introduced to CRIU, which slightly changed
the behavior w.r.t. cgroups under the hood. What we're really after is
criu's --full mode, i.e. even if a particular cgroup directory exists
(in particular /lxc/$container[-$number] will, since we create it), we
should restore perms on that cgroup.

Things worked just fine for actual properties (except "special" properties
as criu refers to them, which I've just sent a patch for) because liblxc
creates no subdirectories, just the TLD.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-06-27 22:24:09 +00:00
Laurent Vivier
4737d51a62 lxc-debian: add btrfs support
copied from lxc-ubuntu.in

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Serge Hallyn <serge@hallyn.com>
2016-06-27 16:20:53 -04:00
Laurent Vivier
6ffa329178 lxc-debian: add --flush-cache
copied from lxc-ubuntu.in

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Serge Hallyn <serge@hallyn.com>
2016-06-27 16:20:53 -04:00
Wolfgang Bumiller
667cfb7c2d AppArmor: add make-rslave to usr.bin.lxc-start
The profile already contains
  mount options=(rw, make-slave) -> **,

Which allows going through all mountpoints with make-slave,
so it seems to make sense to also allow the directly
recursive variant with "make-rslave".

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-06-27 16:20:00 -04:00
Serge Hallyn
42c6b8d809 Merge pull request #1061 from stgraber/master
More apparmor tweaks
2016-06-27 15:11:08 -05:00
Stéphane Graber
7f2b13275d apparmor: Update mount states handling
Properly list all of the states and the right apparmor stanza for them,
then comment them all as actually enabling this would currently let the
user bypass apparmor entirely.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-27 16:03:49 -04:00
Stéphane Graber
af5f70c4b5 apparmor: allow mount move
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-27 15:11:47 -04:00
Stéphane Graber
b2a245c2b4 Merge pull request #1056 from AnrDaemon/patch-1
Force lxc-instance to behave like a good Upstart client
2016-06-23 23:21:44 -04:00
AnrDaemon
abf28de1e6 Force lxc-instance to behave like a good Upstart client
Remove unnecessary shell wrap around job start.
Force foreground execution to allow job monitoring and control.

Signed-off-by Andrey Repin <anrdaemon@yandex.ru>
2016-06-24 06:19:51 +03:00
Christian Brauner
18f9cbeea7 Merge pull request #1055 from stgraber/master
apparmor: Allow bind-mounts and {r}shared/{r}private
2016-06-23 23:28:19 +02:00
Stéphane Graber
e96e7a1ac7 apparmor: Allow bind-mounts and {r}shared/{r}private
Bind-mounts aren't harmful in containers, so long as they're not used to
bypass MAC policies.

This change allows bind-mounting of any path which isn't a dangerous
filesystem that's otherwise blocked by apparmor.

This also allows switching paths {r}shared or {r}private.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-23 16:01:29 -04:00
Christian Brauner
2323b39d48 Merge pull request #1053 from tenforward/plamo
plamo: Improve Plamo template
2016-06-21 14:33:39 +02:00
KATOH Yasufumi
1dd810a1d6 plamo: Improve Plamo template
* configure to start only the minimum of service
* add ntp, kmod to ignore packages

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2016-06-21 17:17:54 +09:00
Stéphane Graber
c0da9d264c Merge pull request #1052 from terceiro/debian-init
lxc-debian: make sure init is installed
2016-06-18 08:29:04 -04:00
Antonio Terceiro
3c39b0b7a2 lxc-debian: make sure init is installed
init 1.34 is not "Essential" anymore, in order to make it not required
on minimal chroots, docker containers, etc. Because of that we now need
to manually include it on systems that are expected to boot.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
2016-06-18 09:22:47 -03:00
Stéphane Graber
f6578a7bb2 Merge pull request #1047 from brauner/mips_container
lxc-debian: allow to specify a binfmt interpreter
2016-06-13 18:36:29 -04:00
Laurent Vivier
d50cebd697 lxc-debian: allow to specify a binfmt interpreter
If you specify an interpreter path with "-I" or "--interpreter-path",
the architecture of the debian container can differ from the one of
the host.

Before creating the container, binfmt must be configured on the host:
the script checks the name of the interpreter in /proc/sys/fs/binfmt_misc/
to know where to install it in the container.

To create a MIPS container on an x86_64 host:

$ cat /proc/sys/fs/binfmt_misc/qemu-mips
enabled
interpreter //qemu-mips
flags: OC
offset 0
magic 7f454c4601020100000000000000000000020008
mask ffffffffffffff00fffffffffffffffffffeffff

$ sudo lxc-create -n virtmips-stretch -t debian -- \
                 --arch=mips \
                 --interpreter-path=./mips-linux-user/qemu-mips \
                 --mirror=http://ftp.debian.org/debian \
                 --release=stretch

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2016-06-13 22:12:54 +02:00
Serge Hallyn
56c80e0d4d Merge pull request #1045 from thtanaka/console-login-ol72
Unable to login via console in OL7.2
2016-06-09 16:38:49 -05:00
Thomas Tanaka
6efaa00c7f Unable to login via console in OL7.2
There is container-getty.service with OL7.2 systemd, it
is also used for managing the getty service, use that
instead and not manually create it.

Signed-off-by: Thomas Tanaka <thomas.tanaka@oracle.com>
2016-06-09 13:41:02 -07:00
Christian Brauner
b5cacc178e Merge pull request #1043 from stgraber/master
Drop lxc-devsetup as unneeded by current autodev
2016-06-07 21:29:52 +02:00
Stéphane Graber
7c76d6b7b7 Drop lxc-devsetup as unneeded by current autodev
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-07 15:11:07 -04:00
Christian Brauner
f01b8bcfe5 Merge pull request #1042 from GreatFruitOmsk/python-rpath
python-lxc: follow global rpath setting for autotools builds
2016-06-06 12:49:27 +02:00
Aleksandr Mezin
2c500c107a python-lxc: follow global rpath setting for autotools builds
When LXC is configured with --enable-rpath, I expect Python bindings
to be able to find the library in a non-standard location, just like
LXC command-line tools.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2016-06-06 07:50:59 +06:00
Stéphane Graber
9d54166ca5 Merge pull request #1040 from odyssey4me/include_apt_transport_https
Move apt-transport-https to global packages_template
2016-06-03 11:37:02 -04:00