diff --git a/addDroplet.go b/addDroplet.go index 3e94ec5..9c2c266 100644 --- a/addDroplet.go +++ b/addDroplet.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/google/uuid" pb "go.wit.com/lib/protobuf/virtbuf" "go.wit.com/log" "libvirt.org/go/libvirtxml" @@ -28,6 +29,12 @@ func addDomainDroplet(domcfg *libvirtxml.Domain) (*DropletT, error) { d.pb.StartState = pb.DropletState_OFF d.CurrentState = pb.DropletState_UNKNOWN + // if the domcfg doesn't have a uuid, make a new one here + if d.pb.Uuid == "" { + u := uuid.New() + d.pb.Uuid = u.String() + } + me.droplets = append(me.droplets, d) me.changed = true diff --git a/libvirtxml.go b/libvirtxml.go index 2584a54..f4f8e4a 100644 --- a/libvirtxml.go +++ b/libvirtxml.go @@ -646,8 +646,17 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { os.Exit(-1) } + final := string(updatedXML) + if final == "" { + // things seem pretty standard + return + } + // Print the updated XML to verify + log.Info("dumpNonStandardXML(domcfg) START") fmt.Println(string(updatedXML)) + log.Info("dumpNonStandardXML(domcfg) END") + me.changed = true // os.Exit(-1) }