better mac addr checking
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
89a43a46bf
commit
8dc0bf6fac
|
@ -250,26 +250,33 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) ([]*pb.Event, error)
|
|||
log.Info("Non-Standard Network XML Start")
|
||||
fmt.Println(string(updatedXML))
|
||||
log.Info("Non-Standard Network XML End")
|
||||
return nil, errors.New("non-standard network")
|
||||
return nil, errors.New("non-standard network. source == nil")
|
||||
}
|
||||
|
||||
if iface.Source.Bridge == nil {
|
||||
// fmt.Printf("non-standard network: %+v\n", iface)
|
||||
if hwaddr == "" {
|
||||
fmt.Printf("non-standard network: %+v\n", iface)
|
||||
updatedXML, _ := xml.MarshalIndent(domcfg.Devices.Interfaces, "", " ")
|
||||
log.Info("Non-Standard Network XML Start")
|
||||
fmt.Println(string(updatedXML))
|
||||
log.Info("Non-Standard Network XML End")
|
||||
return nil, errors.New("bridge is blank nil and no mac address")
|
||||
return nil, errors.New("bridge is nil and no mac address")
|
||||
}
|
||||
brname = ""
|
||||
}
|
||||
if iface.Source.Bridge.Bridge == "" {
|
||||
if hwaddr == "" {
|
||||
fmt.Printf("non-standard network: %+v\n", iface)
|
||||
fmt.Printf("iface.Mac: %+v\n", iface)
|
||||
updatedXML, _ := xml.MarshalIndent(domcfg.Devices.Interfaces, "", " ")
|
||||
log.Info("Non-Standard Network XML Start")
|
||||
fmt.Println(string(updatedXML))
|
||||
log.Info("Non-Standard Network XML End")
|
||||
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
|
||||
}
|
||||
// log.Info("network has bridge:", iface.Source.Bridge.Bridge)
|
||||
if hwaddr == "" {
|
||||
hwaddr = "generate " + domcfg.Name
|
||||
log.Info("need to generate mac addr for bridge:", brname)
|
||||
|
@ -285,9 +292,15 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) ([]*pb.Event, error)
|
|||
if eth.Mac == mac {
|
||||
// log.Info("OKAY. FOUND ETH:", eth.Mac, eth.Name, brname)
|
||||
found = true
|
||||
if brname == "" {
|
||||
// if new bridge name is blank, keep the old one
|
||||
brname = eth.Name
|
||||
}
|
||||
if eth.Name != brname {
|
||||
if argv.IgnoreBr {
|
||||
log.Info("ignoring network changed bridge name:", eth.Mac, eth.Name, brname)
|
||||
log.Info("network was:", eth.Mac, eth.Name)
|
||||
log.Info("network now:", eth.Mac, brname)
|
||||
log.Info("ignoring network change (--xml-ignore-net)")
|
||||
} else {
|
||||
return nil, errors.New("bridge name changed")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue