[libvirt-users] Callback re-registration after libvirtd restart

Daniel Kučera daniel.kucera at gmail.com
Wed May 17 14:03:29 UTC 2017


2017-05-17 15:52 GMT+02:00 Daniel P. Berrange <berrange at redhat.com>:

> On Wed, May 17, 2017 at 03:49:45PM +0200, Daniel Kučera wrote:
> > No, I'm not, I'm calling it sooner:
> >
> > func libvirt_start() {
> >         libvirt.EventRegisterDefaultImpl()
> >         event_listen()
> > }
>
> Well the following example works as expected for me
>
> package main
>
> import (
>         "github.com/libvirt/libvirt-go"
>         "log"
> )
>
> func libvirt_close_callback(conn *libvirt.Connect, reason
> libvirt.ConnectCloseReason) {
>         log.Printf("In here")
> }
>
> func main() {
>         libvirt.EventRegisterDefaultImpl()
>
>         hv, err := libvirt.NewConnect("qemu:///session")
>
>         err = hv.RegisterCloseCallback(libvirt_close_callback)
>         if err != nil {
>                 log.Printf("unable to register close callback")
>                 return
>         }
>
>         for {
>                 libvirt.EventRunDefaultImpl()
>         }
>
> }
>
>
> Printing out "In here" immediately when I kill libvirtd
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org         -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/
> dberrange :|
>


Okay, with qemu:///session I'm getting CloseCallback but now I'm not
getting LifecycleCallback :(

S pozdravom / Best regards
Daniel Kucera.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20170517/f58b5c29/attachment.htm>


More information about the libvirt-users mailing list