]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
8 years agolxc-alpine: completely rewrite the template script
Jakub Jirutka [Mon, 4 Jan 2016 21:20:09 +0000 (22:20 +0100)]
lxc-alpine: completely rewrite the template script

New template script is more readable and robust, uses cache and external
LXC config file as other templates.

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agoMerge pull request #832 from stgraber/master
Serge Hallyn [Sat, 20 Feb 2016 05:02:01 +0000 (21:02 -0800)]
Merge pull request #832 from stgraber/master

Fix typo in lxc manpage

8 years agoFix typo in lxc manpage
Stéphane Graber [Sat, 20 Feb 2016 04:37:07 +0000 (23:37 -0500)]
Fix typo in lxc manpage

Reported-by: lintian
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #831 from hallyn/2016-02-19/cgfs
Stéphane Graber [Sat, 20 Feb 2016 03:13:36 +0000 (22:13 -0500)]
Merge pull request #831 from hallyn/2016-02-19/cgfs

2016 02 19/cgfs

8 years agolxc: cgfs: handle lxcfs
Ubuntu [Sat, 20 Feb 2016 02:25:55 +0000 (02:25 +0000)]
lxc: cgfs: handle lxcfs

When containers have lxcfs mounted instead of cgroupfs, we have to
process /proc/self/mountinfo a bit differently.  In particular, we
should look for fuse.lxcfs fstype, we need to look elsewhere for the
list of comounted controllers, and the mount_prefix is not a cgroup path
which was bind mounted, so we should ignore it, and named subsystems
show up without the 'name=' prefix.

With this patchset I can start containers inside a privileged lxd
container with lxcfs mounted (i.e. without cgroup namespaces).

Closes #830

Signed-off-by: Ubuntu <ubuntu@localhost.localdomain>
8 years agocgfs: also check for EACCES when writing devices
Serge Hallyn [Sat, 20 Feb 2016 02:43:50 +0000 (18:43 -0800)]
cgfs: also check for EACCES when writing devices

Because that's what lxcfs gives us.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #829 from hallyn/2016-02-19/devices
Stéphane Graber [Fri, 19 Feb 2016 23:25:02 +0000 (18:25 -0500)]
Merge pull request #829 from hallyn/2016-02-19/devices

cgroups: do not fail if setting devices cgroup fails due to EPERM

8 years agocgroups: do not fail if setting devices cgroup fails due to EPERM
Serge Hallyn [Fri, 19 Feb 2016 22:12:47 +0000 (14:12 -0800)]
cgroups: do not fail if setting devices cgroup fails due to EPERM

If we're trying to allow a device which was denied to our parent
container, just continue.

Cgmanager does not help us to distinguish between eperm and other
errors, so just always continue.

We may want to consider actually computing the range of devices
to which the container monitor has access, but OTOH that introduces
a whole new set of complexity to compute access sets.

Closes #827

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #826 from brauner/2016-02-19/exec_cast_null
Serge Hallyn [Fri, 19 Feb 2016 19:00:59 +0000 (11:00 -0800)]
Merge pull request #826 from brauner/2016-02-19/exec_cast_null

cast NULL pointers passed to execl*()

8 years agocast NULL pointers passed to execl*()
Christian Brauner [Fri, 19 Feb 2016 11:44:40 +0000 (12:44 +0100)]
cast NULL pointers passed to execl*()

NULL pointers passed to execl*() functions must be cast to (char *)NULL since
they are variadic functions.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agochange version to 2.0.0.rc1 in configure.ac
Stéphane Graber [Thu, 18 Feb 2016 17:20:43 +0000 (12:20 -0500)]
change version to 2.0.0.rc1 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #823 from stgraber/master
Christian Brauner [Tue, 16 Feb 2016 07:01:25 +0000 (08:01 +0100)]
Merge pull request #823 from stgraber/master

Fix doc build warnings

8 years agoFix doc build warnings
Stéphane Graber [Tue, 16 Feb 2016 06:16:33 +0000 (01:16 -0500)]
Fix doc build warnings

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #822 from stgraber/master
Serge Hallyn [Tue, 16 Feb 2016 02:49:22 +0000 (18:49 -0800)]
Merge pull request #822 from stgraber/master

Couple of apparmor tweaks

8 years agoAllow cgroupfs remount by systemd
Stéphane Graber [Tue, 16 Feb 2016 01:08:09 +0000 (20:08 -0500)]
Allow cgroupfs remount by systemd

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoAllow sysfs remount by mountall
Stéphane Graber [Tue, 16 Feb 2016 01:03:50 +0000 (20:03 -0500)]
Allow sysfs remount by mountall

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #821 from hallyn/2016-02-15/lognull
Christian Brauner [Mon, 15 Feb 2016 20:38:00 +0000 (21:38 +0100)]
Merge pull request #821 from hallyn/2016-02-15/lognull

2016 02 15/lognull

8 years agolog.c:__lxc_log_set_file: completely close log file when overriding
Serge Hallyn [Mon, 15 Feb 2016 20:18:18 +0000 (12:18 -0800)]
log.c:__lxc_log_set_file: completely close log file when overriding

Otherwise after a shortcut on error we could end up trying to write
to the closed log fd.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agolog.c:__lxc_log_set_file: fname cannot be null
Serge Hallyn [Mon, 15 Feb 2016 20:15:10 +0000 (12:15 -0800)]
log.c:__lxc_log_set_file: fname cannot be null

fname cannot be passed in as NULL by any of its current callers.  If it
could, then build_dir() would crash as it doesn't check for it.  So make
sure we are warned if in the future we pass in NULL.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #813 from brauner/2016-02-01/lxc_destroy_ephemeral
Serge Hallyn [Wed, 10 Feb 2016 18:34:49 +0000 (10:34 -0800)]
Merge pull request #813 from brauner/2016-02-01/lxc_destroy_ephemeral

lxc-destroy: deal with ephemeral containers

8 years agolxc-destroy: deal with ephemeral containers
Christian Brauner [Wed, 10 Feb 2016 01:32:37 +0000 (02:32 +0100)]
lxc-destroy: deal with ephemeral containers

- Ephemeral containers are destroyed on shutdown so we do not destroy them.
- Destroy ephemeral containers with clones: first destroy all the clones, then
  destroy the container.
- Ephemeral containers with snapshots cannot be easily handled but we can
  probably trust that no one will try to make snapshots of an ephemeral
  container.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #812 from brauner/2016-02-10/quiet_lxc_copy
Serge Hallyn [Wed, 10 Feb 2016 01:00:42 +0000 (17:00 -0800)]
Merge pull request #812 from brauner/2016-02-10/quiet_lxc_copy

silence lxc-copy as well when asked

8 years agosilence lxc-copy as well when asked
Christian Brauner [Wed, 10 Feb 2016 00:22:15 +0000 (01:22 +0100)]
silence lxc-copy as well when asked

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #811 from hallyn/2016-02-09/destroyquiet
Christian Brauner [Wed, 10 Feb 2016 00:25:04 +0000 (01:25 +0100)]
Merge pull request #811 from hallyn/2016-02-09/destroyquiet

lxc_destroy: be quiet if asked

8 years agolxc_destroy: be quiet if asked
Serge Hallyn [Wed, 10 Feb 2016 00:07:32 +0000 (16:07 -0800)]
lxc_destroy: be quiet if asked

As per https://bugs.launchpad.net/bugs/1543016.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #808 from hallyn/2016-02-07/aa.2
Christian Brauner [Mon, 8 Feb 2016 21:27:05 +0000 (22:27 +0100)]
Merge pull request #808 from hallyn/2016-02-07/aa.2

apparmor: don't fail if current aa label is given

8 years agoapparmor: don't fail if current aa label is given
Serge Hallyn [Mon, 8 Feb 2016 07:06:10 +0000 (23:06 -0800)]
apparmor: don't fail if current aa label is given

Ideally a container configuration will specify 'unchanged' if
it wants the container to use the current (parent) profile.  But
lxd passes its current label.  Support that too.

Note that if/when stackable profiles exist, this behavior may
or may not be what we want.  But the code to deal with aa
stacking will need some changes anyway so this is ok.

With this patch, I can create nested containers inside a
lxd xenial container both using

lxc launch x2

and unprivileged

lxc-start -n x2

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #805 from benaryorg/patch-1
Stéphane Graber [Fri, 5 Feb 2016 20:49:13 +0000 (21:49 +0100)]
Merge pull request #805 from benaryorg/patch-1

fix typo

8 years agofix typo
Katze [Fri, 5 Feb 2016 17:53:59 +0000 (18:53 +0100)]
fix typo

Signed-off-by: benaryorg <binary@benary.org>
8 years agoMerge pull request #801 from brauner/2016-02-03/automatic_overlay_for_containers_with...
Serge Hallyn [Thu, 4 Feb 2016 17:41:31 +0000 (09:41 -0800)]
Merge pull request #801 from brauner/2016-02-03/automatic_overlay_for_containers_without_rootfs

allow overlay lxc.mount.entry with no rootfs

8 years agoallow overlay lxc.mount.entry with no rootfs
Christian Brauner [Wed, 3 Feb 2016 19:07:57 +0000 (20:07 +0100)]
allow overlay lxc.mount.entry with no rootfs

Allow lxc.mount.entry entries for containers without a rootfs.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #798 from hallyn/2016-02-02/commentrootfs
Christian Brauner [Thu, 4 Feb 2016 08:20:53 +0000 (08:20 +0000)]
Merge pull request #798 from hallyn/2016-02-02/commentrootfs

Comment the lxc_rootfs structure

8 years agoComment the lxc_rootfs structure
Serge Hallyn [Wed, 3 Feb 2016 03:20:05 +0000 (19:20 -0800)]
Comment the lxc_rootfs structure

Comment rootfs.path and rootfs.mount so people can better figure
out which to use.

Remove the unused pivotdir argument from setup_rootfs_pivot_root().
Remove the unused pivot member of the lxc_rootfs struct.  And just
return 0 (success) when someone passes a lxc.pivotdir entry.  One
day we'll turn that into an error, but not yet...

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #803 from tych0/add-fuse-kernel-config-check
Stéphane Graber [Thu, 4 Feb 2016 00:10:44 +0000 (01:10 +0100)]
Merge pull request #803 from tych0/add-fuse-kernel-config-check

lxc-checkconfig: warn about fuse as well

8 years agolxc-checkconfig: warn about fuse as well
Tycho Andersen [Wed, 3 Feb 2016 19:30:03 +0000 (12:30 -0700)]
lxc-checkconfig: warn about fuse as well

Since we need fuse to run lxcfs, which is required by systemd, let's warn
about that as well.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoMerge pull request #800 from brauner/2016-02-03/no_rootfs_implies_abspath
Serge Hallyn [Wed, 3 Feb 2016 17:49:19 +0000 (09:49 -0800)]
Merge pull request #800 from brauner/2016-02-03/no_rootfs_implies_abspath

no rootfs => mounts always relative to host's /

8 years agono rootfs => mounts are always relative to hosts /
Christian Brauner [Wed, 3 Feb 2016 12:17:51 +0000 (13:17 +0100)]
no rootfs => mounts are always relative to hosts /

All lxc.mount.entry entries will be relative to the hosts / when a container
does not specify a lxc.rootfs.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #799 from brauner/2016-02-03/aufs_mkdir_to_lxcaufs
Serge Hallyn [Wed, 3 Feb 2016 17:42:36 +0000 (09:42 -0800)]
Merge pull request #799 from brauner/2016-02-03/aufs_mkdir_to_lxcaufs

move and rename mount_entry_create_aufs_dirs()

8 years agomove and rename mount_entry_create_aufs_dirs()
Christian Brauner [Tue, 2 Feb 2016 23:41:14 +0000 (00:41 +0100)]
move and rename mount_entry_create_aufs_dirs()

- The function mount_entry_create_aufs_dirs() moves from conf.c to
  lxcaufs.{c,h} where it belongs.
- In accordance with the "aufs_" prefix naming scheme for functions associated
  with lxcaufs.{c,h} mount_entry_create_aufs_dirs() becomes aufs_mkdir().
- Add aufs_get_rootfs() which returns the rootfs for an aufs lxc.rootfs.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #797 from brauner/2016-02-02/fix_execute_null_ptr_deref
Serge Hallyn [Wed, 3 Feb 2016 04:32:26 +0000 (20:32 -0800)]
Merge pull request #797 from brauner/2016-02-02/fix_execute_null_ptr_deref

Fix mount_entry_on_generic()

8 years agoFix mount_entry_on_generic()
Christian Brauner [Tue, 2 Feb 2016 21:13:07 +0000 (22:13 +0100)]
Fix mount_entry_on_generic()

In mount_entry_on_generic() we dereferenced a NULL pointer whenever a container
without a rootfs was created. (Since mount_entry_on_systemfs() passes them with
NULL.) We have mount_entry_on_generic() check whether rootfs != NULL.

We also check whether rootfs != NULL in the functions ovl_mkdir() and
mount_entry_create_aufs_dirs() and bail immediately. Rationale: For overlay and
aufs lxc.mount.entry entries users give us absolute paths to e.g. workdir and
upperdir which we create for them. We currently use rootfs->path and the
lxcpath for the container to check that users give us a sane path to create
those directories under and refuse if they do not. If we want to allow overlay
mounts for containers without a rootfs they can easily be reworked.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #796 from brauner/2016-02-02/fix_execute_null_ptr_deref
Stéphane Graber [Tue, 2 Feb 2016 14:20:27 +0000 (15:20 +0100)]
Merge pull request #796 from brauner/2016-02-02/fix_execute_null_ptr_deref

Fix NULL-ptr derefs for container without rootfs

8 years agoFix NULL-ptr derefs for container without rootfs
Christian Brauner [Tue, 2 Feb 2016 13:43:33 +0000 (14:43 +0100)]
Fix NULL-ptr derefs for container without rootfs

Since we allow containers to be created without a rootfs most checks in conf.c
are not sane anymore. Instead of just checking if rootfs->path != NULL we need
to check whether rootfs != NULL.

Minor fixes:
- Have mount_autodev() always return -1 on failure: mount_autodev() returns 0
  on success and -1 on failure. But when the return value of safe_mount() was
  checked in mount_autodev() we returned false (instead of -1) which caused
  mount_autodev() to return 0 (success) instead of the correct -1 (failure).

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #795 from brauner/2016-02-02/lxc_ls_exit_zero
Stéphane Graber [Tue, 2 Feb 2016 12:21:11 +0000 (13:21 +0100)]
Merge pull request #795 from brauner/2016-02-02/lxc_ls_exit_zero

lxc-ls: exit 0 when path is not found

8 years agolxc-ls: exit 0 when path is not found
Christian Brauner [Tue, 2 Feb 2016 11:06:29 +0000 (12:06 +0100)]
lxc-ls: exit 0 when path is not found

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #793 from stgraber/master
Christian Brauner [Tue, 2 Feb 2016 11:45:30 +0000 (11:45 +0000)]
Merge pull request #793 from stgraber/master

Remove legacy versions of lxc-ls

8 years agoFix typo
Stéphane Graber [Mon, 1 Feb 2016 16:57:00 +0000 (17:57 +0100)]
Fix typo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoRemove legacy versions of lxc-ls
Stéphane Graber [Mon, 1 Feb 2016 16:37:24 +0000 (17:37 +0100)]
Remove legacy versions of lxc-ls

lxc-ls nowadays is a C binary so there's no need to keep the python and
shell versions around anymore, remove them from the branch and cleanup
documentation and Makefiles.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #794 from Blub/next
Christian Brauner [Tue, 2 Feb 2016 11:06:03 +0000 (11:06 +0000)]
Merge pull request #794 from Blub/next

apparmor: allow binding /run/{,lock/} -> /var/run/{,lock/}

8 years agoapparmor: allow binding /run/{,lock/} -> /var/run/{,lock/}
Wolfgang Bumiller [Tue, 2 Feb 2016 08:13:04 +0000 (09:13 +0100)]
apparmor: allow binding /run/{,lock/} -> /var/run/{,lock/}

Some systems need to be able to bind-mount /run to /var/run
and /run/lock to /var/run/lock. (Tested with opensuse 13.1
containers migrated from openvz.)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 years agoMerge pull request #787 from ysbnim/master
Stéphane Graber [Mon, 1 Feb 2016 13:04:39 +0000 (14:04 +0100)]
Merge pull request #787 from ysbnim/master

Update Korean manpages

8 years agogitignore doc/ko/legacy/*.1
Sungbae Yoo [Mon, 1 Feb 2016 11:55:30 +0000 (20:55 +0900)]
gitignore doc/ko/legacy/*.1

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: update overlayfs and aufs in Japanese lxc.container.conf(5)
Sungbae Yoo [Mon, 1 Feb 2016 11:35:23 +0000 (20:35 +0900)]
doc: update overlayfs and aufs in Japanese lxc.container.conf(5)

add the description of multiple lower layer.
Update for commit 280d237

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: Add network clear option to Korean lxc.container.conf(5)
Sungbae Yoo [Mon, 1 Feb 2016 11:11:09 +0000 (20:11 +0900)]
doc: Add network clear option to Korean lxc.container.conf(5)

Update for commit 020104c

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: add clear behaviour of list options to Korean lxc.container.conf(5)
Sungbae Yoo [Mon, 1 Feb 2016 10:57:04 +0000 (19:57 +0900)]
doc: add clear behaviour of list options to Korean lxc.container.conf(5)

Update for commit ff68914

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agochange version to 2.0.0.beta2 in configure.ac
Stéphane Graber [Mon, 1 Feb 2016 11:09:20 +0000 (12:09 +0100)]
change version to 2.0.0.beta2 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #786 from brauner/2016-01-31/lxc_copy_fix
Stéphane Graber [Mon, 1 Feb 2016 10:40:04 +0000 (11:40 +0100)]
Merge pull request #786 from brauner/2016-01-31/lxc_copy_fix

lxc-copy: cleanup

8 years agoAlso move lxc-device in translated docs
Stéphane Graber [Mon, 1 Feb 2016 10:28:28 +0000 (11:28 +0100)]
Also move lxc-device in translated docs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: always enable lxc-device.1
Wolfgang Bumiller [Mon, 1 Feb 2016 10:18:59 +0000 (11:18 +0100)]
doc: always enable lxc-device.1

Commit ea4679694 replaced the python implementation with a
C one.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agolxc-copy: cleanup
Christian Brauner [Thu, 28 Jan 2016 15:02:01 +0000 (16:02 +0100)]
lxc-copy: cleanup

- make free_mnts() work directly on the globals mnt_table and mnt_table_size
- have free_mnts() set mnt_table = NULL and mnt_table_size = 0 when its done to
  avoid double frees
- simplify error-handling in do_clone_ephemeral()
- do_clone_ephemeral(): when chmod() falls to set permissions on the temporary
  folder we created for mkdtemp() remove the folder
- simplify error handling in main()

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agodoc: update overlayfs and aufs in Japanese lxc.container.conf(5)
KATOH Yasufumi [Mon, 1 Feb 2016 08:29:20 +0000 (17:29 +0900)]
doc: update overlayfs and aufs in Japanese lxc.container.conf(5)

add the description of multiple lower layer.
Update for commit 280d237

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: Adapt manpage for Japanese lxc-ls to new C implementation
KATOH Yasufumi [Mon, 1 Feb 2016 08:29:19 +0000 (17:29 +0900)]
doc: Adapt manpage for Japanese lxc-ls to new C implementation

Update for commit 37cf83e

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: Add network clear option to Japanese lxc.container.conf(5)
KATOH Yasufumi [Mon, 1 Feb 2016 08:29:18 +0000 (17:29 +0900)]
doc: Add network clear option to Japanese lxc.container.conf(5)

Update for commit 020104c

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: add clear behaviour of list options to Japanese lxc.container.conf(5)
KATOH Yasufumi [Mon, 1 Feb 2016 08:29:17 +0000 (17:29 +0900)]
doc: add clear behaviour of list options to Japanese lxc.container.conf(5)

Update for commit ff68914

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #785 from hallyn/2016-01-31/cgfs
Stéphane Graber [Sun, 31 Jan 2016 16:56:26 +0000 (17:56 +0100)]
Merge pull request #785 from hallyn/2016-01-31/cgfs

2016 01 31/cgfs

8 years agocgfs: prune the init scope from paths
Serge Hallyn [Sun, 31 Jan 2016 15:34:54 +0000 (16:34 +0100)]
cgfs: prune the init scope from paths

Just as cgmanager does, if we are calculating a task's paths, drop
the trailing '/init.scope'.  We don't want the container to sit under
there.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agocgfs: always handle named subsystems by default
Serge Hallyn [Sun, 31 Jan 2016 15:33:30 +0000 (16:33 +0100)]
cgfs: always handle named subsystems by default

Previously, name= controllers would be handled if lxc.cgroup.use=@all,
but not if lxc.cgroup.use was unspecified.  Change that, since you cannot
run systemd in a container without it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoFix syntax error in ko/lxc-ls.sgml.in
Stéphane Graber [Sun, 31 Jan 2016 11:15:59 +0000 (12:15 +0100)]
Fix syntax error in ko/lxc-ls.sgml.in

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: Adapt manpage for Korean lxc-ls to new C implementation
Sungbae Yoo [Fri, 29 Jan 2016 09:29:34 +0000 (09:29 +0000)]
doc: Adapt manpage for Korean lxc-ls to new C implementation

Update for commit 37cf83e

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: Add valueless lxc.cap.drop behaviour to Korean man page
Sungbae Yoo [Fri, 29 Jan 2016 09:28:36 +0000 (09:28 +0000)]
doc: Add valueless lxc.cap.drop behaviour to Korean man page

Update for commit 7eff30f

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agodoc: Add lxc-copy to Korean/Japanese see_also.sgml.in
Sungbae Yoo [Fri, 29 Jan 2016 09:27:13 +0000 (09:27 +0000)]
doc: Add lxc-copy to Korean/Japanese see_also.sgml.in

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoRemove wrong command line arg from help output
Christian Brauner [Thu, 28 Jan 2016 14:24:01 +0000 (15:24 +0100)]
Remove wrong command line arg from help output

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #780 from hallyn/2016-01-29/chown
Stéphane Graber [Sat, 30 Jan 2016 00:26:32 +0000 (01:26 +0100)]
Merge pull request #780 from hallyn/2016-01-29/chown

implement chown for cgfs

8 years agoMerge pull request #784 from mingewang/master
Stéphane Graber [Sat, 30 Jan 2016 00:25:33 +0000 (01:25 +0100)]
Merge pull request #784 from mingewang/master

increase /dev size to 500k ( issue #781)

8 years agoincrease /dev size to 500k ( issue #781)
Min Wang [Fri, 29 Jan 2016 20:40:28 +0000 (15:40 -0500)]
increase /dev size to 500k ( issue #781)

Signed-off-by: Min Wang <mingewang@gmail.com>
8 years agoMerge pull request #777 from hallyn/2016-01-28/cgns1
Stéphane Graber [Fri, 29 Jan 2016 17:13:32 +0000 (18:13 +0100)]
Merge pull request #777 from hallyn/2016-01-28/cgns1

cgroup ns: move the check for whether cgns is supported

8 years agoimplement chown for cgfs
Serge Hallyn [Fri, 29 Jan 2016 09:03:27 +0000 (10:03 +0100)]
implement chown for cgfs

This allows cgfs to be used to create containers in a user namespace,
and have the container owner be able to use cgroups.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #768 from clopez/ignore_git_directories
Stéphane Graber [Fri, 29 Jan 2016 16:16:36 +0000 (17:16 +0100)]
Merge pull request #768 from clopez/ignore_git_directories

Ignore any container named '.git'

8 years agoIgnore any container with a name starting by '.'
Carlos Alberto Lopez Perez [Fri, 29 Jan 2016 14:39:22 +0000 (15:39 +0100)]
Ignore any container with a name starting by '.'

  * This are either '.', '..' or a hidden directory.
    And this names should not be used for a container
    in any case.

  * Before this patch, if you created a git repository under lxc.lxcpath (it
    can be useful to keep track of the configurations of your containers)

    Then, when you run lxc-ls you will get the following output:

        # lxc-ls
        .git      container1      container2    ....

    This is because there is a 'config' file inside the '.git' directory.
    It is where git stores the configuration of the repository.

    And the test lxc-ls does to check if a directory contains a container
    is just to check if the 'directory/config' file exists.

Signed-off-by: Carlos Alberto Lopez Perez <clopez@igalia.com>
8 years agoAdd SOCK_CLOEXEC define for Android
Stéphane Graber [Fri, 29 Jan 2016 12:35:47 +0000 (13:35 +0100)]
Add SOCK_CLOEXEC define for Android

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #779 from hiraku/fix-centos-template-uppercase
Stéphane Graber [Fri, 29 Jan 2016 09:09:49 +0000 (10:09 +0100)]
Merge pull request #779 from hiraku/fix-centos-template-uppercase

Use ${utsname} instead of ${UTSNAME} because latter variable is not defined

8 years agoUse ${utsname} instead of ${UTSNAME} because latter variable is not defined.
KURODA Hiraku [Fri, 29 Jan 2016 08:29:38 +0000 (17:29 +0900)]
Use ${utsname} instead of ${UTSNAME} because latter variable is not defined.

Signed-off-by: KURODA Hiraku <kuroda@syngram.co.jp>
8 years agoMerge pull request #740 from kvaidas/master
Stéphane Graber [Fri, 29 Jan 2016 08:55:22 +0000 (09:55 +0100)]
Merge pull request #740 from kvaidas/master

Template parameter --variant tells debootstrap which variant to use.

8 years agoMerge pull request #772 from nehaljwani/fix-fedora-template-stmt
Stéphane Graber [Fri, 29 Jan 2016 08:44:13 +0000 (09:44 +0100)]
Merge pull request #772 from nehaljwani/fix-fedora-template-stmt

Fix echo statement inside fedora template

8 years agoMerge pull request #773 from nehaljwani/fix-lxc-create-report
Stéphane Graber [Fri, 29 Jan 2016 08:43:55 +0000 (09:43 +0100)]
Merge pull request #773 from nehaljwani/fix-lxc-create-report

Fix message after {fedora|centos}container creation

8 years agoMerge pull request #774 from Nicop06/patch-1
Stéphane Graber [Fri, 29 Jan 2016 08:37:52 +0000 (09:37 +0100)]
Merge pull request #774 from Nicop06/patch-1

Fix typo in lxc-archlinux.in

8 years agoMerge pull request #778 from hallyn/2016-01-28/usernic
Stéphane Graber [Fri, 29 Jan 2016 08:37:15 +0000 (09:37 +0100)]
Merge pull request #778 from hallyn/2016-01-28/usernic

lxc-test-usernic: update to reflect new lxc-test-usernic arguments

8 years agoFix echo statement inside fedora template
Nehal J Wani [Thu, 21 Jan 2016 19:05:27 +0000 (00:35 +0530)]
Fix echo statement inside fedora template

We no longer use mirrors.kernel.org.
Commit f71e8f4 switched it to archives.fedoraproject.org

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
8 years agoFix message after {fedora|centos}container creation
Nehal J Wani [Thu, 21 Jan 2016 21:06:33 +0000 (02:36 +0530)]
Fix message after {fedora|centos}container creation

If the backingstore is not 'dir', then lxc shouldn't ask the user
to change the password by performing a 'chroot'. Rather, the user
should start, attach, use the passwd command, and then stop the
container.

Fixes #731

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
8 years agolxc-test-usernic: update to reflect new lxc-test-usernic arguments
Serge Hallyn [Thu, 28 Jan 2016 17:08:50 +0000 (18:08 +0100)]
lxc-test-usernic: update to reflect new lxc-test-usernic arguments

the new lxcpath and lxcname are not optional

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoallow cgroupfs mounts under /sys/fs/cgroup
Serge Hallyn [Thu, 28 Jan 2016 16:48:55 +0000 (17:48 +0100)]
allow cgroupfs mounts under /sys/fs/cgroup

Systemd needs to be able to do these, and it does not bypass
any of our apparmor rules.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agocgroup ns: move the check for whether cgns is supported
Serge Hallyn [Thu, 28 Jan 2016 16:40:06 +0000 (17:40 +0100)]
cgroup ns: move the check for whether cgns is supported

We have to do it before we join the container's mntns so we have
the host's procdir.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoFix Android build of lxc-ls
Stéphane Graber [Thu, 28 Jan 2016 16:08:36 +0000 (17:08 +0100)]
Fix Android build of lxc-ls

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agofork off a task to delete ovs ports when done
Serge Hallyn [Thu, 14 Jan 2016 07:48:57 +0000 (07:48 +0000)]
fork off a task to delete ovs ports when done

The new task waits until the container is STOPPED, then asks
openvswitch to delete the port.

This requires two new arguements to be sent to lxc-user-nic.
Since lxc-user-nic ships with lxc, this shouldn't be a problem.

Finally when calling lxc-user-nic, use execlp insteac of execvp
to preserve lxcpath's const-ness.  Technically we are
guaranteed that execvp won't change the args, but it's worth
it to silence the warnings (and not hide real errors).

With this patch, container nics are cleaned up from openvswitch
bridges on shutdown.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoFix Android build failure
Stéphane Graber [Thu, 28 Jan 2016 13:53:26 +0000 (14:53 +0100)]
Fix Android build failure

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agolxc-ls: tweak algorithm for ls_has_all_grps()
Christian Brauner [Thu, 28 Jan 2016 11:21:30 +0000 (12:21 +0100)]
lxc-ls: tweak algorithm for ls_has_all_grps()

- With the -g/--groups argument the user can give a comma-separated list of
  groups MUST a container must have in order to be displayed. We receive
  this list as a single string. ls_has_all_grps() is called to check if a
  container has all the groups of MUST in its current list of groups HAS. I.e.
  we determine whether MUST ⊆ HAS and only then do we record the container.
  The original implementation was dumb in that it split the string MUST
  everytime it needed to check whether MUST ⊆ HAS for a given container. That's
  pointless work. Instead we split the string MUST only once in main() and pass
  it to ls_get() which passes it along to ls_has_all_grps().
- Before doing any costly checking make sure that #MUST <= #HAS. If not bail
  immediately.
- The linear search algorithm ls_has_all_grps() currently uses stays for now.
  Binary search et al. do not seem to make sense since sorting the array HAS
  for each container is probably too costly. Especially, since it seems
  unlikely that a users specifies 50+ or so groups on the command line a
  container must have to be displayed. If however there are a lot of use-cases
  where users have a lot of containers each with 50-100 groups and regularly use
  lxc-ls with -g/--groups to only show containers that have 50 specified groups
  among their 50-100 groups we can revisit this issue and implement e.g. binary
  search or a ternary search tree.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agoRestore old behaviour [filter] behaviour
Christian Brauner [Thu, 28 Jan 2016 11:21:29 +0000 (12:21 +0100)]
Restore old behaviour [filter] behaviour

In the Python implementation users could pass a regex without a parameter flag
as additional argument on the command line. The C implementation gained the
flag -r/--regex for this. To not irritate users we restore the old behaviour
and additionally rename -r/--regex to --filter to allow eplicitly passing the
regex.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agolxc-ls: check for ENOMEM and tweaking
Christian Brauner [Thu, 28 Jan 2016 11:21:28 +0000 (12:21 +0100)]
lxc-ls: check for ENOMEM and tweaking

- If lxc_container_new() fails we check for ENOMEM and if so goto out. If
  ENOMEM is not set we will simply continue. The same goes for the call to
  regcomp() but instead of checking for ENOMEM we need to check for REG_ESPACE.

- Tweaking: Since lxc-ls might have to gather a lot of containers and I don't
  know if compilers will always optimize this let's move *some* variable
  declarations outside of the loop when it does not hinder readability

- Set ls_nesting to 0 initially. Otherwise users will always see nested
  containers printed.

- ls_get() gains an argument char **lockpath which is a string pointing us to
  the lock we put under /run/lxc/lock/.../... so that we can remove the lock
  when we no longer need it. To avoid pointless memory allocation in each new
  recursion level we share lockpath amongst all non-fork()ing recursive call to
  ls_get().  As it is not guaranteed that realloc() does not do any memory
  moving when newlen == len_lockpath, we give ls_get() an additional argument
  size_t len_lockpath). Every time we have a non-fork()ing recursive call to
  ls_get() we check if newlen > len_lockpath and only then do we
  realloc(*lockpath, newlen * 2) a reasonable chunk of memory (as the path will
  keep growing) and set len_lockpath = newlen * 2 to pass to the next
  non-fork()ing recursive call to ls_get().
  To avoid keeping a variable char *lockpath in main() which serves no purpose
  whatsoever and might be abused later we use a compound literal
  &(char *){NULL} which gives us an anonymous pointer which we can use for
  memory allocation in ls_get() for lockpath. We can conveniently free() it in
  ls_get() when the nesting level parameter lvl == 0 after exiting the loop.
  The advantage is that the variable is only accessible within ls_get() and not
  in main() while at the same time giving us an easy way to share lockpath
  amongst all non-fork()ing recursive calls to ls_get().

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agoRevert "lxc-ls: check for ENOMEM and tweaking"
Stéphane Graber [Thu, 28 Jan 2016 11:33:00 +0000 (12:33 +0100)]
Revert "lxc-ls: check for ENOMEM and tweaking"

This reverts commit 7f3c1cf27f1fcd29b5e7f0b11e4aadfadd5f18ec.

8 years agoRevert "lxc-ls: Restore old [filter] behaviour"
Stéphane Graber [Thu, 28 Jan 2016 11:32:56 +0000 (12:32 +0100)]
Revert "lxc-ls: Restore old [filter] behaviour"

This reverts commit e4434e0fc99631036b1fdabe7216e0a1218f4f3f.