ia64/xen-unstable

changeset 5903:039c7fd6a4d2

Don't auto-add domains we don't know about.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Jul 27 16:57:01 2005 +0000 (2005-07-27)
parents b7e975425dd6
children 2c67026ea29d
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Wed Jul 27 15:32:44 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Wed Jul 27 16:57:01 2005 +0000
     1.3 @@ -55,6 +55,10 @@ class XendDomain:
     1.4          eserver.subscribe('xend.virq', self.onVirq)
     1.5          self.initial_refresh()
     1.6  
     1.7 +        dom0 = self.domain_lookup(0)
     1.8 +        if not dom0:
     1.9 +            dom0 = self.domain_unknown(0)
    1.10 +
    1.11      def list(self):
    1.12          """Get list of domain objects.
    1.13  
    1.14 @@ -218,10 +222,6 @@ class XendDomain:
    1.15          if cleanup:
    1.16              self.reap()
    1.17          doms = self.xen_domains()
    1.18 -        # Add entries for any domains we don't know about.
    1.19 -        for id in doms.keys():
    1.20 -            if id not in self.domains:
    1.21 -                self.domain_lookup(id)
    1.22          # Remove entries for domains that no longer exist.
    1.23          # Update entries for existing domains.
    1.24          do_domain_restarts = False
    1.25 @@ -331,22 +331,25 @@ class XendDomain:
    1.26          self.update_domain(id)
    1.27          return self.domains.get(id)
    1.28  
    1.29 +    def domain_unknown(self, id):
    1.30 +        try:
    1.31 +            info = self.xen_domain(id)
    1.32 +            if info:
    1.33 +                uuid = getUuid()
    1.34 +                log.info(
    1.35 +                    "Creating entry for unknown domain: id=%d uuid=%s",
    1.36 +                    id, uuid)
    1.37 +                db = self.dbmap.addChild(uuid)
    1.38 +                dominfo = XendDomainInfo.recreate(db, info)
    1.39 +                dominfo.setdom(id)
    1.40 +                self._add_domain(dominfo)
    1.41 +                return dominfo
    1.42 +        except Exception, ex:
    1.43 +            log.exception("Error creating domain info: id=%d", id)
    1.44 +        return None
    1.45 +        
    1.46      def domain_lookup(self, id):
    1.47 -        dominfo = self.domains.get(id)
    1.48 -        if not dominfo:
    1.49 -            try:
    1.50 -                info = self.xen_domain(id)
    1.51 -                if info:
    1.52 -                    uuid = getUuid()
    1.53 -                    log.info(
    1.54 -                        "Creating entry for unknown domain: id=%d uuid=%s",
    1.55 -                        id, uuid)
    1.56 -                    db = self.dbmap.addChild(uuid)
    1.57 -                    dominfo = XendDomainInfo.recreate(db, info)
    1.58 -                    self._add_domain(dominfo)
    1.59 -            except Exception, ex:
    1.60 -                log.exception("Error creating domain info: id=%d", id)
    1.61 -        return dominfo
    1.62 +        return self.domains.get(id)
    1.63  
    1.64      def domain_lookup_by_name(self, name):
    1.65          dominfo = self.domains.get_by_name(name)