[libvirt] [PATCH] add a default event handle, to passthough the new events come from qemu

Adam Litke agl at us.ibm.com
Tue Oct 11 13:46:06 UTC 2011


On Mon, Oct 10, 2011 at 11:54:08PM +0800, shaohef at linux.vnet.ibm.com wrote:
> From: Shaohe Feng <shaohef at linux.vnet.ibm.com>
> 
> Basically, this feature can go along with qemu monitor passthrough.
> That way, if we use new commands in the monitor that generate new events, we want
>  some way to receive those new events too.

I agree that this patch is very complimentary to the existing tools for qemu
interaction (qemu_monitor_command, qemu_attach, etc).  It allows API users to
subscribe to events that are not yet handled by libvirt.  I have a couple of
design questions about this feature.

1) This feature seems to be a bit qemu specific.  Other qemu-specific APIs
(mentioned above) are build into libvirt-qemu.so so that they are kept apart
from the hypervisor-neutral parts of the API.  Is it possible to do that for
an event handler like this patch implements?  Do we want to enforce such a
limit?

2) This patch causes a string representing a raw JSON event object to be
passed to the callbacks that are registered for the default event.  This seems
fine to me.  I do wonder if relying on a 'default' event is a bad thing for an
application to do.  Let's say an app decides to handle NEW_EVENT using this
default handler.  Then, libvirt gains official support for NEW_EVENT.  When the
libvirt package is updated in the application's environment, NEW_EVENT will no
longer trigger via the default handler.  Thus, the application is broken by a
libvirt upgrade.  Would it be better to have a 'raw event' sink where all events
(whether supported or not) would be sent?

> In order to test this patch, see the attached python test case.  When domains are started,
> it will be able to catch RESUME events.

Tested-by: Adam Litke <agl at us.ibm.com>

> Signed-off-by: Shaohe Feng <shaohef at linux.vnet.ibm.com>
> ---
>  daemon/remote.c                       |   34 ++++++++++++++++++++++
>  include/libvirt/libvirt.h.in          |   14 +++++++++
>  python/libvirt-override-virConnect.py |   12 ++++++++
>  python/libvirt-override.c             |   50 +++++++++++++++++++++++++++++++++
>  src/conf/domain_event.c               |   46 ++++++++++++++++++++++++++++++
>  src/conf/domain_event.h               |    5 +++
>  src/libvirt_private.syms              |    2 +
>  src/qemu/qemu_monitor.c               |    9 ++++++
>  src/qemu/qemu_monitor.h               |    6 ++++
>  src/qemu/qemu_monitor_json.c          |   31 ++++++++++++++++++++
>  src/qemu/qemu_process.c               |   23 +++++++++++++++
>  src/remote/remote_driver.c            |   31 ++++++++++++++++++++
>  src/remote/remote_protocol.x          |    8 ++++-
>  src/remote_protocol-structs           |    5 +++
>  14 files changed, 275 insertions(+), 1 deletions(-)

-- 
Adam Litke <agl at us.ibm.com>
IBM Linux Technology Center




More information about the libvir-list mailing list