From 9451e162a042d648270050d91be0bf1f4dee1e7e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 25 Oct 2024 15:01:16 -0500 Subject: [PATCH] ignore bridge name changes by default Signed-off-by: Jeff Carr --- addDroplet.go | 7 +++++-- argv.go | 1 + main.go | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addDroplet.go b/addDroplet.go index 4216cb0..b6e29fa 100644 --- a/addDroplet.go +++ b/addDroplet.go @@ -273,8 +273,11 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) ([]*pb.Event, error) // log.Info("OKAY. FOUND ETH:", eth.Mac, eth.Name, brname) found = true if eth.Name != brname { - log.Info("network changed bridge name:", eth.Mac, eth.Name, brname) - return nil, errors.New("bridge name changed") + if argv.IgnoreBr { + log.Info("ignoring network changed bridge name:", eth.Mac, eth.Name, brname) + } else { + return nil, errors.New("bridge name changed") + } } } } diff --git a/argv.go b/argv.go index 8efa4d7..530c7a0 100644 --- a/argv.go +++ b/argv.go @@ -13,6 +13,7 @@ var argv args type args struct { Xml []string `arg:"--libvirt" help:"import qemu xml files: --libvirt /etc/libvirt/qemu/*.xml"` IgnoreCpu bool `arg:"--xml-ignore-cpu" default:"true" help:"ignore non-standard libvirt xml cpus"` + IgnoreBr bool `arg:"--xml-ignore-net" default:"true" help:"ignore network bridge name changes"` Save bool `arg:"--save" default:"false" help:"save protobuf config after import"` Config string `arg:"env:VIRTIGO_HOME" help:"defaults to ~/.config/virtigo/"` Port int `arg:"--port" default:"8080" help:"allow droplet events via http"` diff --git a/main.go b/main.go index f2e4f11..42b8950 100644 --- a/main.go +++ b/main.go @@ -85,7 +85,9 @@ func main() { if err != nil { log.Info("updateDroplet() error", filename) log.Info("updateDroplet() error", d.pb.Hostname, err) + log.Info("libvirt XML will have to be fixed by hand") ok = false + os.Exit(-1) } } }