]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add missing cleanup for transient guests in UML driver
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 4 Jul 2011 11:11:56 +0000 (12:11 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 12 Jul 2011 16:05:30 +0000 (17:05 +0100)
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

index 8189d677734a9fb33fbb8b8b2f76d84874290e7d..10cd5543bca5c53b36c0243021c806ecc0a3385d 100644 (file)
@@ -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");
+                VIR_WARN("Could not identify character 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: