virtigod compiles again
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
eab1a35ca5
commit
0d8861fa9f
36
importXML.go
36
importXML.go
|
@ -3,42 +3,36 @@
|
||||||
package virtigolib
|
package virtigolib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"libvirt.org/go/libvirtxml"
|
"libvirt.org/go/libvirtxml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// import a libvirt xml domain
|
// do a test import of a libvirt xml domain
|
||||||
/*
|
func TestLibvirtDomain(domcfg *libvirtxml.Domain) (*pb.Droplet, error) {
|
||||||
func badImportXML(domcfg *libvirtxml.Domain) (*pb.Droplet, []*pb.Event, error) {
|
d := new(pb.Droplet)
|
||||||
var alle []*pb.Event
|
d.Current = new(pb.Current)
|
||||||
var d *pb.Droplet
|
|
||||||
if domcfg == nil {
|
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 {
|
if err != nil {
|
||||||
// use merge instead
|
return d, errors.New("Merge *libvirt.Domain failed " + domcfg.Name)
|
||||||
os.Exit(-1)
|
|
||||||
}
|
}
|
||||||
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)
|
s, err := DumpNonStandardXML(domcfg)
|
||||||
|
d.Current.FullXml = s
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reason := s + "\n"
|
reason := s + "\n"
|
||||||
reason = fmt.Sprintln("DumpNonStandardXML() on", domcfg.Name, "failed for", err)
|
reason = fmt.Sprintln("DumpNonStandardXML() on", domcfg.Name, "failed for", err)
|
||||||
log.Info(reason)
|
log.Warn(reason)
|
||||||
return d, alle, errors.New(reason)
|
return d, err
|
||||||
}
|
}
|
||||||
return d, alle, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func MergeXml(d *libvirtxml.Domain, xml string) error {
|
func MergeXml(d *libvirtxml.Domain, xml string) error {
|
||||||
err := d.Unmarshal(xml)
|
err := d.Unmarshal(xml)
|
||||||
|
|
Loading…
Reference in New Issue