ia64/xen-unstable

changeset 4991:60da48aa3edc

bitkeeper revision 1.1455 (428b7fafRBd0QLCsQs-Dg3X5tA2Hgw)

Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/cl349/xen-unstable.bk
author cl349@firebug.cl.cam.ac.uk
date Wed May 18 17:47:27 2005 +0000 (2005-05-18)
parents bdc5114b6f20 8b03555d6d15
children 4244ea3af1f5
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Wed May 18 17:01:38 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Wed May 18 17:47:27 2005 +0000
     1.3 @@ -80,10 +80,6 @@ class XendDomain:
     1.4      domain_by_id = {}
     1.5      domain_by_name = {}
     1.6      
     1.7 -    """Table of domains to restart, indexed by domain id."""
     1.8 -    restarts_by_id = {}
     1.9 -    restarts_by_name = {}
    1.10 -
    1.11      """Table of pending domain shutdowns, indexed by domain id."""
    1.12      shutdowns_by_id = {}
    1.13  
    1.14 @@ -181,8 +177,6 @@ class XendDomain:
    1.15          dominfo = XendDomainInfo.vm_recreate(savedinfo, info)
    1.16          self.domain_by_id[dominfo.id] = dominfo
    1.17          self.domain_by_name[dominfo.name] = dominfo
    1.18 -        if dominfo.restart_pending():
    1.19 -            self.domain_restart_add(dominfo)
    1.20          return dominfo
    1.21  
    1.22      def _add_domain(self, info, notify=True):
    1.23 @@ -526,38 +520,25 @@ class XendDomain:
    1.24              return
    1.25          restart = (force and reason == 'reboot') or dominfo.restart_needed(reason)
    1.26          if restart:
    1.27 +            log.info('Scheduling restart for domain: name=%s id=%s',
    1.28 +                     dominfo.name, dominfo.id)
    1.29 +            eserver.inject("xend.domain.restart",
    1.30 +                           [dominfo.name, dominfo.id, "schedule"])
    1.31              dominfo.restarting()
    1.32 -            self.domain_restart_add(dominfo)
    1.33          else:
    1.34 -            self.domain_restart_cancel(dominfo.id)
    1.35 -
    1.36 -    def domain_restart_add(self, dominfo):
    1.37 -        self.restarts_by_name[dominfo.name] = dominfo
    1.38 -        self.restarts_by_id[dominfo.id] = dominfo
    1.39 -        log.info('Scheduling restart for domain: name=%s id=%s', dominfo.name, dominfo.id)
    1.40 -        eserver.inject("xend.domain.restart",
    1.41 -                       [dominfo.name, dominfo.id, "schedule"])
    1.42 -            
    1.43 -    def domain_restart_cancel(self, id):
    1.44 -        """Cancel any restart scheduled for a domain.
    1.45 -
    1.46 -        @param id: domain id
    1.47 -        """
    1.48 -        dominfo = self.restarts_by_id.get(id) or self.restarts_by_name.get(id)
    1.49 -        if dominfo:
    1.50              log.info('Cancelling restart for domain: name=%s id=%s',
    1.51                       dominfo.name, dominfo.id)
    1.52              eserver.inject("xend.domain.restart",
    1.53                             [dominfo.name, dominfo.id, "cancel"])
    1.54              dominfo.restart_cancel()
    1.55 -            del self.restarts_by_id[dominfo.id]
    1.56 -            del self.restarts_by_name[dominfo.name]
    1.57  
    1.58      def domain_restarts(self):
    1.59          """Execute any scheduled domain restarts for domains that have gone.
    1.60          """
    1.61          doms = self.xen_domains()
    1.62 -        for dominfo in self.restarts_by_id.values():
    1.63 +        for dominfo in self.domain_by_id.values():
    1.64 +            if not dominfo.restart_pending():
    1.65 +                continue
    1.66              print 'domain_restarts>', dominfo.name, dominfo.id
    1.67              info = doms.get(dominfo.id)
    1.68              if info:
    1.69 @@ -565,8 +546,6 @@ class XendDomain:
    1.70                  print 'domain_restarts> still runnning: ', dominfo.name
    1.71                  continue
    1.72              # Remove it from the restarts.
    1.73 -            del self.restarts_by_id[dominfo.id]
    1.74 -            del self.restarts_by_name[dominfo.name]
    1.75              print 'domain_restarts> restarting: ', dominfo.name
    1.76              self.domain_restart(dominfo)
    1.77