diff options
| author | Jeff Carr <[email protected]> | 2024-10-25 07:01:06 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-25 07:01:06 -0500 |
| commit | a3cffbf1c026e2fa73503eb633a1ffd73c0bd18d (patch) | |
| tree | f62b6c452b6bc4ea9d0fdd838f1dbba48d4d8f43 | |
| parent | 9528d4c0fbd90d1c8a745deef714cd06c403b84a (diff) | |
todo: need to generate mac addrs
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | addDroplet.go | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/addDroplet.go b/addDroplet.go index df60113..ff919b4 100644 --- a/addDroplet.go +++ b/addDroplet.go @@ -241,21 +241,25 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) (*pb.Event, error) { // fmt.Printf("source: %+v\n", iface.Source) hwaddr = iface.MAC.Address } - if iface.Source == nil { - fmt.Printf("non-standard network: %+v\n", iface) - return nil, errors.New("non-standard network") - } + if iface.Source == nil { + fmt.Printf("non-standard network: %+v\n", iface) + return nil, errors.New("non-standard network") + } - if iface.Source.Bridge == nil { - fmt.Printf("non-standard network: %+v\n", iface) - return nil, errors.New("bridge is blank nil and no mac address") - } - if iface.Source.Bridge.Bridge == "" { - return nil, errors.New("bridge is blank and no mac address") - } - // log.Info("network has bridge:", iface.Source.Bridge.Bridge) - brname = iface.Source.Bridge.Bridge - hwaddr = "generate" + if iface.Source.Bridge == nil { + fmt.Printf("non-standard network: %+v\n", iface) + return nil, errors.New("bridge is blank nil and no mac address") + } + if iface.Source.Bridge.Bridge == "" { + return nil, errors.New("bridge is blank and no mac address") + } + // log.Info("network has bridge:", iface.Source.Bridge.Bridge) + brname = iface.Source.Bridge.Bridge + if hwaddr == "" { + hwaddr = "generate " + domcfg.Name + log.Info("need to generate mac addr for bridge:", brname) + // return nil, errors.New("need to generate mac addr for bridge: " + brname) + } macs[hwaddr] = brname } |
