[libvirt] [PATCH 2/6] qemu: virsh wrapper for qemu events

Daniel P. Berrange berrange at redhat.com
Tue Feb 11 15:07:23 UTC 2014


On Fri, Jan 31, 2014 at 07:12:07PM -0700, Eric Blake wrote:
> Any new API deserves a good virsh wrapper :)
> 
>     qemu-monitor-event [<domain>] [<event>] [--pretty] [--loop] [--timeout <number>]
> 
> It helps that we already have an event loop running in a dedicated
> thread, so a blocking read() on a pipe-to-self is sufficient to
> handle all three means of ending the command: SIGINT, timeout, and
> oneshot behavior of an event received.
> 
> For an example session (once subsequent qemu patches are applied):
> 
> $ virsh -c qemu:///system qemu-monitor-event --event SHUTDOWN &
> $ virsh -c qemu:///system start f18-live
> Domain f18-live started
> 
> $ virsh -c qemu:///system destroy f18-live
> Domain f18-live destroyed
> 
> event SHUTDOWN at 1391212552.026544 for domain f18-live: (null)
> events received: 1
> 
> [1]+  Done                    virsh -c qemu:///system qemu-monitor-event --event SHUTDOWN
> $
> 
> * tools/virsh-domain.c (cmdQemuMonitorEvent): New command.
> * tools/virsh.pod (qemu-monitor-event): Document it.

I can't help thinking that we should have a general 'virsh domain-event'
command before we go adding a qemu specific one here. Without a generic
command we'd be forcing people to use the QEMU specific command even
for events where we have general support like your shutdown example.

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