ia64/xen-unstable

changeset 4985:ce56f7554a7f

bitkeeper revision 1.1452 (428b6062g_unu25_ly_M7YUuHKn8Wg)

XendDomain.py:
Bring back refresh() calls but only run the code cleanup parts
of refresh when necessary.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed May 18 15:33:54 2005 +0000 (2005-05-18)
parents 16e780d91a18
children 6dbad1e6c50c 8b03555d6d15
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Wed May 18 15:28:20 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Wed May 18 15:33:54 2005 +0000
     1.3 @@ -109,7 +109,7 @@ class XendDomain:
     1.4          """Event handler for virq.
     1.5          """
     1.6          print 'onVirq>', val
     1.7 -        self.refresh()
     1.8 +        self.refresh(cleanup=True)
     1.9  
    1.10      def rm_all(self):
    1.11          """Remove all domain info. Used after reboot.
    1.12 @@ -154,7 +154,7 @@ class XendDomain:
    1.13                      self._delete_domain(domid)
    1.14              else:
    1.15                  self._delete_domain(domid)
    1.16 -        self.refresh()
    1.17 +        self.refresh(cleanup=True)
    1.18  
    1.19      def sync(self):
    1.20          """Sync domain db to disk.
    1.21 @@ -274,10 +274,11 @@ class XendDomain:
    1.22              destroyed += 1
    1.23              self.final_domain_destroy(id)
    1.24  
    1.25 -    def refresh(self):
    1.26 +    def refresh(self, cleanup=False):
    1.27          """Refresh domain list from Xen.
    1.28          """
    1.29 -        self.reap()
    1.30 +        if cleanup:
    1.31 +            self.reap()
    1.32          doms = self.xen_domains()
    1.33          # Add entries for any domains we don't know about.
    1.34          for (id, d) in doms.items():
    1.35 @@ -294,7 +295,7 @@ class XendDomain:
    1.36                  do_domain_restarts = True
    1.37              else:
    1.38                  self._delete_domain(d.id)
    1.39 -        if do_domain_restarts:
    1.40 +        if cleanup and do_domain_restarts:
    1.41              self.scheduler.now(self.domain_restarts)
    1.42  
    1.43      def update_domain(self, id):
    1.44 @@ -325,6 +326,7 @@ class XendDomain:
    1.45  
    1.46          @return: domain names
    1.47          """
    1.48 +        self.refresh()
    1.49          return self.domain_by_name.keys()
    1.50  
    1.51      def domain_ls_ids(self):
    1.52 @@ -332,6 +334,7 @@ class XendDomain:
    1.53  
    1.54          @return: domain names
    1.55          """
    1.56 +        self.refresh()
    1.57          return self.domain_by_id.keys()
    1.58  
    1.59      def domains(self):
    1.60 @@ -339,6 +342,7 @@ class XendDomain:
    1.61  
    1.62          @return: domain objects
    1.63          """
    1.64 +        self.refresh()
    1.65          return self.domain_by_id.values()
    1.66      
    1.67      def domain_create(self, config):