Naud, AntoineX
2017-Aug-24 12:54 UTC
[libvirt-users] duplicated notifications for suspend and resume
Hello, I am using domain event notifications from libvirt-event API in my application and it seems to work fine, except for 'suspend' and 'resume' events where I keep receiving duplicated notifications. Similarly, the example provided with libvirt (in examples/object-events/event-test) also produces twice as much notifications for 'suspend' and 'resume' than for other events. Here is the sequence of virsh commands and the output of event-test: Virsh start Fed25 Virsh suspend Fed25 Virsh resume Fed25 Virsh shutdown Fed25 [~/libvirt-3.4.0/examples/object-events] ./event-test qemu:///system Registering event callbacks myNodeDeviceEventCallback EVENT: Node device net_vnet0_fe_54_00_a0_ba_61 Created 0 myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback1 EVENT: Domain Fed25(1) Started Booted myDomainEventCallback2 EVENT: Domain Fed25(1) Started Booted myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused myDomainEventCallback1 EVENT: Domain Fed25(1) Shutdown Finished myDomainEventCallback2 EVENT: Domain Fed25(1) Shutdown Finished myNodeDeviceEventCallback EVENT: Node device net_vnet0_fe_54_00_a0_ba_61 Deleted 0 Note that the 2 lines printed for each event are ok since 2 callbacks are registered in the example. Has anybody else faced this issue? I am using libvirt-3.6.0 on Ubuntu 16.04. Best regards, Antoine -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Martin Kletzander
2017-Aug-25 09:51 UTC
Re: [libvirt-users] duplicated notifications for suspend and resume
On Thu, Aug 24, 2017 at 12:54:26PM +0000, Naud, AntoineX wrote:>Hello, > >I am using domain event notifications from libvirt-event API in my application and it seems to work fine, except for 'suspend' and 'resume' events where I keep receiving duplicated notifications. > >Similarly, the example provided with libvirt (in examples/object-events/event-test) also produces twice as much notifications for 'suspend' and 'resume' than for other events. Here is the sequence of virsh commands and the output of event-test: > >Virsh start Fed25 >Virsh suspend Fed25 >Virsh resume Fed25 >Virsh shutdown Fed25 > >[~/libvirt-3.4.0/examples/object-events] ./event-test qemu:///system >Registering event callbacks >myNodeDeviceEventCallback EVENT: Node device net_vnet0_fe_54_00_a0_ba_61 Created 0 >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Started Booted >myDomainEventCallback2 EVENT: Domain Fed25(1) Started Booted >myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Shutdown Finished >myDomainEventCallback2 EVENT: Domain Fed25(1) Shutdown Finished >myNodeDeviceEventCallback EVENT: Node device net_vnet0_fe_54_00_a0_ba_61 Deleted 0 > >Note that the 2 lines printed for each event are ok since 2 callbacks are registered in the example. >We cannot guarantee that some events will not fire multiple times as is some cases there is no way to check whether it is duplicate or not when libvirt gets the information. I have a hunch that the fact that events can happen multiple times is written somewhere in the docs. Is there any problem you are trying to solve here?>Has anybody else faced this issue? > >I am using libvirt-3.6.0 on Ubuntu 16.04. > >Best regards, >Antoine >-------------------------------------------------------------- >Intel Research and Development Ireland Limited >Registered in Ireland >Registered Office: Collinstown Industrial Park, Leixlip, County Kildare >Registered Number: 308263 > > >This e-mail and any attachments may contain confidential material for the sole >use of the intended recipient(s). Any review or distribution by others is >strictly prohibited. If you are not the intended recipient, please contact the >sender and delete all copies.>_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
Naud, AntoineX
2017-Aug-25 10:15 UTC
Re: [libvirt-users] duplicated notifications for suspend and resume
Hi Martin, Thanks for your answer!> We cannot guarantee that some events will not fire multiple times as is some cases there is no way to check whether it is duplicate or not when libvirt gets the information. I have a hunch that the fact that events can happen multiple times is written somewhere in the docs. >Ok. I did not know about that. That would be an explanation.> Is there any problem you are trying to solve here?No, I can handle the duplicate notifs in the application. I was just surprise to see the same event twice and wondering whether I used the API correctly or if this could possibly be a bug in libvirt. Best Antoine -----Original Message----- From: Martin Kletzander [mailto:mkletzan@redhat.com] Sent: Friday, August 25, 2017 11:51 AM To: Naud, AntoineX <antoinex.naud@intel.com> Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] duplicated notifications for suspend and resume On Thu, Aug 24, 2017 at 12:54:26PM +0000, Naud, AntoineX wrote:>Hello, > >I am using domain event notifications from libvirt-event API in my application and it seems to work fine, except for 'suspend' and 'resume' events where I keep receiving duplicated notifications. > >Similarly, the example provided with libvirt (in examples/object-events/event-test) also produces twice as much notifications for 'suspend' and 'resume' than for other events. Here is the sequence of virsh commands and the output of event-test: > >Virsh start Fed25 >Virsh suspend Fed25 >Virsh resume Fed25 >Virsh shutdown Fed25 > >[~/libvirt-3.4.0/examples/object-events] ./event-test qemu:///system >Registering event callbacks myNodeDeviceEventCallback EVENT: Node >device net_vnet0_fe_54_00_a0_ba_61 Created 0 >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Started Booted >myDomainEventCallback2 EVENT: Domain Fed25(1) Started Booted >myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback1 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback2 EVENT: Domain Fed25(1) Suspended Paused >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback2 EVENT: Domain Fed25(1) Resumed Unpaused >myDomainEventCallback1 EVENT: Domain Fed25(1) Shutdown Finished >myDomainEventCallback2 EVENT: Domain Fed25(1) Shutdown Finished >myNodeDeviceEventCallback EVENT: Node device >net_vnet0_fe_54_00_a0_ba_61 Deleted 0 > >Note that the 2 lines printed for each event are ok since 2 callbacks are registered in the example. >We cannot guarantee that some events will not fire multiple times as is some cases there is no way to check whether it is duplicate or not when libvirt gets the information. I have a hunch that the fact that events can happen multiple times is written somewhere in the docs. Is there any problem you are trying to solve here?>Has anybody else faced this issue? > >I am using libvirt-3.6.0 on Ubuntu 16.04. > >Best regards, >Antoine >-------------------------------------------------------------- >Intel Research and Development Ireland Limited Registered in Ireland >Registered Office: Collinstown Industrial Park, Leixlip, County Kildare >Registered Number: 308263 > > >This e-mail and any attachments may contain confidential material for >the sole use of the intended recipient(s). Any review or distribution >by others is strictly prohibited. If you are not the intended >recipient, please contact the sender and delete all copies.>_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users-------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Michal Privoznik
2017-Aug-28 11:34 UTC
Re: [libvirt-users] duplicated notifications for suspend and resume
On 08/25/2017 11:51 AM, Martin Kletzander wrote:> On Thu, Aug 24, 2017 at 12:54:26PM +0000, Naud, AntoineX wrote: >> Hello, >> > > We cannot guarantee that some events will not fire multiple times as is > some cases there is no way to check whether it is duplicate or not when > libvirt gets the information. I have a hunch that the fact that events > can happen multiple times is written somewhere in the docs.Also, qemu happens to send some events multiple times. Libvirt has a set of callbacks that fire a libvirt event (among some other things). That's the reason why you see some events doubled. Michal