Currently, transient domains are removed when destroyed.
But the shutdown event ends up handled by the monitor which does not
remove the domain.

Update bhyveMonitorIO() to remove the domain if it's transient and not
active.

Closes: https://gitlab.com/libvirt/libvirt/-/work_items/922
Signed-off-by: Roman Bogorodskiy <[email protected]>
---
Related TCK change: https://gitlab.com/libvirt/libvirt-tck/-/merge_requests/94

 src/bhyve/bhyve_monitor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c
index 379e588070..dab07ff95f 100644
--- a/src/bhyve/bhyve_monitor.c
+++ b/src/bhyve/bhyve_monitor.c
@@ -186,6 +186,9 @@ bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, 
void *opaque)
         }
     }
 
+    if (!virDomainObjIsActive(vm) && !vm->persistent)
+        virDomainObjListRemove(driver->domains, vm);
+
  cleanup:
     virObjectUnlock(vm);
 }
-- 
2.55.0

Reply via email to