Add support for lifecycle events in the libvirt driver

This wires up the libvirt compute driver to process async
events from libvirtd and emit lifecycle events. This makes
use of the native libvirt event loop to handle I/O processing
which requires a native thread.

The native thread uses a queue + self-pipe to forward events
onto a green thread. The green thread reads events off the
queue and uses the emit_event method to dispatch them to the
compute manager.

Blueprint: compute-driver-events
Change-Id: Icd2cb7081adde10420ae55beebe60350afe21379
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Handle lifecycle events in the compute manager

Update the compute manager to register an event handler
with the compute drivers. The initial handler will process
lifecycle event notifications, to allow prompt synchronization
of DB & hypervisor power states. This means that if a guest
admin does 'shutdown -h now' the libvirt driver in Nova will
immediately notice that and mark the guest as SHUTOFF rather
then leaving it RUNNING until the periodic task runs sometime
in the next 10 minutes

Blueprint: compute-driver-events
Change-Id: I39a6d450a6d6384b8be58aceea98e4395185cc38
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Merge "Add support for lifecycle events in the libvirt driver"
Merge "Handle lifecycle events in the compute manager"