dump out xml for networks that don't parse

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-25 15:10:12 -05:00
parent 9451e162a0
commit 89a43a46bf
1 changed files with 15 additions and 2 deletions

View File

@ -3,6 +3,7 @@
package main package main
import ( import (
"encoding/xml"
"errors" "errors"
"fmt" "fmt"
@ -244,15 +245,27 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) ([]*pb.Event, error)
hwaddr = iface.MAC.Address hwaddr = iface.MAC.Address
} }
if iface.Source == nil { if iface.Source == nil {
fmt.Printf("non-standard network: %+v\n", iface) // 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("non-standard network") return nil, errors.New("non-standard network")
} }
if iface.Source.Bridge == nil { if iface.Source.Bridge == nil {
fmt.Printf("non-standard network: %+v\n", iface) // 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 blank nil and no mac address")
} }
if iface.Source.Bridge.Bridge == "" { if iface.Source.Bridge.Bridge == "" {
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") return nil, errors.New("bridge is blank and no mac address")
} }
// log.Info("network has bridge:", iface.Source.Bridge.Bridge) // log.Info("network has bridge:", iface.Source.Bridge.Bridge)