]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
9 years agopython-lxc: Call PyOS_AfterFork after attaching to a container 739/head
Danil Osherov [Thu, 24 Dec 2015 13:54:19 +0000 (16:54 +0300)] 
python-lxc: Call PyOS_AfterFork after attaching to a container

As lxc_attach() calls fork() PyOS_AfterFork should be called in the new
process if the Python interpreter will continue to be used.

Signed-off-by: Danil Osherov <shindo@yandex-team.ru>
9 years agoMerge pull request #738 from ec-m/ec-m_lxc-ls
Serge Hallyn [Wed, 23 Dec 2015 22:36:23 +0000 (14:36 -0800)] 
Merge pull request #738 from ec-m/ec-m_lxc-ls

Fix swap calculation (#737)

9 years agoFix swap calculation 738/head
Eva Charlotte Mayer [Wed, 23 Dec 2015 12:15:26 +0000 (13:15 +0100)] 
Fix swap calculation

Signed-off-by: Eva Charlotte Mayer <eva-charlotte.mayer@posteo.de>
9 years agochange version to 2.0.0.beta1 in configure.ac lxc-2.0.0.beta1
Stéphane Graber [Mon, 21 Dec 2015 17:52:33 +0000 (12:52 -0500)] 
change version to 2.0.0.beta1 in configure.ac

Note that LXC 2.0 remains backward compatible with 1.0, so the ABI
version is 1.2, not 2.0.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add 'rbd' to the parameter of backingstore in Japanese lxc-create(1)
KATOH Yasufumi [Tue, 15 Dec 2015 11:07:10 +0000 (20:07 +0900)] 
doc: Add 'rbd' to the parameter of backingstore in Japanese lxc-create(1)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add 'rbd' to the parameter of backingstore in Korean lxc-create(1)
Sungbae Yoo [Tue, 15 Dec 2015 09:47:25 +0000 (09:47 +0000)] 
doc: Add 'rbd' to the parameter of backingstore in Korean lxc-create(1)

Update for commit 60656b3

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add lxc.monitor.unshare to Korean lxc.container.conf(5)
Sungbae Yoo [Mon, 14 Dec 2015 06:20:46 +0000 (06:20 +0000)] 
doc: Add lxc.monitor.unshare to Korean lxc.container.conf(5)

Update for commit a8dfe4e and 6039eaa

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoc/r: bump criu patchlevel for --lsm-profile
Tycho Andersen [Fri, 11 Dec 2015 23:21:54 +0000 (16:21 -0700)] 
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>
9 years agoc/r: use --lsm-profile if provided
Tycho Andersen [Fri, 11 Dec 2015 23:21:53 +0000 (16:21 -0700)] 
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>
9 years agoMerge pull request #724 from brauner/2015-12-12/split_bdev_into_modules
Serge Hallyn [Mon, 21 Dec 2015 03:28:43 +0000 (19:28 -0800)] 
Merge pull request #724 from brauner/2015-12-12/split_bdev_into_modules

split bdev into modules

9 years agoMove remaining overlay helpers to overlay.{c,h} 724/head
Christian Brauner [Tue, 15 Dec 2015 14:19:08 +0000 (15:19 +0100)] 
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>
9 years agoUnify naming for overlay types & functions
Christian Brauner [Sun, 13 Dec 2015 18:44:09 +0000 (19:44 +0100)] 
Unify naming for overlay types & functions

Use ovl_ as prefix for types and functions.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoAdapt #includes for bdev.h to bdev/bdev.h
Christian Brauner [Sat, 12 Dec 2015 22:21:55 +0000 (23:21 +0100)] 
Adapt #includes for bdev.h to bdev/bdev.h

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoSplit bdev into modules: overlay
Christian Brauner [Sat, 12 Dec 2015 21:48:33 +0000 (22:48 +0100)] 
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>
9 years agoMerge pull request #727 from fanyeren/patch-17
Stéphane Graber [Tue, 15 Dec 2015 15:59:54 +0000 (10:59 -0500)] 
Merge pull request #727 from fanyeren/patch-17

lxc-top: print new line after flush terminal

9 years agoMerge pull request #719 from liqiu/li-dev2
Stéphane Graber [Tue, 15 Dec 2015 15:56:12 +0000 (10:56 -0500)] 
Merge pull request #719 from liqiu/li-dev2

Return immediately in save_phys_nics if not run as root

9 years agoMerge pull request #721 from armcc/master
Stéphane Graber [Tue, 15 Dec 2015 15:54:53 +0000 (10:54 -0500)] 
Merge pull request #721 from armcc/master

lxc-checkconfig: remove zgrep dependency

9 years agoRefactoring conditional directives.
Wesley M [Tue, 15 Dec 2015 15:47:22 +0000 (10:47 -0500)] 
Refactoring conditional directives.

Signed-off-by: Wesley Marques <wesleymr.27@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-top: print new line after flush terminal 727/head
fanyeren [Tue, 15 Dec 2015 08:11:38 +0000 (16:11 +0800)] 
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
9 years agolxc-checkconfig: remove zgrep dependency 721/head
Andre McCurdy [Fri, 11 Dec 2015 20:35:55 +0000 (12:35 -0800)] 
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>
9 years agoMerge pull request #670 from ksperis/master
Stéphane Graber [Tue, 15 Dec 2015 05:36:02 +0000 (00:36 -0500)] 
Merge pull request #670 from ksperis/master

Add Ceph RBD backingstore.

9 years agoFix mkdir error if it already exist 670/head
Laurent Barbe [Sun, 13 Dec 2015 21:31:42 +0000 (22:31 +0100)] 
Fix mkdir error if it already exist

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
9 years agoFix API break on bdev_specs
Laurent Barbe [Sun, 13 Dec 2015 21:30:30 +0000 (22:30 +0100)] 
Fix API break on bdev_specs

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
9 years agoFix alloca size in rbd_destroy
Laurent Barbe [Wed, 14 Oct 2015 07:52:50 +0000 (09:52 +0200)] 
Fix alloca size in rbd_destroy

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
9 years agodoc: Add 'rbd' to the parameter of backingstore in lxc-create(1)
Laurent Barbe [Mon, 5 Oct 2015 19:58:24 +0000 (21:58 +0200)] 
doc: Add 'rbd' to the parameter of backingstore in lxc-create(1)

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
9 years agoAdd Ceph RBD backingstore
Laurent Barbe [Fri, 2 Oct 2015 10:45:14 +0000 (12:45 +0200)] 
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>
9 years agoReturn immediately in save_phys_nics if not run as root 719/head
Li Qiu [Fri, 11 Dec 2015 05:54:10 +0000 (07:54 +0200)] 
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>
9 years agoAdd concise explanations
Christian Brauner [Thu, 10 Dec 2015 04:26:18 +0000 (05:26 +0100)] 
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>
9 years agoAdd lxc-copy to gitignore
Stéphane Graber [Fri, 11 Dec 2015 06:14:34 +0000 (01:14 -0500)] 
Add lxc-copy to gitignore

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFix seccomp profile on attach of undefined container
Stéphane Graber [Thu, 10 Dec 2015 23:58:58 +0000 (18:58 -0500)] 
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>
9 years agoMerge pull request #717 from fanyeren/patch-4
Stéphane Graber [Fri, 11 Dec 2015 06:09:22 +0000 (01:09 -0500)] 
Merge pull request #717 from fanyeren/patch-4

lxc-top: limit BLKIO to 14 characters

9 years agolxc-top: limit BLKIO to 14 characters 717/head
fanyeren [Fri, 11 Dec 2015 05:56:24 +0000 (13:56 +0800)] 
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
9 years agoMerge pull request #716 from fanyeren/patch-15
Stéphane Graber [Fri, 11 Dec 2015 05:32:14 +0000 (00:32 -0500)] 
Merge pull request #716 from fanyeren/patch-15

lxc-top: limit CPU to 8 characters

9 years agolxc-top: limit CPU to 8 characters 716/head
fanyeren [Fri, 11 Dec 2015 05:25:52 +0000 (13:25 +0800)] 
lxc-top: limit CPU to 8 characters

limit CPU columns to 8 characters is too small,i think 12 is a better value

9 years agoAdd LUA api get_ips(), get_interfaces(), rename() functions
Andrey Jr. Melnikov [Thu, 10 Dec 2015 18:08:11 +0000 (13:08 -0500)] 
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>
9 years agoUpdate get_item test after the lxc.mount.entry fix
Stéphane Graber [Thu, 10 Dec 2015 04:45:26 +0000 (23:45 -0500)] 
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>
9 years agoMerge pull request #710 from hnakamur/improve_lxc_copy_japanese_manpage
Stéphane Graber [Thu, 10 Dec 2015 04:03:31 +0000 (23:03 -0500)] 
Merge pull request #710 from hnakamur/improve_lxc_copy_japanese_manpage

Improve the lxc-copy Japanese manpage

9 years agofix 'lxc.mount.entry' key when clearing unexpanded config
Serge Hallyn [Thu, 10 Dec 2015 02:12:41 +0000 (02:12 +0000)] 
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>
9 years agoc/r: add more logging when restore fails
Tycho Andersen [Tue, 8 Dec 2015 23:08:11 +0000 (16:08 -0700)] 
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>
9 years agoc/r: escape cgroups before exec()ing criu
Tycho Andersen [Tue, 8 Dec 2015 23:08:10 +0000 (16:08 -0700)] 
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>
9 years agocgroup: add cgroup_escape() call
Tycho Andersen [Tue, 8 Dec 2015 00:07:05 +0000 (17:07 -0700)] 
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>
9 years agoAdd LXC_TARGET env to Korean lxc.container.conf(5)
Sungbae Yoo [Fri, 4 Dec 2015 09:13:45 +0000 (09:13 +0000)] 
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>
9 years agoAdd support for new target plamo to configure.ac
TAMUKI Shoichi [Wed, 9 Dec 2015 03:23:12 +0000 (12:23 +0900)] 
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>
9 years agoFold dnsmasq command line in lxc-net.in
TAMUKI Shoichi [Tue, 8 Dec 2015 06:02:47 +0000 (15:02 +0900)] 
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>
9 years agoc/r: remove random line continuations
Tycho Andersen [Mon, 7 Dec 2015 23:51:34 +0000 (16:51 -0700)] 
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>
9 years agoc/r: add a new ->migrate API call
Tycho Andersen [Mon, 30 Nov 2015 22:14:22 +0000 (15:14 -0700)] 
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>
9 years agoc/r: bump criu version requirements
Tycho Andersen [Wed, 2 Dec 2015 21:30:53 +0000 (14:30 -0700)] 
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>
9 years agoapi wrapper: only reset the current config if this call set it
Tycho Andersen [Wed, 2 Dec 2015 21:30:52 +0000 (14:30 -0700)] 
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>
9 years agoprune_init_cgroup: don't dereference NULL
Serge Hallyn [Sat, 5 Dec 2015 00:24:55 +0000 (18:24 -0600)] 
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>
9 years agoImprove the lxc-copy Japanese manpage 710/head
Hiroaki Nakamura [Fri, 4 Dec 2015 16:04:08 +0000 (01:04 +0900)] 
Improve the lxc-copy Japanese manpage

Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
9 years agodoc: Add lxc.monitor.unshare to lxc.container.conf(5)
KATOH Yasufumi [Thu, 3 Dec 2015 11:48:18 +0000 (20:48 +0900)] 
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>
9 years agoAdd LXC_TARGET env to Japanese lxc.container.conf(5)
KATOH Yasufumi [Thu, 3 Dec 2015 09:55:57 +0000 (18:55 +0900)] 
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>
9 years agodoc: Add Japanese manpage for lxc-copy
KATOH Yasufumi [Thu, 3 Dec 2015 09:13:41 +0000 (18:13 +0900)] 
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>
9 years agoConditional compilation for ARM and PPC
Christian Brauner [Thu, 3 Dec 2015 18:24:40 +0000 (19:24 +0100)] 
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>
9 years agoseccomp: support 32-bit arm on arm64, and 32-bit ppc on ppc64
Serge Hallyn [Wed, 2 Dec 2015 22:42:36 +0000 (22:42 +0000)] 
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>
9 years agoapparmor: support lxc.aa_profile = unchanged
Serge Hallyn [Wed, 25 Nov 2015 20:45:08 +0000 (20:45 +0000)] 
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>
9 years agodoc: Add Korean manpage for lxc-copy
Sungbae Yoo [Thu, 19 Nov 2015 03:10:25 +0000 (12:10 +0900)] 
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>
9 years agolxc: let lxc-start support wlan phys
fli [Tue, 1 Dec 2015 11:17:29 +0000 (19:17 +0800)] 
lxc: let lxc-start support wlan phys

The commit: e5848d395cb <netdev_move_by_index: support wlan> only
made netdev_move_by_name support wlan, instead of netdev_move_by_index.

Given netdev_move_by_name is a wrapper of netdev_move_by_index, so here
replacing all of the call to lxc_netdev_move_by_index with lxc_netdev_move_by_name
to let lxc-start support wlan phys.

Signed-off-by: fupan li <fupan.li@windriver.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodoc: lxc.monitor.unshare requires CAP_SYS_ADMIN
Wolfgang Bumiller [Wed, 2 Dec 2015 08:03:59 +0000 (09:03 +0100)] 
doc: lxc.monitor.unshare requires CAP_SYS_ADMIN

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdded lxc.monitor.unshare
Wolfgang Bumiller [Mon, 30 Nov 2015 07:58:53 +0000 (08:58 +0100)] 
Added lxc.monitor.unshare

If manual mounting with elevated permissions is required
this can currently only be done in pre-start hooks or before
starting LXC. In both cases the mounts would appear in the
host's namespace.
With this flag the namespace is unshared before the startup
sequence, so that mounts performed in the pre-start hook
don't show up on the host.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolog: use the right size for timestamp formatting
Tycho Andersen [Tue, 1 Dec 2015 15:59:30 +0000 (08:59 -0700)] 
log: use the right size for timestamp formatting

v2: get rid of extra debug crap

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoExport LXC_TARGET env variable in stop hook
Stéphane Graber [Thu, 3 Dec 2015 05:52:58 +0000 (00:52 -0500)] 
Export LXC_TARGET env variable in stop hook

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodebian: Fix container creation on missing cache
Stéphane Graber [Fri, 20 Nov 2015 05:34:09 +0000 (00:34 -0500)] 
debian: Fix container creation on missing cache

This is currently breaking our daily image builds which happen in a
perfectly clean environment without a Debian keyring and without
anything in /var/cache/lxc

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoMerge pull request #702 from hallyn/2015-11-17/comment
Stéphane Graber [Wed, 18 Nov 2015 05:18:54 +0000 (00:18 -0500)] 
Merge pull request #702 from hallyn/2015-11-17/comment

lxc_container struct: add comment about moving member fns

9 years agoMerge pull request #700 from hallyn/2015-11-17/preserve_ns.2
Stéphane Graber [Wed, 18 Nov 2015 05:18:24 +0000 (00:18 -0500)] 
Merge pull request #700 from hallyn/2015-11-17/preserve_ns.2

Better handle preserve_ns behavior

9 years agolxc_container struct: add comment about moving member fns 702/head
Serge Hallyn [Wed, 18 Nov 2015 05:05:37 +0000 (23:05 -0600)] 
lxc_container struct: add comment about moving member fns

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd getsubopt implementation for Android
Stéphane Graber [Wed, 18 Nov 2015 01:37:10 +0000 (20:37 -0500)] 
Add getsubopt implementation for Android

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #701 from hallyn/fixunexp
Stéphane Graber [Tue, 17 Nov 2015 23:02:10 +0000 (18:02 -0500)] 
Merge pull request #701 from hallyn/fixunexp

lxcapi_clone: restore the unexpanded config len

9 years agolxcapi_clone: restore the unexpanded config len 701/head
Serge Hallyn [Tue, 17 Nov 2015 21:05:05 +0000 (15:05 -0600)] 
lxcapi_clone: restore the unexpanded config len

Otherwise it gets shortened with the temporary len but never
restored - which will only break API users which do a clone
then continue to use the original container, meaning this is
a hard one to detect.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoRevert "seccomp: handle inverted arch"
Serge Hallyn [Tue, 17 Nov 2015 20:01:04 +0000 (14:01 -0600)] 
Revert "seccomp: handle inverted arch"

It breaks container starts.

This reverts commit 473ebc77d6762c2ec49fe59983dabc04f695fd01.

9 years agoBetter handle preserve_ns behavior 700/head
Serge Hallyn [Tue, 17 Nov 2015 18:59:05 +0000 (12:59 -0600)] 
Better handle preserve_ns behavior

Commit b6b2b194a8 preserves the container's namespaces for
possible later use in stop hook.  But some kernels don't have
/proc/pid/ns/ns for all the namespaces we may be interested in.
So warn but continue if this is the case.

Implement stgraber's suggested semantics.

 - User requests some namespaces be preserved:
    - If /proc/self/ns is missing => fail (saying kernel misses setns)
    - If /proc/self/ns/<namespace> entry is missing => fail (saying kernel misses setns for <namespace>)
 - User doesn't request some namespaces be preserved:
    - If /proc/self/ns is missing => log an INFO message (kernel misses setns) and continue
    - If /proc/self/ns/<namespace> entry is missing => log an INFO message (kernel misses setns for <namespace>) and continue

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #692 from fwilson42/master
Stéphane Graber [Tue, 17 Nov 2015 16:43:56 +0000 (11:43 -0500)] 
Merge pull request #692 from fwilson42/master

lxc-ls: use /usr/bin/env to find an appropriate python3 to run

9 years agoMerge pull request #693 from hsoft/debian-keyring
Stéphane Graber [Tue, 17 Nov 2015 16:43:19 +0000 (11:43 -0500)] 
Merge pull request #693 from hsoft/debian-keyring

Fetch Debian archive GPG keyrings when they're not available

9 years agoMerge pull request #697 from hallyn/2015-11-12/seccomp
Stéphane Graber [Tue, 17 Nov 2015 16:42:14 +0000 (11:42 -0500)] 
Merge pull request #697 from hallyn/2015-11-12/seccomp

seccomp: handle inverted arch

9 years agoclone: clear the rootfs out of unexpanded config
Serge Hallyn [Wed, 11 Nov 2015 17:13:25 +0000 (17:13 +0000)] 
clone: clear the rootfs out of unexpanded config

Closes #694

When we start cloning container c1 to c2, we first save c1's
configuration in c2's as a starting point.  We long ago cleared
out the lxc.rootfs entry before saving it, so that if we are
killed before we update the rootfs, c2's rootfs doesn't point
to c1's.  Because then lxc-destroy -n c2 would delete c1's rootfs.

But when we introduced the unexpanded_config, we didn't update
this code to clear the rootfs out of the unexpanded_config, which
is what now actually gets saved in write_config().

Do so.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoImprove coding style and coding conventions
Christian Brauner [Tue, 10 Nov 2015 16:52:36 +0000 (17:52 +0100)] 
Improve coding style and coding conventions

Local variables should not have the same name as global variables to avoid
confusion.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix mode when creating temporary directory
Christian Brauner [Mon, 9 Nov 2015 20:47:28 +0000 (21:47 +0100)] 
Fix mode when creating temporary directory

When we create a random container directory with mkdtemp() we set the mode to
0770 otherwise do_lxcapi_clone() will complain about not being able to create
the config.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoUse correct return when clone fails
Christian Brauner [Mon, 9 Nov 2015 20:47:27 +0000 (21:47 +0100)] 
Use correct return when clone fails

When the clone failed we tried to destroy the container. This will lead to a
segfault. Instead simply return -1. Also move the call to free_mnts() after the
put label to free the user specified mounts even when we just goto put.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd manpage for lxc-copy
Christian Brauner [Thu, 12 Nov 2015 20:11:30 +0000 (21:11 +0100)] 
Add manpage for lxc-copy

(A trivial fix for lxc-copy is included.)

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoAdd lxc-copy executable
Christian Brauner [Fri, 6 Nov 2015 10:59:59 +0000 (11:59 +0100)] 
Add lxc-copy executable

This is a complete reimplementation of lxc-clone and lxc-start-ephemeral.
lxc-copy merges the functionalities of lxc-clone + lxc-start-ephemeral.

(1) Cloning containers:

(a) as copy:

lxc-copy -n aa -N bb

(b) as snapshot:

lxc-copy -n aa -N bb -s

(2) Renaming containers:

lxc-copy -n aa -N bb -R

(3) Starting ephemeral containers:

Ephemeral containers are created and started by passing the flag -e /
--ephemeral. Whenever this flag is missing a copy of the container is created.
The flag -e / --ephemeral implies -s / --snapshot.

(a) start ephemeral container daemonized with random name:

lxc-copy -n aa -e

(b) start ephemeral container in foreground mode with random name:

lxc-copy -n aa -e -F

(c) start ephemeral container with specified name in daemonized mode:
    Analogous to lxc-start ephemeral containers start in daemonized
            mode per default:

lxc-copy -n aa -N bb -e

    One can however also explicitly pass -d / --daemon:

lxc-copy -n aa -N bb -e -d

    but both commands are equivalent.

(d) start non-ephemeral container in daemonized mode:

lxc-copy -n aa -D -e

(e) start ephemeral container in daemonized mode and keep the original
    hostname:

lxc-copy -n aa -K -e

(f) start ephemeral container in daemonized mode and keep the
    MAC-address of the original container:

lxc-copy -n aa -M -e

(g) start ephemeral container with custom mounts (additional mounts can
            be of type {bind,aufs,overlay}) in daemonized mode:

lxc-copy -n aa -e -m bind=/src:/dest:ro,aufs=/src:/dest,overlay=/src:/dest

(4) Other options:

lxc-copy --help

In order to create a random containername and random upper- and workdirs for
custom mounts we use mkdtemp() to not just create the names but also directly
create the corresponding directories. This will be safer and make the code
considerably shorter.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodon't truncate environment sometimes in setproctitle
Tycho Andersen [Mon, 16 Nov 2015 22:12:36 +0000 (15:12 -0700)] 
don't truncate environment sometimes in setproctitle

Instead, let's just allocate new space for the proctitle to live and point
the kernel at that.

v2: take out testing hunk
v3: check return from realloc

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoseccomp: handle inverted arch 697/head
Serge Hallyn [Thu, 12 Nov 2015 23:22:48 +0000 (17:22 -0600)] 
seccomp: handle inverted arch

lxc uses uname to check the kernel version.  Seccomp respects userspace.  In the case
of 32-bit userspace on 64-bit kernel, this was a bad combination.

When we run into that case, make sure that the compat seccomp context is 32-bit, and
the lxc->seccomp_ctx is the 64-bit.

Closes #654

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoubuntu-cloud: Various fixes
Stéphane Graber [Thu, 12 Nov 2015 17:44:38 +0000 (12:44 -0500)] 
ubuntu-cloud: Various fixes

 - Update list of supported releases
 - Make the fallback release trusty
 - Don't specify the compression algorithm (use auto-detection) so that
   people passing tarballs to the template don't see regressions.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFetch Debian archive GPG keyrings when they're not available 693/head
Virgil Dupras [Tue, 10 Nov 2015 02:23:51 +0000 (21:23 -0500)] 
Fetch Debian archive GPG keyrings when they're not available

When running the debian template on a non-debian host, it's usual not to
have debian-archive-keyring.gpg. When that happens, we skip the
signature checking of the release, which is dangerous because it's made over
HTTP.

This commit adds automatic fetching of Debian release keys.

Strongly related to #409

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
9 years agoUse /usr/bin/env python3 instead of /usr/bin/python3 project-wide 692/head
Fox Wilson [Tue, 10 Nov 2015 20:00:25 +0000 (15:00 -0500)] 
Use /usr/bin/env python3 instead of /usr/bin/python3 project-wide

This fixes invocations of certain commands when python3 is installed in
a nonstandard path (/usr/local/bin, for example).

Signed-off-by: Fox Wilson <2016fwilson@tjhsst.edu>
9 years agoutils: dialback setproctitle failure message
Tycho Andersen [Mon, 9 Nov 2015 20:33:32 +0000 (13:33 -0700)] 
utils: dialback setproctitle failure message

This isn't in any way fatal, so let's only warn about it with INFO, not
ERROR.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agocoverity: avoid null pointer dereference in cgmanager
Serge Hallyn [Mon, 9 Nov 2015 20:19:12 +0000 (14:19 -0600)] 
coverity: avoid null pointer dereference in cgmanager

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoc/r: use freezer to seize tasks
Tycho Andersen [Sat, 7 Nov 2015 00:26:43 +0000 (17:26 -0700)] 
c/r: use freezer to seize tasks

Instead of relying on the old ptrace loop, we should instead put all the
tasks in the container into the freezer. This will stop them all at the
same time, preventing fork bombs from causing criu to infinite loop (and is
also simply a lot faster).

Note that this uses --freeze-cgroup which isn't in criu 1.7, so it should
only go into master.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodefine PR_SET_MM_MAP & friends if necessary
Tycho Andersen [Fri, 6 Nov 2015 20:50:33 +0000 (13:50 -0700)] 
define PR_SET_MM_MAP & friends if necessary

PR_SET_MM_MAP only went in to the kernel at 3.18 (or 3.19), so we need to
define these for kernels before then. If there was an error, the code
simply logs the failure and continues on.

Also, we can drop the PR_SET_MM_otherstuff contstants since those were
dropped in 93525c00c76b2804c46cf3c275d610ebe71cb4be.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoc/r: don't require a veth link to c/r
Tycho Andersen [Fri, 6 Nov 2015 19:58:02 +0000 (12:58 -0700)] 
c/r: don't require a veth link to c/r

veths can be unconnected in the container's config, and we should handle
this case.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agouse PR_SET_MM_MAP instead of PR_SET_MM
Tycho Andersen [Fri, 6 Nov 2015 19:34:47 +0000 (12:34 -0700)] 
use PR_SET_MM_MAP instead of PR_SET_MM

PR_SET_MM_MAP can be called as non-root, which we are in the unprivileged
(or nested) case.

Also, let's not do the strcpy() for the new cmdline until after we're sure
the prctl succeeded. This means that even if it does fail, we won't
mutilate the command line like we did before, it just won't be as pretty.

v2: remember to chop off bits of the string that are too long

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix calculations in clone_update_unexp_hooks()
Christian Brauner [Tue, 3 Nov 2015 18:09:56 +0000 (19:09 +0100)] 
Fix calculations in clone_update_unexp_hooks()

Changes v3:
(1) Fix typo (q --> p).

(1) This commit fixes the calculations when updating paths in lxc.hooks.*
    entries. We now also update conf->unexpandend_alloced which hasn't been
done prior to this commit.

(2) Also we use the stricter check:

     if (p >= lend)
     continue;

    This should deal better with invalid config files.

(3) Insert some spaces between operators to increase readability.

(4) Use gotos to simplify function and increase readability.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoUpdate absolute paths for overlay and aufs mounts
Christian Brauner [Mon, 2 Nov 2015 22:20:36 +0000 (23:20 +0100)] 
Update absolute paths for overlay and aufs mounts

When using overlay and aufs mounts with lxc.mount.entry users have to specify
absolute paths for upperdir and workdir which will then get created
automatically by mount_entry_create_overlay_dirs() and
mount_entry_create_aufs_dirs() in conf.c. When we clone a container with
overlay or aufs lxc.mount.entry entries we need to update these absolute paths.
In order to do this we add the function update_ovl_paths() in
lxccontainer.c. The function updates the mounts in two locations:

        1) lxc_conf->mount_list

and

        2) lxc_conf->unexpanded_config (by calling clone_update_unexp_ovl_dir())

If we were to only update 2) we would end up with wrong upperdir and workdir
mounts as the absolute paths would still point to the container that serves as
the base for the clone. If we were to only update 1) we would end up with wrong
upperdir and workdir lxc.mount.entry entries in the clone's config as the
absolute paths in upperdir and workdir would still point to the container that
serves as the base for the clone. Updating both will get the job done.

NOTE: This function does not sanitize paths apart from removing trailing
slashes. (So when a user specifies //home//someone/// it will be cleaned to
//home//someone. This is the minimal path cleansing which is also done by
lxc_container_new().) But the mount_entry_create_overlay_dirs() and
mount_entry_create_aufs_dirs() functions both try to be extremely strict about
when to create upperdirs and workdirs. They will only accept sanitized paths,
i.e. they require /home/someone. I think this is a (safety) virtue and we
should consider sanitizing paths in general. In short: update_ovl_paths() does
update all absolute paths to the new container but
mount_entry_create_overlay_dirs() and mount_entry_create_aufs_dirs() will still
refuse to create upperdir and workdir when the updated path is unclean. This
happens easily when e.g. a user calls lxc-clone -o OLD -n NEW -P
//home//chb///.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd clone_update_unexp_ovl_paths() function
Christian Brauner [Mon, 2 Nov 2015 22:20:35 +0000 (23:20 +0100)] 
Add clone_update_unexp_ovl_paths() function

This functions updates absolute paths for overlay upper- and workdirs so users
can simply clone and start new containers without worrying about absolute paths
in lxc.mount.entry overlay entries.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agohooks: put binary hooks into $libexecdir/lxc/hooks
Wolfgang Bumiller [Thu, 5 Nov 2015 14:02:11 +0000 (15:02 +0100)] 
hooks: put binary hooks into $libexecdir/lxc/hooks

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agosupport arguments in lxc.init_cmd
Serge Hallyn [Thu, 5 Nov 2015 22:18:52 +0000 (22:18 +0000)] 
support arguments in lxc.init_cmd

Otherwise something like
lxc.init_cmd = /sbin/init debug verbose
fails trying to execute a file called "/sbin/init debug verbose"

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoUnify the polite word style in Korean manpages
Sungbae Yoo [Mon, 2 Nov 2015 09:29:31 +0000 (18:29 +0900)] 
Unify the polite word style in Korean manpages

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the description of lxc.hook.stop to Korean lxc.container.conf(5)
Sungbae Yoo [Mon, 2 Nov 2015 08:32:48 +0000 (17:32 +0900)] 
doc: Add the description of lxc.hook.stop to Korean lxc.container.conf(5)

Update for commit 0a2b5ab

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoonly re-open fds if stdin is a tty
Serge Hallyn [Fri, 30 Oct 2015 05:14:12 +0000 (05:14 +0000)] 
only re-open fds if stdin is a tty

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoInit error_num to 1
Stéphane Graber [Thu, 5 Nov 2015 18:44:30 +0000 (13:44 -0500)] 
Init error_num to 1

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>