more debugging on import libvirt domain

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-01 04:10:14 -05:00
parent bd62967a53
commit b0ebbeb7bc
3 changed files with 26 additions and 2 deletions

View File

@ -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

View File

@ -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
`
}

20
http.go
View File

@ -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
}