Issue
I have installed libvirt-dev
, compiled and run that code on a Ubuntu box:
package main
import (
"fmt"
"github.com/libvirt/libvirt-go"
)
func main() {
conn, _ := libvirt.NewConnect("qemu:///system")
defer conn.Close()
cb := func(c *libvirt.Connect, d *libvirt.Domain, event *libvirt.DomainEventLifecycle) {
fmt.Println(fmt.Sprintf("Event %d", event.Event))
}
_, err := conn.DomainEventLifecycleRegister(nil, cb)
if err != nil {
panic(fmt.Sprintf("cannot register libvirt domain event: %s", err))
}
}
And got: cannot register libvirt domain event: virError(Code=1, Domain=0, Message='internal error: could not initialize domain event timer')
I'm using libvirt-go while digital ocean go-libvirt LifecycleEvents
just works fine...
Any ideas?
Solution
You've not registered any event loop implementation.
The easy way is to call EventRegisterDefaultImpl
before opening a libvirt connection, and then spawn a goroutine that runs EventRunDefaultImpl
in an infinite loop
The harder way is to provide your own custom event loop implementation using EventRegisterImpl
Answered By - DanielB
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.