[XEND] Ignore dying domains when refreshing list of domains.
authorAlastair Tse <atse@xensource.com>
Thu, 9 Nov 2006 16:05:00 +0000 (16:05 +0000)
committerAlastair Tse <atse@xensource.com>
Thu, 9 Nov 2006 16:05:00 +0000 (16:05 +0000)
Also cleanup stored configuration if managed domain is deleted.

Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendDomain.py

index d68e7266213c0d7f55a9de607071de7a3546401f..d37514d1c2d8e2a824aff922a464378760a34021 100644 (file)
@@ -319,6 +319,7 @@ class XendDomain:
     def _managed_domain_unregister(self, dom):
         try:
             if self.is_domain_managed(dom):
+                self._managed_config_remove(dom.get_uuid())
                 del self.managed_domains[dom.get_uuid()]
         except ValueError:
             log.warn("Domain is not registered: %s" % dom.get_uuid())
@@ -378,15 +379,14 @@ class XendDomain:
         running = self._running_domains()
         for dom in running:
             domid = dom['domid']
-            if domid in self.domains:
+            if domid in self.domains and dom['dying'] != 1:
                 self.domains[domid].update(dom)
 
         # remove domains that are not running from active domain list.
         # The list might have changed by now, because the update call may
         # cause new domains to be added, if the domain has rebooted.  We get
         # the list again.
-        running = self._running_domains()
-        running_domids = [d['domid'] for d in running]
+        running_domids = [d['domid'] for d in running if d['dying'] != 1]
         for domid, dom in self.domains.items():
             if domid not in running_domids and domid != DOM0_ID:
                 self._remove_domain(dom, domid)