[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Removed unused xen_domain method, and unused imports. Comment those methods



# HG changeset patch
# User emellor@ewan
# Node ID 84c585a99a7b14de177567db8eee812ee7cd46c5
# Parent  81246a2923d274188dc073ab13c8bf7db9fd175c
Removed unused xen_domain method, and unused imports.  Comment those methods
expecting domains_lock protection.  Remove notifications through eserver for
_add_domain and _delete_domain, and remove the notify parameters therein.

Tidy the exception handling in domain_restore_fd.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 81246a2923d2 -r 84c585a99a7b tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue Oct  4 15:27:16 2005
+++ b/tools/python/xen/xend/XendDomain.py       Tue Oct  4 15:38:04 2005
@@ -22,14 +22,12 @@
  Needs to be persistent for one uptime.
 """
 import os
-import string
 import threading
 
 import xen.lowlevel.xc
 
 import XendDomainInfo
 
-from xen.xend import sxp
 from xen.xend import XendRoot
 from xen.xend import XendCheckpoint
 from xen.xend import EventServer
@@ -116,8 +114,10 @@
         from xen.xend.xenstore.xswatch import xswatch
         self.releaseDomain = xswatch("@releaseDomain", self.onReleaseDomain)
 
+
     def xen_domains(self):
-        """Get table of domains indexed by id from xc.
+        """Get table of domains indexed by id from xc.  Expects to be
+        protected by the domains_lock.
         """
         domlist = xc.domain_getinfo()
         doms = {}
@@ -126,57 +126,34 @@
             doms[domid] = d
         return doms
 
-    def xen_domain(self, dom):
-        """Get info about a single domain from xc.
-        Returns None if not found.
-
-        @param dom domain id (int)
-        """
-        dominfo = xc.domain_getinfo(dom, 1)
-        if dominfo == [] or dominfo[0]['dom'] != dom:
-            dominfo = None
-        else:
-            dominfo = dominfo[0]
-        return dominfo
-
 
     def dom0_setup(self):
+        """Expects to be protected by the domains_lock."""
         dom0 = self.domains[PRIV_DOMAIN]
         dom0.dom0_enforce_vcpus()
 
 
-    def _add_domain(self, info, notify=True):
-        """Add a domain entry to the tables.
-
-        @param info:   domain info object
-        @param notify: send a domain created event if true
-        """
-        if info.getDomid() in self.domains:
-            notify = False
+    def _add_domain(self, info):
+        """Add the given domain entry to this instance's internal cache.
+        Expects to be protected by the domains_lock.
+        """
         self.domains[info.getDomid()] = info
-        #info.exportToDB()
-        #if notify:
-        #    eserver.inject('xend.domain.create', [info.getName(),
-        #                                          info.getDomid()])
-
-    def _delete_domain(self, domid, notify=True):
-        """Remove a domain from the tables.
-
-        @param id:     domain id
-        @param notify: send a domain died event if true
+
+
+    def _delete_domain(self, domid):
+        """Remove the given domain from this instance's internal cache.
+        Expects to be protected by the domains_lock.
         """
         info = self.domains.get(domid)
         if info:
             del self.domains[domid]
             info.cleanupDomain()
             info.cleanupVm()
-            if notify:
-                eserver.inject('xend.domain.died', [info.getName(),
-                                                    info.getDomid()])
 
 
     def refresh(self):
-        """Refresh domain list from Xen.
+        """Refresh domain list from Xen.  Expects to be protected by the
+        domains_lock.
         """
         doms = self.xen_domains()
         for d in self.domains.values():
@@ -249,7 +226,10 @@
 
         try:
             return XendCheckpoint.restore(self, fd)
-        except Exception, ex:
+        except:
+            # I don't really want to log this exception here, but the error
+            # handling in the relocation-socket handling code (relocate.py) is
+            # poor, so we need to log this for debugging.
             log.exception("Restore failed")
             raise
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.