virtigod does xml generate now
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5406da8e75
commit
a2190048af
|
@ -29,21 +29,24 @@ func makeStandardXml(hostname string) *libvirtxml.Domain {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func writeoutXml(domcfg *libvirtxml.Domain, filename string) bool {
|
func writeoutXml(domcfg *libvirtxml.Domain, filename string) error {
|
||||||
xmldoc, err := domcfg.Marshal()
|
xmldoc, err := domcfg.Marshal()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("can't make xml file error:\n", err)
|
fmt.Println("can't make xml file error:\n", err)
|
||||||
return false
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
outfile := "/tmp/" + filename + ".xml"
|
outfile := "/tmp/" + filename + ".xml"
|
||||||
regfile, _ := os.OpenFile(outfile, os.O_RDWR|os.O_CREATE, 0666)
|
regfile, err := os.OpenFile(outfile, os.O_RDWR|os.O_CREATE, 0666)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
fmt.Fprintln(regfile, xmldoc)
|
fmt.Fprintln(regfile, xmldoc)
|
||||||
|
|
||||||
log.Info("File is in", outfile)
|
log.Info("File is in", outfile)
|
||||||
regfile.Close()
|
regfile.Close()
|
||||||
return true
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setDiskFilename(domcfg *libvirtxml.Domain, filename string) {
|
func setDiskFilename(domcfg *libvirtxml.Domain, filename string) {
|
||||||
|
|
5
start.go
5
start.go
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// generate the XML for 'virsh create'
|
// generate the XML for 'virsh create'
|
||||||
func StartDropletXml(cluster *pb.Cluster, d *pb.Droplet, domcfg *libvirtxml.Domain, hostname string) {
|
func GenerateDropletXml(cluster *pb.Cluster, d *pb.Droplet, domcfg *libvirtxml.Domain, hostname string) error {
|
||||||
/*
|
/*
|
||||||
if d == nil {
|
if d == nil {
|
||||||
log.Info("droplet is nil")
|
log.Info("droplet is nil")
|
||||||
|
@ -87,8 +87,7 @@ func StartDropletXml(cluster *pb.Cluster, d *pb.Droplet, domcfg *libvirtxml.Doma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeoutXml(domcfg, d.Hostname)
|
return writeoutXml(domcfg, d.Hostname)
|
||||||
os.Exit(-1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func findDisk(dirs []string, filename string) string {
|
func findDisk(dirs []string, filename string) string {
|
||||||
|
|
Loading…
Reference in New Issue