Commit Graph

3775 Commits

Author SHA1 Message Date
Tycho Andersen
040fef656c c/r: bump criu patchlevel for --lsm-profile
This option is only available in recent master of criu, so let's require
that since we're using it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-20 22:42:28 -05:00
Tycho Andersen
13389b2963 c/r: use --lsm-profile if provided
Since we can rename a container on a migrate, let's tell CRIU to use the
LSM profile name the user has specified. This change is motivated by LXD,
which sets an LSM profile name based on the container name, so if a user
changes the name of a container during migration, the old profile name
(that criu has saved) won't exist on the new host.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-20 22:42:28 -05:00
Serge Hallyn
a14bf84f75 Merge pull request #724 from brauner/2015-12-12/split_bdev_into_modules
split bdev into modules
2015-12-20 19:28:43 -08:00
Christian Brauner
5c484f794d Move remaining overlay helpers to overlay.{c,h}
Move
	- ovl_get_rootfs_dir()
	- mount_entry_create_overlay_dirs()

from conf.h to overlay.{c,h} where they belong.

Rename
	- mount_entry_create_overlay_dirs() --> ovl_mkdir()

in accordance with the ovl_ prefix naming scheme for types and functions
associated with overlay.

Take the chance to add whitespace between operators where missing.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-15 17:03:58 +01:00
Christian Brauner
83e79752a2 Unify naming for overlay types & functions
Use ovl_ as prefix for types and functions.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-15 17:03:58 +01:00
Christian Brauner
4ec31c5224 Adapt #includes for bdev.h to bdev/bdev.h
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-15 17:03:58 +01:00
Christian Brauner
38683db412 Split bdev into modules: overlay
With this commit we start to split bdev.{c,h} into modules located in the
subfolder bdev. We start by creating a module for overlay: overlay.{c,h}.

- The functions:

	- overlayfs_detect()
	- overlayfs_mount()
	- overlayfs_umount()
	- overlayfs_clonepaths()
	- overlayfs_destroy()
	- overlayfs_create()

  move from bdev.{c,h} to overlay.{c,h}. The only thing that remains in bdev.c
  is the static definition of

	- static const struct bdev_ops overlayfs_ops

- The functions:

	- update_ovl_paths()
	- overlay_getlower()

  move from lxccontainer.c to overlay.{c,h}. update_ovl_paths() is used to
  update absolute paths for overlay lxc.mount.entry entries but it seems to fit
  more here than into lxccontainer.c.
  The Function overlay_getlower() is used to extract the lower directory for
  overlay (and aufs) rootfs. It should at some point become a common helper.

- The functions:

	- do_rsync()
	- dir_new_path()

   remain in bdev.c for now but become extern. We declare them extern in
   overlay.c to be able to call them. As the comment to them correctly notices,
   they should at some point become common helpers and probably move to
   utils.{c,h} or some other more appropriate place.

- The structs:

	- struct bdev; /* defined in bdev.h */
	- struct bdev_specs; /* defined in lxccontainer.h */
	- struct lxc_conf; /* defined conf.h */

  are forward declared/put as incomplete types in overlay.h so that the
  functions have access to it.

- The header overlay.h is *not* included in bdev.h but only in bdev.c so that
  when bdev.h is included the public functions in overlay.h cannot be accessed,
  i.e. if an implementation wants to call functions from overlay.h they need to
  explicitly include it. (As is e.g. done in the case of lxccontainer.c.)

- The header

	- lxc-btrfs.h

  also moves to the bdev subfolder.

- Adapt Makefile.am to the new bdev layout.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-15 17:03:58 +01:00
Stéphane Graber
fbc617e84b Merge pull request #727 from fanyeren/patch-17
lxc-top: print new line after flush terminal
2015-12-15 10:59:54 -05:00
Stéphane Graber
aafeda8291 Merge pull request #719 from liqiu/li-dev2
Return immediately in save_phys_nics if not run as root
2015-12-15 10:56:12 -05:00
Stéphane Graber
dbadf422e1 Merge pull request #721 from armcc/master
lxc-checkconfig: remove zgrep dependency
2015-12-15 10:54:53 -05:00
Wesley M
727c307376 Refactoring conditional directives.
Signed-off-by: Wesley Marques <wesleymr.27@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-15 10:47:22 -05:00
fanyeren
4db667c4fa lxc-top: print new line after flush terminal
I think this is a common feature for top-like programs.

Signed-off-by: feng xiahou xiahoufeng@yahoo.com
2015-12-15 16:11:38 +08:00
Andre McCurdy
8c6edda4fc lxc-checkconfig: remove zgrep dependency
zgrep is a script provided by the 'gzip' package, which may not be
installed on embedded systems etc which use busybox instead of the
standard full-featured utilities.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
2015-12-14 22:51:57 -08:00
Stéphane Graber
ab5723672b Merge pull request #670 from ksperis/master
Add Ceph RBD backingstore.
2015-12-15 00:36:02 -05:00
Laurent Barbe
93068560df Fix mkdir error if it already exist
Signed-off-by: Laurent Barbe <laurent@ksperis.com>
2015-12-13 22:35:43 +01:00
Laurent Barbe
7ed52ec63c Fix API break on bdev_specs
Signed-off-by: Laurent Barbe <laurent@ksperis.com>
2015-12-13 22:35:43 +01:00
Laurent Barbe
a237da92a0 Fix alloca size in rbd_destroy
Signed-off-by: Laurent Barbe <laurent@ksperis.com>
2015-12-13 22:35:43 +01:00
Laurent Barbe
60656b379b doc: Add 'rbd' to the parameter of backingstore in lxc-create(1)
Signed-off-by: Laurent Barbe <laurent@ksperis.com>
2015-12-13 22:35:43 +01:00
Laurent Barbe
7da812df93 Add Ceph RBD backingstore
With lxc-create, this will create, map and mount a Rados blockdevice.
A valid ceph.conf and ceph.client.admin.keyring is needed in /etc/ceph/
RBD mapping is not manage on reboot.

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
2015-12-13 22:35:43 +01:00
Li Qiu
40f2f8a23e Return immediately in save_phys_nics if not run as root
Physical nic is not instantiated in lxc_create_network

Signed-off-by: Li Qiu <li.qiu@nomovok.com>
2015-12-11 08:24:12 +02:00
Christian Brauner
c261392712 Add concise explanations
- explain functions in list.h
- let lxc_list_len() return size_t instead of int

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-11 01:17:53 -05:00
Stéphane Graber
e08ad7ca7e
Add lxc-copy to gitignore
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-11 01:14:34 -05:00
Stéphane Graber
bd7b4e282b Fix seccomp profile on attach of undefined container
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
2015-12-11 01:14:18 -05:00
Stéphane Graber
d86eb75c05 Merge pull request #717 from fanyeren/patch-4
lxc-top: limit BLKIO to 14 characters
2015-12-11 01:09:22 -05:00
fanyeren
c78aa2c625 lxc-top: limit BLKIO to 14 characters
limit BLKIO columns to 10 characters is too small,i think 14 is a better value

Signed-off-by: feng xiahou xiahoufeng@yahoo.com
2015-12-11 13:56:24 +08:00
Stéphane Graber
9d7de2fb27 Merge pull request #716 from fanyeren/patch-15
lxc-top: limit CPU to 8 characters
2015-12-11 00:32:14 -05:00
fanyeren
51fdb0fba2 lxc-top: limit CPU to 8 characters
limit CPU columns to 8 characters is too small,i think 12 is a better value
2015-12-11 13:25:52 +08:00
Andrey Jr. Melnikov
9bfdc2235c Add LUA api get_ips(), get_interfaces(), rename() functions
Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-10 13:08:11 -05:00
Stéphane Graber
6a5640665c Update get_item test after the lxc.mount.entry fix
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 23:54:28 -05:00
Stéphane Graber
33ae222cf9 Merge pull request #710 from hnakamur/improve_lxc_copy_japanese_manpage
Improve the lxc-copy Japanese manpage
2015-12-09 23:03:31 -05:00
Serge Hallyn
a7c6b8c7b7 fix 'lxc.mount.entry' key when clearing unexpanded config
Closes #712

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-09 23:01:21 -05:00
Tycho Andersen
f8a41688ec c/r: add more logging when restore fails
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 23:00:26 -05:00
Tycho Andersen
e9195050b4 c/r: escape cgroups before exec()ing criu
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 23:00:23 -05:00
Tycho Andersen
06078509e3 cgroup: add cgroup_escape() call
We'll use this in the next patch to escape to the root cgroup before we
exec criu.

v2: s/cgm_connected/cmg_needs_disconnect/g

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 23:00:21 -05:00
Sungbae Yoo
ba3004da53 Add LXC_TARGET env to Korean lxc.container.conf(5)
Update for commit c154af9

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-09 22:59:08 -05:00
TAMUKI Shoichi
af2d9fad6e Add support for new target plamo to configure.ac
Add support for new target plamo to specify the linux distribution.
Plamo Linux uses sysvinit.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:57:06 -05:00
TAMUKI Shoichi
cdcae1034c Fold dnsmasq command line in lxc-net.in
Fold dnsmasq command line at about 80 chars because the line is too
long.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:56:59 -05:00
Tycho Andersen
fa07124900 c/r: remove random line continuations
No idea how these got there, but let's get rid of them since they're weird.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:56:52 -05:00
Tycho Andersen
aef3d51e61 c/r: add a new ->migrate API call
This patch adds a new ->migrate API call with three commands:

MIGRATE_DUMP: this is basically just ->checkpoint()
MIGRATE_RESTORE: this is just ->restore()
MIGRATE_PRE_DUMP: this can be used to invoke criu's pre-dump command on the
    container.

A small addition to the (pre-)dump commands is the ability to specify a
previous partial dump directory, so that one can use a pre-dump of a
container.

Finally, this new API call uses a structure to pass options so that it can
be easily extended in the future (e.g. to CRIU's --leave-frozen option in
the future, for potentially smarter failure handling on restore).

v2: remember to flip the return code for legacy ->checkpoint and ->restore
    calls

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:53:59 -05:00
Tycho Andersen
6bf5b3da1e c/r: bump criu version requirements
Since we're relying on 1.8 for the seccomp stuff, let's refuse to use
anything lower than that.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:53:34 -05:00
Tycho Andersen
8164f0e253 api wrapper: only reset the current config if this call set it
Instead of *always* resetting the current_config to null, we should only
reset it if this API call set it.

This allows nesting of API calls, e.g. c->checkpoint() can pass stuff into
criu.c, which can call c->init_pid() and not lose the ability to log stuff
afterwards.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:53:31 -05:00
Serge Hallyn
23820d548d prune_init_cgroup: don't dereference NULL
This is to avoid:

https://errors.ubuntu.com/problem/d640a68bf7343705899d7ca8c6bc070d477cd845

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2015-12-07 10:14:40 -06:00
Hiroaki Nakamura
988247d5ad Improve the lxc-copy Japanese manpage
Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
2015-12-05 01:08:22 +09:00
KATOH Yasufumi
86b484e979 doc: Add lxc.monitor.unshare to lxc.container.conf(5)
Update for commit a8dfe4e and 6039eaa

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 13:53:38 -05:00
KATOH Yasufumi
3c08e89391 Add LXC_TARGET env to Japanese lxc.container.conf(5)
Update for commit c154af9

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 13:53:36 -05:00
KATOH Yasufumi
842948e416 doc: Add Japanese manpage for lxc-copy
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 13:53:34 -05:00
Christian Brauner
ca3995947f Conditional compilation for ARM and PPC
Check if symbols SCMP_ARCH_ARM and SCMP_ARCH_PPC are defined.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-03 13:52:29 -05:00
Serge Hallyn
7635139aa8 seccomp: support 32-bit arm on arm64, and 32-bit ppc on ppc64
Generally we enforce that a [arch] seccomp section can only be used on [arch].
However, on amd64 we allow [i386] sections for i386 containers, and there we
also take [all] sections and apply them for both 32- and 64-bit.

Do that also for ppc64 and arm64.  This allows seccomp-protected armhf
containers to run on arm64.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 01:15:40 -05:00
Serge Hallyn
480c876b20 apparmor: support lxc.aa_profile = unchanged
In which case lxc will not update the apparmor profile at all.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 01:14:37 -05:00
Sungbae Yoo
b035f79209 doc: Add Korean manpage for lxc-copy
Update for commit 2b47bac

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-12-03 01:14:34 -05:00