package events import ( "libvirt.org/go/libvirt" ) type Qemu struct { NodeID string CompanyID string DatacenterID string Config []byte DomainID string State int Event *libvirt.DomainQemuMonitorEvent } func QemuEvents(c *libvirt.Connect, d *libvirt.Domain, event *libvirt.DomainQemuMonitorEvent) { /*var desc schema.Domain config, _ := config.New() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() domainID, _ := d.GetUUIDString() xmlDesc, _ := d.GetXMLDesc(libvirt.DOMAIN_XML_INACTIVE) state, _, _ := d.GetState() err := xml.Unmarshal([]byte(xmlDesc), &desc) if err != nil { log.Fatalln(err) } e, _ := json.Marshal(&Qemu{ NodeID: config.NodeID, CompanyID: desc.Metadata.DeevirtInstance.DeevirtCompanyID, DatacenterID: desc.Metadata.DeevirtInstance.DeevirtDatacenterID, Config: []byte(xmlDesc), DomainID: domainID, State: int(state), Event: event, }) conn, err := grpc.NewClient(strings.Join(config.Manager.Peers, ","), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("Erreur de connexion : %v", err) } defer conn.Close() client := pb.NewDomainClient(conn) client.Event(ctx, &pb.DomainEventRequest{ Event: e, })*/ }