libvirt/src/lxc
Daniel P. Berrange 9117fcb263 Run an RPC protocol over the LXC controller monitor
This defines a new RPC protocol to be used between the LXC
controller and the libvirtd LXC driver. There is only a
single RPC message defined thus far, an asynchronous "EXIT"
event that is emitted just before the LXC controller process
exits. This provides the LXC driver with details about how
the container shutdown - normally, or abnormally (crashed),
thus allowing the driver to emit better libvirt events.

Emitting the event in the LXC controller requires a few
little tricks with the RPC service. Simply calling the
virNetServiceClientSendMessage does not work, since this
merely queues the message for asynchronous processing.
In addition the main event loop is no longer running at
the point the event is emitted, so no I/O is processed.

Thus after invoking virNetServiceClientSendMessage it is
necessary to mark the client as being in "delayed close"
mode. Then the event loop is run again, until the client
completes its close - this happens only after the queued
message has been fully transmitted. The final complexity
is that it is not safe to run virNetServerQuit() from the
client close callback, since that is invoked from a
context where the server is locked. Thus a zero-second
timer is used to trigger shutdown of the event loop,
causing the controller to finally exit.

* src/Makefile.am: Add rules for generating RPC protocol
  files and dispatch methods
* src/lxc/lxc_controller.c: Emit an RPC event immediately
  before exiting
* src/lxc/lxc_domain.h: Record the shutdown reason
  given by the controller
* src/lxc/lxc_monitor.c, src/lxc/lxc_monitor.h: Register
  RPC program and event handler. Add callback to let
  driver receive EXIT event.
* src/lxc/lxc_process.c: Use monitor exit event to decide
  what kind of domain event to emit
* src/lxc/lxc_protocol.x: Define wire protocol for LXC
  controller monitor.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-30 13:07:43 +01:00
..
libvirtd_lxc.aug Add support for sVirt in the LXC driver 2012-02-02 17:44:39 -07:00
lxc_cgroup.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
lxc_cgroup.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
lxc_conf.c Replace use of lxcError with virReportError 2012-07-30 12:35:08 +01:00
lxc_conf.h Replace use of lxcError with virReportError 2012-07-30 12:35:08 +01:00
lxc_container.c Replace use of lxcError with virReportError 2012-07-30 12:35:08 +01:00
lxc_container.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
lxc_controller.c Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc_domain.c Convert the LXC driver to use virNetClient 2012-07-30 12:49:07 +01:00
lxc_domain.h Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc_driver.c Convert the LXC driver to use virNetClient 2012-07-30 12:49:07 +01:00
lxc_driver.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
lxc_monitor.c Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc_monitor.h Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc_process.c Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc_process.h Rename lxc_driver_t to virLXCDriver 2012-07-30 12:35:08 +01:00
lxc_protocol.x Run an RPC protocol over the LXC controller monitor 2012-07-30 13:07:43 +01:00
lxc.conf Standardize whitespace used in example config files 2012-05-28 10:59:13 +01:00
test_libvirtd_lxc.aug.in Autogenerate augeas test case from default config files 2012-05-28 11:07:12 +01:00