Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-26 21:05:16 -05:00
parent 65b6176911
commit a314af7f8b
3 changed files with 7 additions and 5 deletions

View File

@ -53,7 +53,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
} }
if tmp == "/vms" { if tmp == "/vms" {
s := poolHypervisor(hv) s := pollHypervisor(hv)
fmt.Fprint(w, s) fmt.Fprint(w, s)
return return
} }

View File

@ -22,7 +22,8 @@ import (
"github.com/digitalocean/go-qemu/qemu" "github.com/digitalocean/go-qemu/qemu"
) )
func poolHypervisor(hv *hypervisor.Hypervisor) string { // get the list of domains from libvirt
func pollHypervisor(hv *hypervisor.Hypervisor) string {
var out string var out string
// fmt.Printf("\n**********Domains**********\n") // fmt.Printf("\n**********Domains**********\n")
domains, err := hv.Domains() domains, err := hv.Domains()
@ -76,6 +77,7 @@ func poolHypervisor(hv *hypervisor.Hypervisor) string {
return out return out
} }
/*
func displayBlockDevices(domain *qemu.Domain) { func displayBlockDevices(domain *qemu.Domain) {
// var []blks string // var []blks string
blockDevices, err := domain.BlockDevices() blockDevices, err := domain.BlockDevices()
@ -105,3 +107,4 @@ func displayPCIDevices(domain *qemu.Domain) {
fmt.Printf("[%10s] [%20s]\n", pciDevice.QdevID, pciDevice.ClassInfo.Desc) fmt.Printf("[%10s] [%20s]\n", pciDevice.QdevID, pciDevice.ClassInfo.Desc)
} }
} }
*/

View File

@ -27,12 +27,11 @@ import (
) )
var Version string var Version string
var hv *hypervisor.Hypervisor
//go:embed resources/* //go:embed resources/*
var resources embed.FS var resources embed.FS
var hv *hypervisor.Hypervisor
func main() { func main() {
if os.Getenv("VIRTIGO_HOME") == "" { if os.Getenv("VIRTIGO_HOME") == "" {
homeDir, _ := os.UserHomeDir() homeDir, _ := os.UserHomeDir()
@ -59,7 +58,7 @@ func main() {
driver := hypervisor.NewRPCDriver(newConn) driver := hypervisor.NewRPCDriver(newConn)
hv = hypervisor.New(driver) hv = hypervisor.New(driver)
poolHypervisor(hv) pollHypervisor(hv)
startHTTP() startHTTP()
} }