[libvirt] [PATCH] qemu: Emit domain events for all virtio-serial channels

Daniel P. Berrange berrange at redhat.com
Fri Nov 11 10:18:00 UTC 2016


On Fri, Nov 11, 2016 at 11:13:19AM +0100, Peter Krempa wrote:
> On Mon, Nov 07, 2016 at 15:48:35 -0500, Matt Broadstone wrote:
> > Presently domain events are emitted for the "agent lifecycle" which
> > is a specialization on virtio-serial events specific to the channel
> > named "org.qemu.guest_agent.0". This patch adds a generic event for
> > "channel lifecycles", which emit state change events for all
> > attached channels.
> > ---
> >  daemon/remote.c                     | 42 +++++++++++++++++
> >  examples/object-events/event-test.c | 57 ++++++++++++++++++++++++
> >  include/libvirt/libvirt-domain.h    | 41 +++++++++++++++++
> >  src/conf/domain_event.c             | 89 +++++++++++++++++++++++++++++++++++++
> >  src/conf/domain_event.h             | 12 +++++
> >  src/libvirt_private.syms            |  2 +
> >  src/qemu/qemu_driver.c              |  5 +++
> >  src/qemu/qemu_process.c             |  6 +++
> >  src/remote/remote_driver.c          | 32 +++++++++++++
> >  src/remote/remote_protocol.x        | 17 ++++++-
> >  src/remote_protocol-structs         |  7 +++
> >  tools/virsh-domain.c                | 35 +++++++++++++++
> >  12 files changed, 344 insertions(+), 1 deletion(-)
> > 



> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index 38c8414..b464412 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -4407,6 +4407,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
> >      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> >      virDomainChrDeviceState newstate;
> >      virObjectEventPtr event = NULL;
> > +    virObjectEventPtr channelEvent = NULL;
> >      virDomainDeviceDef dev;
> >      qemuDomainObjPrivatePtr priv = vm->privateData;
> >      int rc;
> > @@ -4482,6 +4483,10 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
> >          qemuDomainEventQueue(driver, event);
> >      }
> >  
> > +    channelEvent = virDomainEventChannelLifecycleNewFromObj(vm, dev.data.chr->target.name, newstate,
> > +                                                            VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_CHANNEL);
> 
> I don't think we should emit this event for the guest agent channel. It
> has a separate one and the channel is reserved for libvirt anyways, so
> client applications should use the guest agent event for this.

I don't really agree with that. I don't see any compelling reason
to special case the guest agent channel - it just creates extra
work for client apps who want to see events for all channels. There
is no harm in having the guest agent trigger both events, the old
special case one, and the new general purpose one.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list