This patchset can also be found at https://gitorious.org/~jirka/libvirt/jirka-staging/commits/keepalive
This allows us to detect broken connections between server and client without waiting for TCP timeout and dead deamon/client. By default a connection is considered broken after about 30 seconds of no messages received from remote party. After that period, the connection is automatically closed. The main reason for implementing this is that peer-to-peer migration can now be canceled when a connection between source and target breaks. Although this will really work only after qemu fixes migrate_cancel command so that it doesn't block when outgoing TCP buffers are full. Version 3 addresses comments from Daniel (more details can be found in each patch) except for the default settings on server side. Daniel suggested keepalive should be switched off by default, while I think it should be on if possible, but that (and if on, with what interval and count) can be discussed further since it has negligible impact on the patchset. Jiri Denemark (13): Define keepalive protocol Implement common keepalive handling Introduce virConnectSetKeepAlive virsh: Always run event loop Implement keepalive protocol in libvirt daemon Add support for non-blocking calls in client RPC Add support for async close of client RPC socket Implement keepalive protocol in remote driver Introduce virConnectIsAlive API Implement virConnectIsAlive in all drivers Add keepalive support into domain-events examples qemu: Add support for keepalive messages during p2p migration qemu: Cancel p2p migration when connection breaks .gitignore | 1 + daemon/libvirtd.aug | 5 + daemon/libvirtd.c | 15 + daemon/libvirtd.conf | 22 + daemon/libvirtd.h | 1 + daemon/remote.c | 48 +++- examples/domain-events/events-c/event-test.c | 9 +- examples/domain-events/events-python/event-test.py | 4 +- include/libvirt/libvirt.h.in | 5 + po/POTFILES.in | 1 + src/Makefile.am | 15 +- src/driver.h | 8 + src/esx/esx_driver.c | 18 + src/hyperv/hyperv_driver.c | 18 + src/libvirt.c | 90 ++++ src/libvirt_internal.h | 10 +- src/libvirt_private.syms | 2 + src/libvirt_public.syms | 2 + src/libxl/libxl_driver.c | 8 + src/lxc/lxc_driver.c | 7 + src/openvz/openvz_driver.c | 7 + src/phyp/phyp_driver.c | 18 + src/qemu/libvirtd_qemu.aug | 2 + src/qemu/qemu.conf | 19 + src/qemu/qemu_conf.c | 11 + src/qemu/qemu_conf.h | 3 + src/qemu/qemu_driver.c | 6 + src/qemu/qemu_migration.c | 43 ++- src/qemu/test_libvirtd_qemu.aug | 6 + src/remote/remote_driver.c | 70 ++++ src/remote/remote_protocol.x | 2 +- src/rpc/virkeepalive.c | 426 ++++++++++++++++++++ src/rpc/virkeepalive.h | 56 +++ src/rpc/virkeepaliveprotocol.x | 7 + src/rpc/virnetclient.c | 316 +++++++++++++--- src/rpc/virnetclient.h | 6 + src/rpc/virnetserver.c | 22 + src/rpc/virnetserver.h | 5 + src/rpc/virnetserverclient.c | 143 ++++++- src/rpc/virnetserverclient.h | 7 + src/test/test_driver.c | 6 + src/uml/uml_driver.c | 7 + src/util/event.c | 6 +- src/vbox/vbox_tmpl.c | 6 + src/vmware/vmware_driver.c | 7 + src/xen/xen_driver.c | 8 + src/xenapi/xenapi_driver.c | 12 + tools/console.c | 17 +- tools/virsh.c | 31 ++ 49 files changed, 1477 insertions(+), 87 deletions(-) create mode 100644 src/rpc/virkeepalive.c create mode 100644 src/rpc/virkeepalive.h create mode 100644 src/rpc/virkeepaliveprotocol.x -- 1.7.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list