cleaner xml processing
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
fb722a3dc9
commit
178974e42f
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue