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

[Xen-changelog] XendDomain.py:



ChangeSet 1.1471.1.1, 2005/05/19 22:30:49+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        XendDomain.py:
          Remove domain_db cache -- it's tedious to maintain and has zero use 
since
          it gets flushed to the XendDB immediately on every update and it's 
never
          consulted except for maintaining it.
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 XendDomain.py |   35 +++++++----------------------------
 1 files changed, 7 insertions(+), 28 deletions(-)


diff -Nru a/tools/python/xen/xend/XendDomain.py 
b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       2005-05-19 18:04:43 -04:00
+++ b/tools/python/xen/xend/XendDomain.py       2005-05-19 18:04:43 -04:00
@@ -53,10 +53,6 @@
         xroot.add_component("xen.xend.XendDomain", self)
         # Table of domain info indexed by domain id.
         self.db = XendDB.XendDB(self.dbpath)
-        self.domain_db = self.db.fetchall("")
-        # XXXcl maybe check if there's only dom0 if we _really_ need
-        #       to remove the db 
-        # self.rm_all()
         eserver.subscribe('xend.virq', self.onVirq)
         self.initial_refresh()
 
@@ -73,12 +69,6 @@
         print 'onVirq>', val
         self.refresh(cleanup=True)
 
-    def rm_all(self):
-        """Remove all domain info. Used after reboot.
-        """
-        for (k, v) in self.domain_db.items():
-            self._delete_domain(k, notify=False)
-
     def xen_domains(self):
         """Get table of domains indexed by id from xc.
         """
@@ -102,10 +92,10 @@
         return dominfo
             
     def initial_refresh(self):
-        """Refresh initial domain info from domain_db.
+        """Refresh initial domain info from db.
         """
         doms = self.xen_domains()
-        for config in self.domain_db.values():
+        for config in self.db.fetchall("").values():
             domid = str(sxp.child_value(config, 'id'))
             if domid in doms:
                 try:
@@ -118,17 +108,12 @@
                 self._delete_domain(domid)
         self.refresh(cleanup=True)
 
-    def sync(self):
-        """Sync domain db to disk.
-        """
-        self.db.saveall("", self.domain_db)
-
-    def sync_domain(self, dom):
+    def sync_domain(self, info):
         """Sync info for a domain to disk.
 
-        dom    domain id (string)
+        info   domain info
         """
-        self.db.save(dom, self.domain_db[dom])
+        self.db.save(info.id, info.sxpr())
 
     def close(self):
         pass
@@ -154,14 +139,11 @@
         for i, d in self.domains.items():
             if i != d.id:
                 del self.domains[i]
-                if i in self.domain_db:
-                    del self.domain_db[i]
                 self.db.delete(i)
         if info.id in self.domains:
             notify = False
         self.domains[info.id] = info
-        self.domain_db[info.id] = info.sxpr()
-        self.sync_domain(info.id)
+        self.sync_domain(info)
         if notify:
             eserver.inject('xend.domain.create', [info.name, info.id])
 
@@ -176,8 +158,6 @@
             del self.domains[id]
             if notify:
                 eserver.inject('xend.domain.died', [info.name, info.id])
-        if id in self.domain_db:
-            del self.domain_db[id]
             self.db.delete(id)
 
     def reap(self):
@@ -253,8 +233,7 @@
         """
         dominfo = self.domains.get(id)
         if dominfo:
-            self.domain_db[id] = dominfo.sxpr()
-            self.sync_domain(id)
+            self.sync_domain(dominfo)
 
     def refresh_domain(self, id):
         """Refresh information for a single domain.

_______________________________________________
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®.