have to close domains or things hang

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-17 17:15:49 -05:00
parent 84390c4ebc
commit ca0d7ddde7
2 changed files with 11 additions and 2 deletions

View File

@ -18,7 +18,7 @@ import (
"fmt" "fmt"
"log" "log"
hypervisor "github.com/digitalocean/go-qemu/hypervisor" "github.com/digitalocean/go-qemu/hypervisor"
"github.com/digitalocean/go-qemu/qemu" "github.com/digitalocean/go-qemu/qemu"
) )
@ -63,6 +63,15 @@ func poolHypervisor(hv *hypervisor.Hypervisor) string {
fmt.Println("OFF", status, name, drives) fmt.Println("OFF", status, name, drives)
out += "OFF " + name + "\n" out += "OFF " + name + "\n"
} }
// Close the domain to clean up its resources and underlying monitor.
// todo: store dom and reuse it? not closing it hangs libvirt eventually because it leaves dangling
// connects that rack up and all block in virNetSocketReadWire:1781
// probably this doesn't matter because NOTHING HERE IS DONE IN HIGH FREQUENCY EVER.
// domU changes hardly ever happen
if err := dom.Close(); err != nil {
log.Fatalf("failed to close domain: %v", err)
}
} }
return out return out
} }

View File

@ -20,7 +20,7 @@ import (
"net" "net"
"time" "time"
hypervisor "github.com/digitalocean/go-qemu/hypervisor" "github.com/digitalocean/go-qemu/hypervisor"
) )
var Version string var Version string