From b0ebbeb7bc83e1cb5c6448026539b5883a243cad Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 1 Nov 2024 04:10:14 -0500 Subject: [PATCH] more debugging on import libvirt domain Signed-off-by: Jeff Carr --- Makefile.help | 4 ++++ argv.go | 4 ++-- http.go | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) 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 }