virtigod compiles again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-01 10:22:30 -05:00
parent eab1a35ca5
commit 0d8861fa9f
1 changed files with 15 additions and 21 deletions

View File

@ -3,42 +3,36 @@
package virtigolib
import (
"errors"
"fmt"
pb "go.wit.com/lib/protobuf/virtbuf"
"go.wit.com/log"
"libvirt.org/go/libvirtxml"
)
// import a libvirt xml domain
/*
func badImportXML(domcfg *libvirtxml.Domain) (*pb.Droplet, []*pb.Event, error) {
var alle []*pb.Event
var d *pb.Droplet
// do a test import of a libvirt xml domain
func TestLibvirtDomain(domcfg *libvirtxml.Domain) (*pb.Droplet, error) {
d := new(pb.Droplet)
d.Current = new(pb.Current)
if domcfg == nil {
return nil, alle, errors.New("domcfg == nil")
return d, errors.New("domcfg == nil")
}
d, err = c.InitDroplet(domcfg.Name)
_, err := MergelibvirtDomain(d, domcfg)
if err != nil {
// use merge instead
os.Exit(-1)
return d, errors.New("Merge *libvirt.Domain failed " + domcfg.Name)
}
d.Uuid = domcfg.UUID
alle, err := MergelibvirtDomain(d, domcfg)
if err != nil {
log.Info("updateDroplet() failed for", d.Hostname)
return d, alle, errors.New("update failed for " + domcfg.Name)
}
log.Info("added new droplet", domcfg.Name, domcfg.UUID)
s, err := DumpNonStandardXML(domcfg)
d.Current.FullXml = s
if err != nil {
reason := s + "\n"
reason = fmt.Sprintln("DumpNonStandardXML() on", domcfg.Name, "failed for", err)
log.Info(reason)
return d, alle, errors.New(reason)
log.Warn(reason)
return d, err
}
return d, alle, nil
return d, nil
}
*/
func MergeXml(d *libvirtxml.Domain, xml string) error {
err := d.Unmarshal(xml)