]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
6 years agocommands: mv lxc_make_abstract_socket_name()
Christian Brauner [Mon, 3 Jul 2017 21:31:04 +0000 (23:31 +0200)]
commands: mv lxc_make_abstract_socket_name()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: make state server interface flexible
Christian Brauner [Sun, 2 Jul 2017 13:42:07 +0000 (15:42 +0200)]
commands: make state server interface flexible

This adds a little more flexibility to the state server. The idea is to have a
command socket function "lxc_cmd_add_state_client()" whose only task is to add
a new state client to the container's in-memory handler. This function returns
either the state of the container if it is already in the requested state or it
will return the newly registered client's fd in one of its arguments to the
caller. We then provide a separate helper function "lxc_cmd_sock_rcv_state()"
which can be passed the returned client fd and listens on the fd for the
requested state.
This is useful when we want to first register a client, then send a signal to
the container and wait for a state. This ensure that the client fd is
registered before the signal can have any effect and can e.g. be used to catch
something like the "STOPPING" state that is very ephemeral.

Additionally we provide a convenience function "lxc_cmd_sock_get_state()" which
combines both tasks and is used in e.g. "lxc_wait()".

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: rename to lxc_cmd_add_state_client()
Christian Brauner [Sun, 2 Jul 2017 12:47:02 +0000 (14:47 +0200)]
commands: rename to lxc_cmd_add_state_client()

The new wait commands API is not yet stable so this change is ok.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxc static init: report exec*() failure
Christian Brauner [Fri, 30 Jun 2017 13:30:18 +0000 (15:30 +0200)]
lxc static init: report exec*() failure

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotest: shortlived daemonized containers
Christian Brauner [Thu, 29 Jun 2017 13:01:11 +0000 (15:01 +0200)]
test: shortlived daemonized containers

Add a test to see if we can start daemonized containers that have a very
short-lived init process. The point of this is to see whether we can correctly
retrieve the state.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: non-functional changes
Christian Brauner [Thu, 29 Jun 2017 18:53:07 +0000 (20:53 +0200)]
lxccontainer: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: make sure memory is free()ed
Christian Brauner [Thu, 29 Jun 2017 18:49:56 +0000 (20:49 +0200)]
lxccontainer: make sure memory is free()ed

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: use separate socket on daemonized start
Christian Brauner [Thu, 29 Jun 2017 10:16:00 +0000 (12:16 +0200)]
start: use separate socket on daemonized start

Since we killed lxc-monitord we rely on the container's command socket to wait
for the container. This doesn't work nicely on daemonized startup since a
container's init process might be something that is so short-lived that we
won't even be able to add a state client before the mainloop closes. But the
container might still have been RUNNING and executed the init binary correctly.
In this case we would erroneously report that the container failed to start
when it actually started just fine.
This commit ensures that we really all cases where the container successfully
ran by switching to a short-lived per-container anonymous unix socket pair that
uses credentials to pass container states around. It is immediately closed once
the container has started successfully.
This should also make daemonized container start way more robust since we don't
rely on the command socket handler to be running.

For the experienced developer: Yes, I did think about utilizing the command
socket directly for this. The problem is that when the mainloop starts it may
end up end accept()ing the connection that we want
do_wait_on_daemonized_start() to accept() so this won't work and might cause us
to hang indefinitely. The same problem arises when the container fails to start
before the mainloop is created. In this case we would hang indefinitely as
well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: generalize lxc_check_inherited()
Christian Brauner [Wed, 28 Jun 2017 11:30:05 +0000 (13:30 +0200)]
start: generalize lxc_check_inherited()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: lxc_make_abstract_socket_name()
Christian Brauner [Wed, 28 Jun 2017 22:50:19 +0000 (00:50 +0200)]
utils: lxc_make_abstract_socket_name()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #1665 from brauner/2017-07-01/deprecate_lxc_rootfs_backend
Serge Hallyn [Sat, 8 Jul 2017 21:25:17 +0000 (21:25 +0000)]
Merge pull request #1665 from brauner/2017-07-01/deprecate_lxc_rootfs_backend

prepare for LXC 2.1

6 years agoMerge pull request #1683 from 0x0916/2017-07-08/remove-unlink
Christian Brauner [Sat, 8 Jul 2017 14:56:34 +0000 (16:56 +0200)]
Merge pull request #1683 from 0x0916/2017-07-08/remove-unlink

af_unix: remove unlink operation

6 years agoMerge pull request #1684 from 0x0916/2017-07-08/remove-dead-code
Christian Brauner [Sat, 8 Jul 2017 06:16:50 +0000 (08:16 +0200)]
Merge pull request #1684 from 0x0916/2017-07-08/remove-dead-code

state: remove lxc_rmstate declaration

6 years agoMerge pull request #1685 from 0x0916/2017-07-08/remove-workaround-code
Christian Brauner [Sat, 8 Jul 2017 06:16:43 +0000 (08:16 +0200)]
Merge pull request #1685 from 0x0916/2017-07-08/remove-workaround-code

lxc_abstract_unix_connect: remove the workaround-code

6 years agoMerge pull request #1686 from 0x0916/2017-07-08/close-parent-end-after-fork
Christian Brauner [Sat, 8 Jul 2017 06:16:35 +0000 (08:16 +0200)]
Merge pull request #1686 from 0x0916/2017-07-08/close-parent-end-after-fork

utils: close parent end in child process after fork

6 years agoutils: close parent end in child process after fork
Long Wang [Sat, 8 Jul 2017 05:27:16 +0000 (13:27 +0800)]
utils: close parent end in child process after fork

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxc_abstract_unix_connect: remove the workaround-code
Long Wang [Sat, 8 Jul 2017 02:48:15 +0000 (10:48 +0800)]
lxc_abstract_unix_connect: remove the workaround-code

commit bdb3f44147bc1a55a97131b4b39d42844ae4fb9e says that we may undo
the change in august 2014.

I think that it is time to do that.

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agostate: remove lxc_rmstate declaration
Long Wang [Sat, 8 Jul 2017 02:40:41 +0000 (10:40 +0800)]
state: remove lxc_rmstate declaration

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoaf_unix: remove unlink operation
Long Wang [Sat, 8 Jul 2017 02:29:57 +0000 (10:29 +0800)]
af_unix: remove unlink operation

It is not necessary to unlink the abstract socket pathname when
we have finished using the socket. The abstract name is automatically
removed when the socket is closed.

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoMerge pull request #1682 from brauner/2017-07-07/enable_apparmor_namespaces
Stéphane Graber [Fri, 7 Jul 2017 21:43:19 +0000 (17:43 -0400)]
Merge pull request #1682 from brauner/2017-07-07/enable_apparmor_namespaces

Allow containers to start in AppArmor namespaces

6 years agoAllow containers to start in AppArmor namespaces
Frédéric Dalleau [Fri, 7 Jul 2017 09:26:45 +0000 (11:26 +0200)]
Allow containers to start in AppArmor namespaces

This patch allows users to start containers in AppArmor namespaces.
Users can define their own profiles for their containers, but
lxc-start must be allowed to change to a namespace.

A container configuration file can wrap a container in an AppArmor
profile using lxc.aa_profile.

A process in an AppArmor namespace is restricted to view
or manage only the profiles belonging to this namespace, as if no
other profiles existed. A namespace can be created as follow:
sudo mkdir /sys/kernel/security/apparmor/policy/namespaces/$NAMESPACE

AppArmor can stack profiles so that the contained process is bound
by the intersection of all profiles of the stack. This is achieved
using the '//&' operator as follow:

lxc.aa_profile = $PROFILE//&:$NAMESPACE://unconfined

In this case, even the guest process appears unconfined in the
namespace, it is still confined by $PROFILE.

A guest allowed to access "/sys/kernel/security/apparmor/** rwklix,"
will be able to manage its own profile set, while still being
enclosed in the topmost profile $PROFILE:

Different guests can be assigned the same namespace or different
namespaces. In the first case, they will share their profiles.
In the second case, they will have distinct sets of profiles.

This is validated on privileged containers.

Signed-off-by: Frédéric Dalleau <frederic.dalleau@collabora.com>
6 years agoMerge pull request #1675 from 0x0916/2017-07-05/lxc-init
Christian Brauner [Thu, 6 Jul 2017 13:31:37 +0000 (15:31 +0200)]
Merge pull request #1675 from 0x0916/2017-07-05/lxc-init

lxc-init: some enhancements

6 years agoMerge pull request #1673 from brauner/2017-07-04/update_readme
Stéphane Graber [Wed, 5 Jul 2017 16:27:28 +0000 (12:27 -0400)]
Merge pull request #1673 from brauner/2017-07-04/update_readme

README: update

6 years agoMerge pull request #1677 from 0x0916/2017-07-05/fix-parse-config-file
Christian Brauner [Wed, 5 Jul 2017 09:50:01 +0000 (11:50 +0200)]
Merge pull request #1677 from 0x0916/2017-07-05/fix-parse-config-file

tests: delete the intermediate file and directory.

6 years agoMerge pull request #1676 from 0x0916/2017-07-05/fix-headers
Christian Brauner [Wed, 5 Jul 2017 09:32:14 +0000 (11:32 +0200)]
Merge pull request #1676 from 0x0916/2017-07-05/fix-headers

fix headers

6 years agotests: remove temp lxcpath for attach testcase
Long Wang [Wed, 5 Jul 2017 07:39:02 +0000 (15:39 +0800)]
tests: remove temp lxcpath for attach testcase

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agotests: remove the temp container directory
Long Wang [Wed, 5 Jul 2017 07:17:58 +0000 (15:17 +0800)]
tests: remove the temp container directory

c->destory() will not remove the temp container directory.
This patch fix that.

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agotests: create temp file before lxc_container_new
Long Wang [Wed, 5 Jul 2017 06:51:03 +0000 (14:51 +0800)]
tests: create temp file before lxc_container_new

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agouse same ifndef/define format for all headers
Long Wang [Wed, 5 Jul 2017 04:20:28 +0000 (12:20 +0800)]
use same ifndef/define format for all headers

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agocaps.h: move ifndef/define to the top
Long Wang [Wed, 5 Jul 2017 04:19:37 +0000 (12:19 +0800)]
caps.h: move ifndef/define to the top

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxc-init: move initialization of act to outside of the loop
Long Wang [Wed, 5 Jul 2017 04:01:16 +0000 (12:01 +0800)]
lxc-init: move initialization of act to outside of the loop

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxc-init: adjust include statements
Long Wang [Wed, 5 Jul 2017 03:54:25 +0000 (11:54 +0800)]
lxc-init: adjust include statements

* Use `#include <lxc/lxccontaienr.h>` style for exported haeders.
* remove used header `caps.h`

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxc-init: non-functional changes
Long Wang [Wed, 5 Jul 2017 02:57:14 +0000 (10:57 +0800)]
lxc-init: non-functional changes

This patch mainly update the message format to:

* upper the first letter
* end without a dot

all changes are relate to `lxc-init`

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxc-init: add comment for exclude 32 and 33 signals
Long Wang [Wed, 5 Jul 2017 02:53:02 +0000 (10:53 +0800)]
lxc-init: add comment for exclude 32 and 33 signals

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoMerge pull request #1674 from 0x0916/2017-07-04/lxc-execute
Christian Brauner [Tue, 4 Jul 2017 13:18:55 +0000 (15:18 +0200)]
Merge pull request #1674 from 0x0916/2017-07-04/lxc-execute

lxc-execute: print error message when failed

6 years agolxc-execute: print error message when failed
Long Wang [Tue, 4 Jul 2017 08:16:30 +0000 (16:16 +0800)]
lxc-execute: print error message when failed

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoREADME: update
Christian Brauner [Mon, 3 Jul 2017 22:15:05 +0000 (00:15 +0200)]
README: update

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #1672 from brauner/2017-07-03/add_cii_best_practices_badge_to_readme
Stéphane Graber [Mon, 3 Jul 2017 18:51:51 +0000 (14:51 -0400)]
Merge pull request #1672 from brauner/2017-07-03/add_cii_best_practices_badge_to_readme

README: add CII Best Practices badge to README

6 years agoREADME: add CII Best Practices badge to README
Christian Brauner [Mon, 3 Jul 2017 18:39:59 +0000 (20:39 +0200)]
README: add CII Best Practices badge to README

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #1668 from 0x0916/2017-07-03/lxclock
Christian Brauner [Mon, 3 Jul 2017 09:30:59 +0000 (11:30 +0200)]
Merge pull request #1668 from 0x0916/2017-07-03/lxclock

lxclock: bugfix and update some comment

6 years agolxclock: non-functional changes
Long Wang [Mon, 3 Jul 2017 07:43:34 +0000 (15:43 +0800)]
lxclock: non-functional changes

This patch mainly updates comments based on the current code.

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agolxclock: return the right error when open lock file failed
Long Wang [Mon, 3 Jul 2017 07:41:25 +0000 (15:41 +0800)]
lxclock: return the right error when open lock file failed

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoMerge pull request #1667 from 0x0916/2017-07-02/fix-cppcheck-warnings
Christian Brauner [Sun, 2 Jul 2017 15:47:36 +0000 (17:47 +0200)]
Merge pull request #1667 from 0x0916/2017-07-02/fix-cppcheck-warnings

fix some cppcheck warnings

6 years agoMerge pull request #1666 from 0x0916/2017-07-02/remove-unused-code
Christian Brauner [Sun, 2 Jul 2017 15:46:29 +0000 (17:46 +0200)]
Merge pull request #1666 from 0x0916/2017-07-02/remove-unused-code

remove the unused macro

6 years agofix some cppcheck warnings
0x0916 [Sun, 2 Jul 2017 11:12:05 +0000 (19:12 +0800)]
fix some cppcheck warnings

use cppcheck tools `cppcheck --enable=warning  .` on lxc source directory.

This patch fix the following warnning

```
[src/lxc/cgroups/cgfs.c:794]: (warning) %ld in format string (no. 3) requires 'long' but the argument type is 'unsigned long'.
[src/lxc/confile.c:4441]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/lxc/confile.c:4502]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/lxc/confile_legacy.c:921]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/lxc/confile_legacy.c:938]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/lxc/lxclock.c:63]: (warning) %zd in format string (no. 1) requires 'ssize_t' but the argument type is 'size_t {aka unsigned long}'.
[src/lxc/tools/lxc_info.c:118]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_info.c:118]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_info.c:123]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_info.c:127]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_info.c:130]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_top.c:212]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_top.c:212]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_top.c:217]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_top.c:221]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/lxc/tools/lxc_top.c:224]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
```

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoremove the unused macro
0x0916 [Sun, 2 Jul 2017 11:45:41 +0000 (19:45 +0800)]
remove the unused macro

Signed-off-by: Long Wang <w@laoqinren.net>
6 years agoconfile: lxc.seccomp --> lxc.seccomp.profile
Christian Brauner [Sun, 2 Jul 2017 10:56:01 +0000 (12:56 +0200)]
confile: lxc.seccomp --> lxc.seccomp.profile

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.pts --> lxc.pty.max
Christian Brauner [Sun, 2 Jul 2017 10:49:29 +0000 (12:49 +0200)]
confile: lxc.pts --> lxc.pty.max

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.tty --> lxc.tty.max
Christian Brauner [Sun, 2 Jul 2017 10:37:33 +0000 (12:37 +0200)]
confile: lxc.tty --> lxc.tty.max

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.net.ipv6 --> lxc.net.ipv6.address
Christian Brauner [Sun, 2 Jul 2017 09:54:27 +0000 (11:54 +0200)]
confile: lxc.net.ipv6 --> lxc.net.ipv6.address

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.net.ipv4 --> lxc.net.ipv4.address
Christian Brauner [Sun, 2 Jul 2017 09:53:34 +0000 (11:53 +0200)]
confile: lxc.net.ipv4 --> lxc.net.ipv4.address

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.mount --> lxc.mount.fstab
Christian Brauner [Sun, 2 Jul 2017 09:37:32 +0000 (11:37 +0200)]
confile: lxc.mount --> lxc.mount.fstab

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.console --> lxc.console.path
Christian Brauner [Sun, 2 Jul 2017 09:35:00 +0000 (11:35 +0200)]
confile: lxc.console --> lxc.console.path

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: lxc.rootfs --> lxc.rootfs.path
Christian Brauner [Sun, 2 Jul 2017 00:21:08 +0000 (02:21 +0200)]
confile: lxc.rootfs --> lxc.rootfs.path

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agodoc: remove lxc.rootfs.backend
Christian Brauner [Sun, 2 Jul 2017 00:10:11 +0000 (02:10 +0200)]
doc: remove lxc.rootfs.backend

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotest: fix tests
Christian Brauner [Sat, 1 Jul 2017 23:19:55 +0000 (01:19 +0200)]
test: fix tests

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: handle prefixed rootfs paths
Christian Brauner [Sat, 1 Jul 2017 23:44:25 +0000 (01:44 +0200)]
storage: handle prefixed rootfs paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all zfs paths
Christian Brauner [Sat, 1 Jul 2017 21:41:49 +0000 (23:41 +0200)]
storage: prefix all zfs paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all rbd paths
Christian Brauner [Sat, 1 Jul 2017 21:35:58 +0000 (23:35 +0200)]
storage: prefix all rbd paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all nbd paths
Christian Brauner [Sat, 1 Jul 2017 21:33:18 +0000 (23:33 +0200)]
storage: prefix all nbd paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all lvm paths
Christian Brauner [Sat, 1 Jul 2017 21:31:18 +0000 (23:31 +0200)]
storage: prefix all lvm paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all btrfs paths
Christian Brauner [Sat, 1 Jul 2017 21:02:45 +0000 (23:02 +0200)]
storage: prefix all btrfs paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: prefix all dir paths
Christian Brauner [Sat, 1 Jul 2017 20:36:27 +0000 (22:36 +0200)]
storage: prefix all dir paths

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: add lxc_storage_get_path()
Christian Brauner [Sat, 1 Jul 2017 20:36:05 +0000 (22:36 +0200)]
storage: add lxc_storage_get_path()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: add storage_utils.{c.h}
Christian Brauner [Sat, 1 Jul 2017 16:15:59 +0000 (18:15 +0200)]
storage: add storage_utils.{c.h}

non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: deprecate lxc.rootfs.backend
Christian Brauner [Sat, 1 Jul 2017 15:02:13 +0000 (17:02 +0200)]
storage: deprecate lxc.rootfs.backend

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #1591 from grzgrzgrz3/regres-lxc-ls
Christian Brauner [Sun, 2 Jul 2017 12:31:03 +0000 (14:31 +0200)]
Merge pull request #1591 from grzgrzgrz3/regres-lxc-ls

lxc-ls: return all containers by default, new filter - list only defi…

6 years agoMerge pull request #1664 from d4s/altlinux-template
Stéphane Graber [Sun, 2 Jul 2017 06:06:35 +0000 (02:06 -0400)]
Merge pull request #1664 from d4s/altlinux-template

Added '--apt-conf' argument for ALTLinux template.

6 years agoAdded '--apt-conf' argument for ALTLinux template.
Denis Pynkin [Sat, 1 Jul 2017 14:30:17 +0000 (17:30 +0300)]
Added '--apt-conf' argument for ALTLinux template.

Added [-a|--apt-conf] parameter for selection of exact package
providing 'apt-conf'. By default 'apt-conf-sisyphus' is used for
Sisyphus and 'apt-conf-branch' for the rest of branches.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoMerge pull request #1658 from 0x0916/2017-06-30/new-configuration-keys
Christian Brauner [Sat, 1 Jul 2017 11:09:28 +0000 (13:09 +0200)]
Merge pull request #1658 from 0x0916/2017-06-30/new-configuration-keys

new configuration keys

6 years agoMerge pull request #1661 from 0x0916/2017-07-01/fix-set-state-error
Christian Brauner [Sat, 1 Jul 2017 11:08:35 +0000 (13:08 +0200)]
Merge pull request #1661 from 0x0916/2017-07-01/fix-set-state-error

start: send state to legacy lxc-monitord state server even if no state clients registered

6 years agostart: send state to legacy lxc-monitord state server even if no state clients registered
0x0916 [Sat, 1 Jul 2017 05:44:41 +0000 (13:44 +0800)]
start: send state to legacy lxc-monitord state server even if no state clients registered

This pr https://github.com/lxc/lxc/pull/1618 kill lxc-monitord, for backwards compatibility,
we also send state to legacy lxc-monitord state server in function `lxc_set_state`.

we should also send state if there is no state clients registered, otherwise `lxc-monitor` client will
not get state change event if container changed state to `STARTING` or `RUNNING`.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1662 from 0x0916/2017-07-01/lxc-monitor-quit
Christian Brauner [Sat, 1 Jul 2017 09:43:14 +0000 (11:43 +0200)]
Merge pull request #1662 from 0x0916/2017-07-01/lxc-monitor-quit

lxc-monitord: exit when got a quit command

6 years agolxc-monitord: exit when got a quit command
0x0916 [Sat, 1 Jul 2017 06:04:14 +0000 (14:04 +0800)]
lxc-monitord: exit when got a quit command

lxc-monitor has an option to tell lxc-monitord to quit.

```
~/lxc (master) # lxc-monitor --help
lxc-monitor monitors the state of the NAME container

Options :
  -n, --name=NAME   NAME of the container
                    NAME may be a regular expression
  -Q, --quit        tell lxc-monitord to quit
```
But it does not work. This patch fix that.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: rename lxc.utsname to lxc.uts.name
0x0916 [Wed, 28 Jun 2017 10:58:16 +0000 (18:58 +0800)]
confile: rename lxc.utsname to lxc.uts.name

the legacy keys will be kept around until LXC 3.0 and then will be
removed.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: rename lxc.devttydir to lxc.tty.dir
0x0916 [Wed, 28 Jun 2017 10:44:18 +0000 (18:44 +0800)]
confile: rename lxc.devttydir to lxc.tty.dir

the legacy keys will be kept around until LXC 3.0 and then will be
removed

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: namespace lxc.signal keys
0x0916 [Wed, 28 Jun 2017 11:26:02 +0000 (19:26 +0800)]
confile: namespace lxc.signal keys

* rename lxc.haltsignal to lxc.signal.halt
* rename lxc.rebootsignal to lxc.signal.reboot
* rename lxc.stopsignal to lxc.signal.stop

the legacy keys will be kept around until LXC 3.0 and then will be
removed.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: namespace lxc.log keys
0x0916 [Wed, 28 Jun 2017 09:30:41 +0000 (17:30 +0800)]
confile: namespace lxc.log keys

* rename lxc.logfile to lxc.log.file
* renaem lxc.loglevel to lxc.log.level
* rename lxc.syslog to lxc.log.syslog

the legacy keys will be kept around until LXC 3.0 and then will be
removed.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: namespace lxc.init keys
0x0916 [Wed, 28 Jun 2017 08:32:04 +0000 (16:32 +0800)]
confile: namespace lxc.init keys

* rename lxc.init_cmd to lxc.init.cmd
* rename lxc.init_uid to lxc.init.uid
* rename lxc.init_gid to lxc.init.gid

the legacy keys will be kept around until LXC 3.0 and then will be
removed.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: rename lxc.limit to lxc.prlimit
0x0916 [Wed, 28 Jun 2017 08:14:14 +0000 (16:14 +0800)]
confile: rename lxc.limit to lxc.prlimit

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1649 from 0x0916/2017-06-27/wipe-lxc-network-references
Christian Brauner [Thu, 29 Jun 2017 11:17:59 +0000 (13:17 +0200)]
Merge pull request #1649 from 0x0916/2017-06-27/wipe-lxc-network-references

wipe all references lxc.network.{[i]}.* and replace with lxc.net.[i].*

6 years agoconfile_legacy: fix lxc_clear_nic error
0x0916 [Thu, 29 Jun 2017 03:48:35 +0000 (11:48 +0800)]
confile_legacy: fix lxc_clear_nic error

`lxc_clear_nic` can not clear the nic, because it will not found
the right `netdev`.

testcase from get_item.c

```
313         if (!c->set_config_item(c, "lxc.network.hwaddr", "00:16:3e:xx:xx:xx")) {
314                 fprintf(stderr, "%d: failed to set network.hwaddr\n", __LINE__);
315                 goto out;
316         }
317         if (!c->set_config_item(c, "lxc.network.ipv4", "10.2.3.4")) {
318                 fprintf(stderr, "%d: failed to set ipv4\n", __LINE__);
319                 goto out;
320         }
321
322         ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
323         if (ret <= 0) {
324                 fprintf(stderr, "%d: lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
325                 goto out;
326         }
327         if (!c->clear_config_item(c, "lxc.network.0.ipv4")) {
328                 fprintf(stderr, "%d: failed clearing all ipv4 entries\n", __LINE__);
329                 goto out;
330         }
331         ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
332         if (ret != 0) {
333                 fprintf(stderr, "%d: after clearing ipv4 entries get_item(lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
334                 goto out;
335         }
```

line `327` will failed to clear nic, and line `333` give the error.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agotestcase: define a network before checks
0x0916 [Wed, 28 Jun 2017 23:32:54 +0000 (07:32 +0800)]
testcase: define a network before checks

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile_utils: supporting new net hwaddr key in update_hwaddr
0x0916 [Wed, 28 Jun 2017 02:59:39 +0000 (10:59 +0800)]
confile_utils: supporting new net hwaddr key in update_hwaddr

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: supporting new net hwaddr key in network_new_hwaddrs
0x0916 [Wed, 28 Jun 2017 02:58:29 +0000 (10:58 +0800)]
confile: supporting new net hwaddr key in network_new_hwaddrs

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile_utils: add lxc_config_net_hwaddr
0x0916 [Wed, 28 Jun 2017 02:56:43 +0000 (10:56 +0800)]
confile_utils: add lxc_config_net_hwaddr

`lxc_config_net_hwaddr` return true if the config entry
is `lxc.network.hwaddr` or `lxc.net.[i].hwaddr`, `lxc.network.[i].hwaddr`

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoconfile: update comment: replace p+12 with p+8
0x0916 [Tue, 27 Jun 2017 03:38:23 +0000 (11:38 +0800)]
confile: update comment: replace p+12 with p+8

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoreplace all lxc.network* with lxc.net*
0x0916 [Mon, 26 Jun 2017 13:08:34 +0000 (21:08 +0800)]
replace all lxc.network* with lxc.net*

This patch wipe all references to lxc.network{[i]}.*
and replace with lxc.net.{[i]}.* in templates, documentation
and configuration files.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1652 from 0x0916/2017-06-27/free-downscript
Christian Brauner [Tue, 27 Jun 2017 19:14:45 +0000 (21:14 +0200)]
Merge pull request #1652 from 0x0916/2017-06-27/free-downscript

confile: free netdev->downscript

6 years agoconfile: free netdev->downscript
0x0916 [Tue, 27 Jun 2017 14:12:38 +0000 (22:12 +0800)]
confile: free netdev->downscript

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1650 from 0x0916/2017-06-27/refactor-confile-code
Christian Brauner [Tue, 27 Jun 2017 08:43:35 +0000 (10:43 +0200)]
Merge pull request #1650 from 0x0916/2017-06-27/refactor-confile-code

refactor confile code

6 years agorefactor confile code
0x0916 [Tue, 27 Jun 2017 07:54:23 +0000 (15:54 +0800)]
refactor confile code

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1639 from brauner/2017-06-23/lxc_2_1_preparations
Serge Hallyn [Mon, 26 Jun 2017 14:13:47 +0000 (09:13 -0500)]
Merge pull request #1639 from brauner/2017-06-23/lxc_2_1_preparations

confile: prepare for 2.1.

6 years agoMerge pull request #1648 from 0x0916/remove-__func__
Christian Brauner [Mon, 26 Jun 2017 12:29:23 +0000 (14:29 +0200)]
Merge pull request #1648 from 0x0916/remove-__func__

remove the `__func__` macro

6 years agoMerge pull request #1647 from 0x0916/update-api-doc
Christian Brauner [Mon, 26 Jun 2017 10:03:42 +0000 (12:03 +0200)]
Merge pull request #1647 from 0x0916/update-api-doc

API doc: update note for get_config_item

6 years agoremove the `__func__` macro
0x0916 [Mon, 26 Jun 2017 09:55:12 +0000 (17:55 +0800)]
remove the `__func__` macro

Our logging function will always spew out the function name.

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoAPI doc: update note for get_config_item
0x0916 [Mon, 26 Jun 2017 09:28:47 +0000 (17:28 +0800)]
API doc: update note for get_config_item

Fix issue: https://github.com/lxc/lxc/issues/505

Signed-off-by: 0x0916 <w@laoqinren.net>
6 years agoMerge pull request #1644 from evgeni/centos-7
Christian Brauner [Sun, 25 Jun 2017 08:00:30 +0000 (10:00 +0200)]
Merge pull request #1644 from evgeni/centos-7

default to CentOS 7

6 years agoMerge pull request #1643 from evgeni/aarch64
Christian Brauner [Sat, 24 Jun 2017 17:37:38 +0000 (19:37 +0200)]
Merge pull request #1643 from evgeni/aarch64

templates/debian: add aarch64 → arm64 mapping

6 years agoMerge pull request #1645 from evgeni/centos-altarch
Christian Brauner [Sat, 24 Jun 2017 17:37:25 +0000 (19:37 +0200)]
Merge pull request #1645 from evgeni/centos-altarch

use altarch mirror for CentOS on arches other than i386 and x86_64