diff --git a/Makefile.help b/Makefile.help index a5116b0..48797b3 100644 --- a/Makefile.help +++ b/Makefile.help @@ -13,6 +13,10 @@ curl-vms: curl-kill: curl http://localhost:2520/kill +curl-dumpdomain-coriolis: + # information about libvirt domain for vm 'coriolis': + curl --silent http://localhost:2520/dumpdomain?domain=coriolis + status: dpkg -s virtigod systemctl status virtigod.service diff --git a/argv.go b/argv.go index 4e205d9..193e779 100644 --- a/argv.go +++ b/argv.go @@ -36,7 +36,7 @@ You can query the status directly: # the list of running vms: curl --silent http://localhost:2520/vms - # information about vm foo.bar.com: - curl --silent http://localhost:2520/dumpdroplet?foo.bar.com + # information about libvirt domain for vm 'coriolis': + curl --silent http://localhost:2520/dumpdomain?domain=coriolis ` } diff --git a/http.go b/http.go index 7aafd1f..4252e46 100644 --- a/http.go +++ b/http.go @@ -45,21 +45,41 @@ func okHandler(w http.ResponseWriter, r *http.Request) { xmldoc, err := virshDumpXML(w, r, domname) domcfg := &libvirtxml.Domain{} + fmt.Fprintln(w, "domcfg.Unmarshal()") + fmt.Fprintln(w, "domcfg.Unmarshal()") + fmt.Fprintln(w, "domcfg.Unmarshal()") + log.Warn("domcfg.Unmarshal()") err = domcfg.Unmarshal(xmldoc) if err != nil { fmt.Fprintln(w, "domain.Unmarshal XML failed") 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)") if err != nil { fmt.Fprintln(w, "ImportXML failed for", domname, err) return } + if d == nil { + fmt.Fprintln(w, "ImportXML failed d == nil", err) + return + } 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) return }