Commit Graph

3797 Commits

Author SHA1 Message Date
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
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