Commit Graph

3873 Commits

Author SHA1 Message Date
Peter Simons
3db8dd39a7 bash completion: the 'have' command was deprecated in favor of '_have'
`bash-completion` version 2.1 and later no longer include the `have` command,
and consequently the `lxc` competion file fails on such systems. The command is
now called `_have`.

Signed-off-by: Peter Simons <simons@cryp.to>
2016-01-11 18:28:09 +01:00
Terzeus S. Dominguez
6441f6ba7a
Fix zypper repo for Leap
Leap repos are moved one level deeper. Included oss repo only.

Signed-off-by: Terzeus S. Dominguez <zeus@dmgznet.com>
2016-01-11 22:35:26 +08:00
Terzeus S. Dominguez
9a4fe12dc4
Add iproute2 and net-tools to Leap install
Added missing network utilities to base install for Leap. Included
check to do it for Leap 42.1 only.

Signed-off-by: Terzeus S. Dominguez <zeus@dmgznet.com>
2016-01-11 03:31:30 +08:00
Terzeus S. Dominguez
3b7f70d214
Fix typo
Signed-off-by: Terzeus S. Dominguez <zeus@dmgznet.com>
2016-01-11 02:13:10 +08:00
Terzeus S. Dominguez
f2d63d7ac4
Add openSUSE Leap release in opensuse template
Signed-off-by: Terzeus S. Dominguez <zeus@dmgznet.com>
2016-01-10 23:25:41 +08:00
Serge Hallyn
c7ec3de825 Merge pull request #752 from hallyn/2016-01-04/cgroup.use
2016 01 04/cgroup.use
2016-01-08 13:05:42 -08:00
Serge Hallyn
c4cafa080c add LXC_CGNS_AWARE env variable for mount hooks
This way the lxcfs mount hook can know whether lxc knows about
cgroup namespaces.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-08 13:03:37 -08:00
Serge Hallyn
6cee93ac80 attach: unshare cgroupns if possible
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
Changelog 20160104: only try if kernel supports cgns.
2016-01-08 13:03:37 -08:00
Serge Hallyn
12983ba458 container start: unshare cgns when possible
We'll probably want to make this configurable with a
lxc.cgroupns = [1|0], but for now just always do it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>

---
Changelog 20160104: only try to unshare if /proc/self/ns/cgroup exists.
2016-01-08 13:03:37 -08:00
Serge Hallyn
8b5fb7f3d8 detect which cgroups we cannot use
and continue without them if possible.  This allows an unpriv user
who only has a few cgroups he owns to still use lxc.

This patch only handles cgmanger - we need to handle this in cgfs too.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-08 13:03:30 -08:00
Serge Hallyn
919a04ed23 apparmor: recognize 'unconfined' as unconfined.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-06 11:45:38 -08:00
Vaidas Kascėnas
88753f7abf Update lxc-ubuntu.in
Updated as per request in https://github.com/lxc/lxc/pull/740#discussion-diff-48759756

Signed-off-by: Vaidas Kascėnas vaidas@kascenas.lt
2016-01-06 19:46:33 +02:00
Serge Hallyn
babccc20e8 coverity: preserve_ns returns bool, not int
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-04 14:39:50 -08:00
Serge Hallyn
278d97f74a coverity: ovl_clonepaths: free osrc and ndelta on error paths
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-04 14:37:33 -08:00
Serge Hallyn
7d72b9596c coverity: close fout on error in is_wlan()
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-04 14:34:49 -08:00
Serge Hallyn
9bfdc0adc8 Don't try to change aa label if we are already apparmor-confined
Closes #1459

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 16:51:08 -05:00
Stéphane Graber
642e2c5efd Merge pull request #743 from tw4452852/buffer_overflow
fix buffer overflow in ifaddrs.c
2016-01-04 13:09:34 -05:00
Stéphane Graber
1dd9a6c051 Merge pull request #739 from shindo/fix/python-lxc/pyos-afterfork
python-lxc: Call PyOS_AfterFork after attaching to a container
2016-01-04 13:05:59 -05:00
Stéphane Graber
a36a3c0d63 Merge pull request #746 from ar45/fix_debian_systemd_getty
Fix #520 - multiple instances of agetty on systemd.
2016-01-04 13:05:04 -05:00
Wim Coekaerts
25a9939b7b NULL pointer deference if nlmsg_reserve() returns NULL for ifi
nlmsg_reserve() might return NULL

        if (nlmsg_len + tlen > nlmsg->cap)
                return NULL;

Also set err = -ENOMEM where appropriate

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-04 12:57:18 -05:00
KATOH Yasufumi
1bc07a5b8d doc: Improve man pages
* Add long options if not be written
* Remove optional tags in OPTIONS section

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:55:21 -05:00
KATOH Yasufumi
0794541858 doc: Add LXC_SRC_NAME to lxc.container.conf(5)
only add to English and Japanese docs.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:55:19 -05:00
Wim Coekaerts
ee54ea9a28 network.c:is_wlan() File Leak f
network.c:is_wlan() File Leak f f initialized at line 156 with fopen f
leaks when fopen(path, r) != NULL at line 156 and physname == NULL at
line 163.

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-04 12:53:00 -05:00
Wim Coekaerts
a90277dfb5 criu.c: protect from buffer overrun of version in fscanf()
while highly unlikely to happen...
char version[1024];

fscanf(.. %[1024] .., version  );

should leave room for null termination

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:52:26 -05:00
KATOH Yasufumi
2984ee3673 Improve the help of lxc-create
* remove unavailable options (-w, -r)
* remove overlapped option (-P)
* classify options according to bdev type

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:52:22 -05:00
Marko Hauptvogel
7eff30fd5d Documenting valueless lxc.cap.drop behaviour
From b24b0e16848fbb93402a08efa3950cd59272b8da Mon Sep 17 00:00:00 2001
From: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Date: Sun, 3 Jan 2016 23:07:19 +0100
Subject: [PATCH] Documenting valueless lxc.cap.drop behaviour

Undocummented behaviour since 7d0eb87.

Signed-off-by: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:52:06 -05:00
Wim Coekaerts
beabd0a28f Add support for Linux for SPARC distribution host and template
Linux for SPARC is a free community Linux distribution for SPARC hosted by Oracle. See : https://oss.oracle.com/projects/linux-sparc

While the distribution is based on Oracle Linux it does have some differences and since it's not actually Oracle Linux I decided to add a separate template rather than having the Oracle Linux template also support Linux for SPARC.

This patch adds the lxc-template for Linux for SPARC and it also adds Linux for SPARC in the configure.ac as a distribution target to build.

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-04 12:51:21 -05:00
Aron Podrigal
a3d42f4bd6 Fix #520 - multiple instances of agetty on systemd.
Fixes issue with double tty login lxc-console
Ref #520, #484

Signed-off-by: Aron Podrigal <aronp@guaranteedplus.com>
2015-12-31 23:28:32 -05:00
tw19881113@gmail.com
da4cacd1fa fix buffer overflow in ifaddrs.c
jenkins: ok to test

Signed-off-by: Tw <tw19881113@gmail.com>
2015-12-30 15:41:36 +08:00
Serge Hallyn
cb65e5d71b Merge pull request #734 from brauner/2015-12-12/split_bdev_into_modules
split bdev into modules: btrfs + rsync
2015-12-28 14:38:25 -08:00
Christian Brauner
c40c5fdf54 Add <linux/types.h> header to lxcbtrfs.h
Using

	#include <sys/types.h>

is not sufficient to guarantee that __le64 and other types are defined.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 14:36:49 -08:00
Christian Brauner
3188197d24 Simplify overlay.{c,h}
The struct

	struct ovl_rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

is simply a duplicate of

	struct rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

So let's replace any references to ovl_rsync_data with rsync_data.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 14:36:49 -08:00
Christian Brauner
e9df7e1a94 Split bdev into modules: lxcrsync
The functions:

        - do_rsync();
        - rsync_delta();
        - rsync_delta_wrapper();
        - rsync_rootfs();
        - rsync_rootfs_wrapper();

and the structs

        - struct rsync_data;
        - struct rsync_data_char;

move from bdev.{c,h} to lxcrsync.{c.h}. All functions previously declared as
static become public.

lxcrsync.{c,h} should allow for a reasonable amount of abstraction regarding
our rsync functions. Some of the functions could easily be abstracted.

Adapt Makefile.am to include lxcrsync.{c,h}.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 14:36:47 -08:00
Christian Brauner
988be9c137 lxcbtrfs.{c,h} rework declarations and definitions
Declare

	- btrfs_same_fs();
	- btrfs_snapshot();

extern instead of static in lxcbtrfs.h. They are defined in lxcbtrfs.c.

Forward declare/put

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

as incomplete types in lxcbtrfs.h so that functions declared and defined in
lxcbtrfs.{c,h} have access to it.

Declare

	- dir_new_path();

in lxcbtrfs.c. It is defined in lxccontainer.c.

Move definition of struct

	- struct rsync_data_char;

from bdev.c to bdev.h because the functions in lxcbtrfs.{c,h} need to access it.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 14:35:52 -08:00
Christian Brauner
3c16d0cb4d Split bdev into modules: btrfs
Create a module for btrfs: lxcbtrfs.{c,h}.

The functions:

	- get_btrfs_subvol_path()
	- btrfs_list_get_path_rootid()
	- is_btrfs_fs()
	- btrfs_detect()
	- btrfs_mount()
	- btrfs_umount()
	- btrfs_subvolume_create()
	- btrfs_same_fs()
	- btrfs_snapshot()
	- btrfs_snapshot_wrapper()
	- btrfs_clonepaths()
	- btrfs_do_destroy_subvol()
	- get_btrfs_tree_idx()
	- my_btrfs_tree *create_my_btrfs_tree()
	- update_tree_node()
	- add_btrfs_tree_node()
	- free_btrfs_tree()
	- do_remove_btrfs_children()
	- btrfs_recursive_destroy()
	- btrfs_try_remove_subvol()
	- btrfs_destroy()
	- btrfs_create()

and the structs:

	- struct mytree_node
	- struct my_btrfs_tree

move from bdev.{c,h} to lxcbtrfs.{c,h}.

Rename the header file

	- lxc-btrfs.h --> lxcbtrfs.h

Adapt Makefile.am to include lxcbtrfs.{c,h} and remove lxc-btrfs.h.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 14:35:49 -08:00
Christian Brauner
fc58bf2c62 Add <linux/types.h> header to lxcbtrfs.h
Using

	#include <sys/types.h>

is not sufficient to guarantee that __le64 and other types are defined.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 09:50:04 +01:00
Christian Brauner
e0d0f93be5 Simplify overlay.{c,h}
The struct

	struct ovl_rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

is simply a duplicate of

	struct rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

So let's replace any references to ovl_rsync_data with rsync_data.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 09:50:04 +01:00
Christian Brauner
cd0f1eebe5 Split bdev into modules: lxcrsync
The functions:

        - do_rsync();
        - rsync_delta();
        - rsync_delta_wrapper();
        - rsync_rootfs();
        - rsync_rootfs_wrapper();

and the structs

        - struct rsync_data;
        - struct rsync_data_char;

move from bdev.{c,h} to lxcrsync.{c.h}. All functions previously declared as
static become public.

lxcrsync.{c,h} should allow for a reasonable amount of abstraction regarding
our rsync functions. Some of the functions could easily be abstracted.

Adapt Makefile.am to include lxcrsync.{c,h}.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 09:50:00 +01:00
Christian Brauner
93d4475ec2 lxcbtrfs.{c,h} rework declarations and definitions
Declare

	- btrfs_same_fs();
	- btrfs_snapshot();

extern instead of static in lxcbtrfs.h. They are defined in lxcbtrfs.c.

Forward declare/put

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

as incomplete types in lxcbtrfs.h so that functions declared and defined in
lxcbtrfs.{c,h} have access to it.

Declare

	- dir_new_path();

in lxcbtrfs.c. It is defined in lxccontainer.c.

Move definition of struct

	- struct rsync_data_char;

from bdev.c to bdev.h because the functions in lxcbtrfs.{c,h} need to access it.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 09:49:33 +01:00
Christian Brauner
f2e50c442d Split bdev into modules: btrfs
Create a module for btrfs: lxcbtrfs.{c,h}.

The functions:

	- get_btrfs_subvol_path()
	- btrfs_list_get_path_rootid()
	- is_btrfs_fs()
	- btrfs_detect()
	- btrfs_mount()
	- btrfs_umount()
	- btrfs_subvolume_create()
	- btrfs_same_fs()
	- btrfs_snapshot()
	- btrfs_snapshot_wrapper()
	- btrfs_clonepaths()
	- btrfs_do_destroy_subvol()
	- get_btrfs_tree_idx()
	- my_btrfs_tree *create_my_btrfs_tree()
	- update_tree_node()
	- add_btrfs_tree_node()
	- free_btrfs_tree()
	- do_remove_btrfs_children()
	- btrfs_recursive_destroy()
	- btrfs_try_remove_subvol()
	- btrfs_destroy()
	- btrfs_create()

and the structs:

	- struct mytree_node
	- struct my_btrfs_tree

move from bdev.{c,h} to lxcbtrfs.{c,h}.

Rename the header file

	- lxc-btrfs.h --> lxcbtrfs.h

Adapt Makefile.am to include lxcbtrfs.{c,h} and remove lxc-btrfs.h.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2015-12-28 09:49:22 +01:00
Vaidas Kascėnas
9d95ca9741 Optional template parameter -v|--variant tells debootstrap which variant script to use.
Signed-off-by: Vaidas Kascėnas <vaidas@kascenas.lt>
2015-12-24 18:12:28 +02:00
Danil Osherov
4027875db1 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>
2015-12-24 17:00:54 +03:00
Serge Hallyn
364d54c9f0 Merge pull request #738 from ec-m/ec-m_lxc-ls
Fix swap calculation (#737)
2015-12-23 14:36:23 -08:00
Eva Charlotte Mayer
294883150c Fix swap calculation
Signed-off-by: Eva Charlotte Mayer <eva-charlotte.mayer@posteo.de>
2015-12-23 13:15:26 +01:00
Stéphane Graber
99d78dcc97 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>
2015-12-21 13:29:27 -05:00
KATOH Yasufumi
85f287b703 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>
2015-12-20 22:42:28 -05:00
Sungbae Yoo
9bc7ae484b 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>
2015-12-20 22:42:28 -05:00
Sungbae Yoo
d1f81425d2 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>
2015-12-20 22:42:28 -05:00
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