[libvirt] [PATCH 2/1] virsh: add --all flag to 'event' command

Daniel P. Berrange berrange at redhat.com
Fri Feb 28 17:41:26 UTC 2014


On Mon, Feb 24, 2014 at 05:08:29PM -0700, Eric Blake wrote:
> Similar to our event-test demo program, it's nice to be able to
> have a mode where we can sniff all events at once, rather than
> having to spawn multiple virsh in parallel with one for each
> event type.
> 
> (Can I just say our RegisterAny design is lousy?  The fact that
> the majority of our callback pointers have a function signature
> with the opaque data in a different position, and that we have
> to cast the function signature before registering it, makes it
> hard to write a generic callback function; we have to write one
> for every type of event id.  Life would have been easier if we
> had designed the callback as a fixed signature with a void*
> and size parameter, and then allowed the caller to downcast
> the void* to a particular struct for data specific to their
> callback id, where we could have then had a single function
> with a switch statement for each event id, and register that
> one function for all types of events.  It would also be nicer
> if the callback functions knew which callbackID was being used
> when invoking that callback, so that I could use a single data
> structure among all callbacks rather than having to create an
> array of data.  But I really don't want to go add yet another
> event API design.)
> 
> * tools/virsh-domain.c (cmdEvent): Add --all parameter; convert
> all callbacks to support shared counter.
> * tools/virsh.pod (event): Document it.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  tools/virsh-domain.c | 136 ++++++++++++++++++++++++++++++++-------------------
>  tools/virsh.pod      |   8 +--
>  2 files changed, 90 insertions(+), 54 deletions(-)

ACK

Regards,
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