summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addDroplet.go32
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
}