cleaner xml processing

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-25 05:04:52 -05:00
parent fb722a3dc9
commit 178974e42f
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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)
}