-
commands: add lxc_cmd_state_server() · 3988d163Christian Brauner authored
A LXC container's lifecycle is regulated by the states STARTING, RUNNING, STOPPING, STOPPED, ABORTING. These states are tracked in the LXC handler and can be checked via approriate functions in the command socket callback system. (The freezer stages are not part of a container's lifecycle since they are not recorded in the LXC handler. This might change in the future but given that the freezer controller will be removed from future cgroup implementations it is unlikely.) So far, LXC was using an external helper to track the states of a container (lxc-monitord). This solution was error prone. For example, the external state server would hang in various scenarios that seemed to be caused by either very subtle internal races or irritation of the external state server by signals. LXC will switch from an external state monitor (lxc-monitord) which serves as a state server for state clients to a native implementation using the indiviual container's command socket. This solution was discussed and outlined by Stéphane Graber and Christian Brauner during a LX{C,D} sprint. The LXC handler will gain an additional field to track state clients. In order for a state client to receive state notifications from the command server he will need to register himself via the lxc_cmd_state_server() function in the state client list. The state client list will be served by lxc_set_state() during the container's lifecycle. lxc_set_state() will also take care of removing any clients from the state list in the LXC handler once the requested state has been reached and sent to the client. In order to prevent races between adding and serving new state clients the state client list and the state field in the LXC handler will be protected by a lock. This commit effectively deprecates lxc-monitord. Instead of serving states to state clients via the lxc-monitord fifo and socket we will now send the state of the container via the container's command socket. lxc-monitord is still useable and will - for the sake of the lxc-monitor command - be kept around so that non-API state clients can still monitor the container during it's lifecycle. Signed-off-by:Christian Brauner <christian.brauner@ubuntu.com>
| Name |
Last commit
|
Last update |
|---|---|---|
| .github | Loading commit data... | |
| config | Loading commit data... | |
| doc | Loading commit data... | |
| hooks | Loading commit data... | |
| src | Loading commit data... | |
| templates | Loading commit data... | |
| .gitignore | Loading commit data... | |
| .travis.yml | Loading commit data... | |
| AUTHORS | Loading commit data... | |
| CONTRIBUTING | Loading commit data... | |
| COPYING | Loading commit data... | |
| INSTALL | Loading commit data... | |
| MAINTAINERS | Loading commit data... | |
| Makefile.am | Loading commit data... | |
| NEWS | Loading commit data... | |
| README | Loading commit data... | |
| README.md | Loading commit data... | |
| autogen.sh | Loading commit data... | |
| configure.ac | Loading commit data... | |
| lxc.pc.in | Loading commit data... | |
| lxc.spec.in | Loading commit data... |