From da2a24c549a6ffe940709b1eabd4c0a44aff3972 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 25 Oct 2024 07:06:22 -0500 Subject: [PATCH] return network changes Signed-off-by: Jeff Carr --- addDroplet.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addDroplet.go b/addDroplet.go index ff919b4..aae0315 100644 --- a/addDroplet.go +++ b/addDroplet.go @@ -157,12 +157,12 @@ func updateDroplet(d *DropletT, domcfg *libvirtxml.Domain) error { return errors.New("not kvm") } - e, err = updateNetwork(d, domcfg) + nete, err := updateNetwork(d, domcfg) if err != nil { log.Info("updateNetwork() failed", err) return errors.New("updateNetwork() failed") } - if e != nil { + for _, e := range nete { alle = append(alle, e) } @@ -217,8 +217,8 @@ func updateMemory(d *DropletT, domcfg *libvirtxml.Domain) (*pb.Event, error) { return e, nil } -func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) (*pb.Event, error) { - var newEvent *pb.Event +func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) ([]*pb.Event, error) { + var allEvents []*pb.Event if (d == nil) || (domcfg == nil) { return nil, errors.New("domcfg == nil") } @@ -285,12 +285,12 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) (*pb.Event, error) { } eth.Name = brname d.pb.Networks = append(d.pb.Networks, eth) - newEvent = NewChangeEvent(d.pb, "Droplet NewNetwork", "", mac+" "+brname) + allEvents = append(allEvents, NewChangeEvent(d.pb, "Droplet NewNetwork", "", mac+" "+brname)) } } log.Verbose("mac addrs:", macs) - return newEvent, nil + return allEvents, nil } /* from vm3-with-nvme-1.5GB-sec.xml