[lxc-devel] [lxc/lxc] 793583: utils: lxc_make_abstract_socket_name()

GitHub noreply at github.com
Sat Jul 8 23:44:08 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 7935833c235e80c07ffc593abcbb5cda689e37f4
      https://github.com/lxc/lxc/commit/7935833c235e80c07ffc593abcbb5cda689e37f4
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: lxc_make_abstract_socket_name()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 47a46cf1d28aad270072a983910d881d9c6e14aa
      https://github.com/lxc/lxc/commit/47a46cf1d28aad270072a983910d881d9c6e14aa
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/execute.c
    M src/lxc/lxccontainer.c
    M src/lxc/monitor.c
    M src/lxc/network.c
    M src/lxc/start.c
    M src/lxc/start.h

  Log Message:
  -----------
  start: generalize lxc_check_inherited()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 5e5576a4ef2d6f4a1abce6b8e0ff68edebdde47f
      https://github.com/lxc/lxc/commit/5e5576a4ef2d6f4a1abce6b8e0ff68edebdde47f
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/criu.c
    M src/lxc/lxccontainer.c
    M src/lxc/start.c
    M src/lxc/start.h

  Log Message:
  -----------
  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 at ubuntu.com>


  Commit: a6b6ad7bbc35b65bc995d2b4139fcd734fb95884
      https://github.com/lxc/lxc/commit/a6b6ad7bbc35b65bc995d2b4139fcd734fb95884
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  lxccontainer: make sure memory is free()ed

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 7cb19d44a19cd3b4ac46ab81e54850cc298ce613
      https://github.com/lxc/lxc/commit/7cb19d44a19cd3b4ac46ab81e54850cc298ce613
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  lxccontainer: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 3df9fa8211af2263ff77d235797e10167641e8e4
      https://github.com/lxc/lxc/commit/3df9fa8211af2263ff77d235797e10167641e8e4
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M .gitignore
    M src/tests/Makefile.am
    A src/tests/shortlived.c

  Log Message:
  -----------
  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 at ubuntu.com>


  Commit: 8130d8646d5db0e599617eab15cf0bddd7dcaab7
      https://github.com/lxc/lxc/commit/8130d8646d5db0e599617eab15cf0bddd7dcaab7
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/tools/lxc_init.c

  Log Message:
  -----------
  lxc static init: report exec*() failure

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 54446942fea68b01be9af90cb4a52981265c112b
      https://github.com/lxc/lxc/commit/54446942fea68b01be9af90cb4a52981265c112b
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/commands.h
    M src/lxc/start.c
    M src/lxc/state.c

  Log Message:
  -----------
  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 at ubuntu.com>


  Commit: 92e350183244023264af973092cccdb013dea394
      https://github.com/lxc/lxc/commit/92e350183244023264af973092cccdb013dea394
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-09 (Sun, 09 Jul 2017)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/commands.c
    M src/lxc/commands.h
    A src/lxc/commands_utils.c
    A src/lxc/commands_utils.h
    M src/lxc/lxccontainer.c
    M src/lxc/state.c

  Log Message:
  -----------
  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 at ubuntu.com>


  Commit: bbf5cf35a35c2876181e70d729f6817f0f271dd8
      https://github.com/lxc/lxc/commit/bbf5cf35a35c2876181e70d729f6817f0f271dd8
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-09 (Sun, 09 Jul 2017)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/commands_utils.c
    M src/lxc/commands_utils.h
    M src/lxc/start.c
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  commands: mv lxc_make_abstract_socket_name()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 86a78f1733495f4a61886b8b49940c1ff80457db
      https://github.com/lxc/lxc/commit/86a78f1733495f4a61886b8b49940c1ff80457db
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-09 (Sun, 09 Jul 2017)

  Changed paths:
    M src/lxc/commands.c

  Log Message:
  -----------
  commands: add missing translation

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: c01c2be6e8588b5261eb1635561666169ee32d8d
      https://github.com/lxc/lxc/commit/c01c2be6e8588b5261eb1635561666169ee32d8d
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-09 (Sun, 09 Jul 2017)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/commands_utils.c
    M src/lxc/commands_utils.h

  Log Message:
  -----------
  commands: abstract cmd socket handling + logging

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: ee8377bd917a0fb9cc528187ffc6e2cd851afc4b
      https://github.com/lxc/lxc/commit/ee8377bd917a0fb9cc528187ffc6e2cd851afc4b
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-07-09 (Sun, 09 Jul 2017)

  Changed paths:
    M src/lxc/commands_utils.c
    M src/lxc/lxccontainer.c
    M src/lxc/start.c

  Log Message:
  -----------
  commands: handle EINTR

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 3f0af363e4c936955935d02a51c26ee342c75820
      https://github.com/lxc/lxc/commit/3f0af363e4c936955935d02a51c26ee342c75820
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2017-07-08 (Sat, 08 Jul 2017)

  Changed paths:
    M .gitignore
    M src/lxc/Makefile.am
    M src/lxc/commands.c
    M src/lxc/commands.h
    A src/lxc/commands_utils.c
    A src/lxc/commands_utils.h
    M src/lxc/criu.c
    M src/lxc/execute.c
    M src/lxc/lxccontainer.c
    M src/lxc/monitor.c
    M src/lxc/network.c
    M src/lxc/start.c
    M src/lxc/start.h
    M src/lxc/state.c
    M src/lxc/tools/lxc_init.c
    M src/lxc/utils.c
    M src/tests/Makefile.am
    A src/tests/shortlived.c

  Log Message:
  -----------
  Merge pull request #1659 from brauner/2017-06-28/do_not_use_cmd_socket_on_daemonized_start

start: use separate socket on daemonized start


Compare: https://github.com/lxc/lxc/compare/616e0593cd18...3f0af363e4c9


More information about the lxc-devel mailing list