summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-17 17:15:49 -0500
committerJeff Carr <[email protected]>2024-10-17 17:15:49 -0500
commitca0d7ddde751a2d582a03f0ad70cec4c8c767145 (patch)
tree0a7f952c7f1fcb214d3e0684ddbbdfd8084ccd1c
parent84390c4ebce12ee2ae6359c09e682778e0406bc1 (diff)
have to close domains or things hang
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--hypervisior.go11
-rw-r--r--main.go2
2 files changed, 11 insertions, 2 deletions
diff --git a/hypervisior.go b/hypervisior.go
index e338889..cc96a94 100644
--- a/hypervisior.go
+++ b/hypervisior.go
@@ -18,7 +18,7 @@ import (
"fmt"
"log"
- hypervisor "github.com/digitalocean/go-qemu/hypervisor"
+ "github.com/digitalocean/go-qemu/hypervisor"
"github.com/digitalocean/go-qemu/qemu"
)
@@ -63,6 +63,15 @@ func poolHypervisor(hv *hypervisor.Hypervisor) string {
fmt.Println("OFF", status, name, drives)
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
}
diff --git a/main.go b/main.go
index 5525b36..7c993cd 100644
--- a/main.go
+++ b/main.go
@@ -20,7 +20,7 @@ import (
"net"
"time"
- hypervisor "github.com/digitalocean/go-qemu/hypervisor"
+ "github.com/digitalocean/go-qemu/hypervisor"
)
var Version string