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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
pb "go.wit.com/lib/protobuf/virtbuf"
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"libvirt.org/go/libvirtxml"
|
"libvirt.org/go/libvirtxml"
|
||||||
|
@ -28,6 +29,12 @@ func addDomainDroplet(domcfg *libvirtxml.Domain) (*DropletT, error) {
|
||||||
d.pb.StartState = pb.DropletState_OFF
|
d.pb.StartState = pb.DropletState_OFF
|
||||||
d.CurrentState = pb.DropletState_UNKNOWN
|
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.droplets = append(me.droplets, d)
|
||||||
me.changed = true
|
me.changed = true
|
||||||
|
|
||||||
|
|
|
@ -646,8 +646,17 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final := string(updatedXML)
|
||||||
|
if final == "" {
|
||||||
|
// things seem pretty standard
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Print the updated XML to verify
|
// Print the updated XML to verify
|
||||||
|
log.Info("dumpNonStandardXML(domcfg) START")
|
||||||
fmt.Println(string(updatedXML))
|
fmt.Println(string(updatedXML))
|
||||||
|
log.Info("dumpNonStandardXML(domcfg) END")
|
||||||
|
me.changed = true
|
||||||
// os.Exit(-1)
|
// os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue