[lxc-devel] live migrate and /dev/lxd

Tycho Andersen tycho.andersen at canonical.com
Mon Jun 22 04:15:01 UTC 2015


Hi Dietmar,

On Sat, Jun 20, 2015 at 05:45:51PM +0200, Dietmar Maurer wrote:
> Hi all,
> 
> I just detected the /dev/lxd specification:
> 
> https://github.com/lxc/lxd/blob/master/specs/dev-lxd.md
> 
> and saw that event API:
> 
> ---------------
> /1.0/events
> GET
> 
>     Description: event interface
>     Return: websocket upgrade (similar to /1.0/events on main API)
> ---------------
> 
> This makes it possible to open a websocket connection from 
> running container to the host?

Yes. Note however that the initial version of /dev/lxd was just landed
on Friday, and isn't in any released version of LXD yet and the events
API is currently not implemented in the code that did land, so it may
be a while before this problem is a reality.

> I just wonder how you would live migrate such connection?

Good question. CRIU has a plugin mechanism, which we can use to dump
special "external" resources (i.e. resources connected to stuff
outside the container's namespaces, unix sockets in this case). What
we'd have to do is write a CRIU plugin to dump and restore the live
connections to /dev/lxd.

On dump, this would probably just be having the plugin query LXD to
make sure that all requests for the container were flushed so that
CRIU would at least dump the socket buffers for the kernel. On
restore, the plugin would tell /dev/lxd to reconnect in some sort of
"previously connected" mode, and then hand that FD back to CRIU as the
fd that the application sees when it is resumed. As long as LXD and
the plugin know how to negotiate restoring the external resource's
state, everything should Just Work.

Tycho


More information about the lxc-devel mailing list