compiles again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-01 10:23:32 -05:00
parent 62bb5dbb9f
commit 4a9c0c7e6a
2 changed files with 31 additions and 33 deletions

View File

@ -12,7 +12,7 @@ import (
var argv args var argv args
type args struct { type args struct {
Port int `arg:"--port" default:"2520" help:"port to run on"` Port int `arg:"--port" default:"2520" help:"port to run on"`
} }
func (args) Version() string { func (args) Version() string {

62
http.go
View File

@ -8,11 +8,12 @@ import (
"os" "os"
"strings" "strings"
"libvirt.org/go/libvirtxml"
"go.wit.com/lib/gui/shell" "go.wit.com/lib/gui/shell"
"go.wit.com/lib/virtigolib"
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" "go.wit.com/lib/virtigolib"
) )
// remove '?' part and trailing '/' // remove '?' part and trailing '/'
@ -42,7 +43,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
domname := r.URL.Query().Get("domain") domname := r.URL.Query().Get("domain")
fmt.Fprint(w, "import domain:", domname) fmt.Fprint(w, "import domain:", domname)
xmldoc, err := virshDumpXML( domname) xmldoc, err := virshDumpXML(domname)
domcfg := &libvirtxml.Domain{} domcfg := &libvirtxml.Domain{}
fmt.Fprintln(w, "domcfg.Unmarshal()") fmt.Fprintln(w, "domcfg.Unmarshal()")
@ -55,17 +56,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "error =", err) fmt.Fprintln(w, "error =", err)
return return
} }
fmt.Fprintln(w, "About to virtigolib.ImportXML(domcfg)") d, err := virtigolib.TestLibvirtDomain(domcfg)
fmt.Fprintln(w, "About to virtigolib.ImportXML(domcfg)")
fmt.Fprintln(w, "About to virtigolib.ImportXML(domcfg)")
log.Warn("About to virtigolib.ImportXML(domcfg)")
log.Warn("domcfg.Uuid", domcfg.UUID)
log.Warn("domcfg.Name", domcfg.Name)
d, _, err := virtigolib.ImportXML(domcfg)
fmt.Fprintln(w, "Finished virtigolib.ImportXML(domcfg)")
fmt.Fprintln(w, "Finished virtigolib.ImportXML(domcfg)")
fmt.Fprintln(w, "Finished virtigolib.ImportXML(domcfg)")
log.Warn("Finished virtigolib.ImportXML(domcfg)")
if err != nil { if err != nil {
fmt.Fprintln(w, "ImportXML failed for", domname, err) fmt.Fprintln(w, "ImportXML failed for", domname, err)
return return
@ -76,7 +67,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
} }
fmt.Fprintln(w, "ImportXML worked for", domname) fmt.Fprintln(w, "ImportXML worked for", domname)
fmt.Fprintln(w, "should send the protobuf to virtigo here", domname) fmt.Fprintln(w, "should send the protobuf to virtigo here", domname)
d.Current.FullXml = xmldoc
log.Warn("About to DumpDroplet()") log.Warn("About to DumpDroplet()")
d.DumpDroplet(w, r) d.DumpDroplet(w, r)
fmt.Fprintln(w, "DUMP DOMAIN DONE OK FOR", domname) fmt.Fprintln(w, "DUMP DOMAIN DONE OK FOR", domname)
@ -108,24 +98,32 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
// fmt.Fprint(w, "import domain:", domname) // fmt.Fprint(w, "import domain:", domname)
xmldoc, err := virshDumpXML(domname) xmldoc, err := virshDumpXML(domname)
if err != nil {
fmt.Fprintln(w, err)
return
}
fmt.Fprintln(w, xmldoc)
return
domcfg := &libvirtxml.Domain{} /*
err = domcfg.Unmarshal(xmldoc) domcfg := &libvirtxml.Domain{}
if err != nil { err = domcfg.Unmarshal(xmldoc)
fmt.Fprintln(w, "domain.Unmarshal XML failed") if err != nil {
fmt.Fprintln(w, "error =", err) fmt.Fprintln(w, "domain.Unmarshal XML failed")
return fmt.Fprintln(w, "error =", err)
} return
// importDomain(w, r, domcfg) }
// importDomain(w http.ResponseWriter, r *http.Request, dom *libvirtxml.Domain) { // importDomain(w, r, domcfg)
xml, _, err := virtigolib.ImportXML(domcfg) // importDomain(w http.ResponseWriter, r *http.Request, dom *libvirtxml.Domain) {
if err != nil { xml, _, err := virtigolib.ImportXML(domcfg)
fmt.Fprintln(w, "ImportXML failed for", domname, err) if err != nil {
return fmt.Fprintln(w, "ImportXML failed for", domname, err)
} return
log.Warn("ImportXML worked for", domname) }
fmt.Fprintln(w, xml) log.Warn("ImportXML worked for", domname)
// d.Current.FullXml = xmldoc fmt.Fprintln(w, xml)
// d.Current.FullXml = xmldoc
*/
return return
} }