From 4a9c0c7e6a54dbfc9874b2d0ccea56d4567b1600 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 1 Nov 2024 10:23:32 -0500 Subject: [PATCH] compiles again Signed-off-by: Jeff Carr --- argv.go | 2 +- http.go | 62 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/argv.go b/argv.go index 193e779..525f68e 100644 --- a/argv.go +++ b/argv.go @@ -12,7 +12,7 @@ import ( var argv args 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 { diff --git a/http.go b/http.go index c671553..5961022 100644 --- a/http.go +++ b/http.go @@ -8,11 +8,12 @@ import ( "os" "strings" + "libvirt.org/go/libvirtxml" + "go.wit.com/lib/gui/shell" - "go.wit.com/lib/virtigolib" pb "go.wit.com/lib/protobuf/virtbuf" "go.wit.com/log" - "libvirt.org/go/libvirtxml" + "go.wit.com/lib/virtigolib" ) // remove '?' part and trailing '/' @@ -42,7 +43,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { domname := r.URL.Query().Get("domain") fmt.Fprint(w, "import domain:", domname) - xmldoc, err := virshDumpXML( domname) + xmldoc, err := virshDumpXML(domname) domcfg := &libvirtxml.Domain{} fmt.Fprintln(w, "domcfg.Unmarshal()") @@ -55,17 +56,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "error =", err) return } - fmt.Fprintln(w, "About to virtigolib.ImportXML(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)") + d, err := virtigolib.TestLibvirtDomain(domcfg) if err != nil { fmt.Fprintln(w, "ImportXML failed for", domname, err) return @@ -76,7 +67,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } fmt.Fprintln(w, "ImportXML worked for", domname) fmt.Fprintln(w, "should send the protobuf to virtigo here", domname) - d.Current.FullXml = xmldoc log.Warn("About to DumpDroplet()") d.DumpDroplet(w, r) 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) xmldoc, err := virshDumpXML(domname) + if err != nil { + fmt.Fprintln(w, err) + return + } + fmt.Fprintln(w, xmldoc) + return - domcfg := &libvirtxml.Domain{} - err = domcfg.Unmarshal(xmldoc) - if err != nil { - fmt.Fprintln(w, "domain.Unmarshal XML failed") - fmt.Fprintln(w, "error =", err) - return - } - // importDomain(w, r, domcfg) - // importDomain(w http.ResponseWriter, r *http.Request, dom *libvirtxml.Domain) { - xml, _, err := virtigolib.ImportXML(domcfg) - if err != nil { - fmt.Fprintln(w, "ImportXML failed for", domname, err) - return - } - log.Warn("ImportXML worked for", domname) - fmt.Fprintln(w, xml) - // d.Current.FullXml = xmldoc + /* + domcfg := &libvirtxml.Domain{} + err = domcfg.Unmarshal(xmldoc) + if err != nil { + fmt.Fprintln(w, "domain.Unmarshal XML failed") + fmt.Fprintln(w, "error =", err) + return + } + // importDomain(w, r, domcfg) + // importDomain(w http.ResponseWriter, r *http.Request, dom *libvirtxml.Domain) { + xml, _, err := virtigolib.ImportXML(domcfg) + if err != nil { + fmt.Fprintln(w, "ImportXML failed for", domname, err) + return + } + log.Warn("ImportXML worked for", domname) + fmt.Fprintln(w, xml) + // d.Current.FullXml = xmldoc + */ return }