[libvirt] [PATCH 7/6] qemu: allow filtering events by regex

Daniel P. Berrange berrange at redhat.com
Tue Feb 11 15:22:12 UTC 2014


On Thu, Feb 06, 2014 at 04:19:53PM -0700, Eric Blake wrote:
> When listening for a subset of monitor events, it can be tedious
> to register for each event name in series; nicer is to register
> for multiple events in one go.  Implement a flag to use regex
> interpretation of the event filter.
> 
> While at it, prove how much I hate the shift key, by adding a
> way to filter for 'shutdown' instead of 'SHUTDOWN'. :)
> 
> * include/libvirt/libvirt-qemu.h
> (virConnectDomainQemuMonitorEventRegisterFlags): New enum.
> * src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister):
> Document flags.
> * tools/virsh-domain.c (cmdQemuMonitorEvent): Expose them.
> * tools/virsh.pod (qemu-monitor-event): Document this.
> * src/conf/domain_event.h
> (virDomainQemuMonitorEventStateRegisterID): Adjust signature.
> * src/conf/domain_event.c
> (virDomainQemuMonitorEventStateRegisterID): Add flags.
> (virDomainQemuMonitorEventFilter): Handle regex, and optimize
> client side.
> (virDomainQemuMonitorEventCleanup): Clean up regex.
> * src/qemu/qemu_driver.c
> (qemuConnectDomainQemuMonitorEventRegister): Adjust caller.
> * src/remote/remote_driver.c
> (remoteConnectDomainQemuMonitorEventRegister): New flags can
> always be safely handled server side.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  include/libvirt/libvirt-qemu.h | 10 ++++++++++
>  src/conf/domain_event.c        | 41 ++++++++++++++++++++++++++++++++++++++---
>  src/conf/domain_event.h        |  3 ++-
>  src/libvirt-qemu.c             | 11 +++++++----
>  src/qemu/qemu_driver.c         |  7 +++++--
>  src/remote/remote_driver.c     |  8 +-------
>  tools/virsh-domain.c           | 13 +++++++++++++
>  tools/virsh.pod                |  5 ++++-
>  8 files changed, 80 insertions(+), 18 deletions(-)

Again I'm wondering whether this is really worth the extra
maintainence pain. We're adding alot more crufty code to
our common domain_event code to support a feature on an
API we generally don't want people using

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list