[libvirt] [PATCH 6/6] Add missing cleanup for transient guests in UML driver

Daniel P. Berrange berrange at redhat.com
Mon Jul 4 11:33:37 UTC 2011


The UML inotify handler would kill off guests when certain
conditions arise, but it forgot to remove transient guests
from the list of domains

* src/uml/uml_driver.c: Cleanup transient guests
---
 src/uml/uml_driver.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index b2d11b3..91591f1 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -311,6 +311,11 @@ reread:
 
             umlShutdownVMDaemon(NULL, driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
             virDomainAuditStop(dom, "shutdown");
+            if (!dom->persistent) {
+                virDomainRemoveInactive(&driver->domains,
+                                        dom);
+                dom = NULL;
+            }
         } else if (e->mask & (IN_CREATE | IN_MODIFY)) {
             VIR_DEBUG("Got inotify domain startup '%s'", name);
             if (virDomainObjIsActive(dom)) {
@@ -332,14 +337,25 @@ reread:
                 umlShutdownVMDaemon(NULL, driver, dom,
                                     VIR_DOMAIN_SHUTOFF_FAILED);
                 virDomainAuditStop(dom, "failed");
+                if (!dom->persistent) {
+                    virDomainRemoveInactive(&driver->domains,
+                                            dom);
+                    dom = NULL;
+                }
             } else if (umlIdentifyChrPTY(driver, dom) < 0) {
                 VIR_WARN("Could not identify charater devices for new domain");
                 umlShutdownVMDaemon(NULL, driver, dom,
                                     VIR_DOMAIN_SHUTOFF_FAILED);
                 virDomainAuditStop(dom, "failed");
+                if (!dom->persistent) {
+                    virDomainRemoveInactive(&driver->domains,
+                                            dom);
+                    dom = NULL;
+                }
             }
         }
-        virDomainObjUnlock(dom);
+        if (dom)
+            virDomainObjUnlock(dom);
     }
 
 cleanup:
-- 
1.7.4.4




More information about the libvir-list mailing list