# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 039c7fd6a4d22454ad82b098690dc4007965789d
# Parent b7e975425dd677520c630f92e2a2d6d2668cb1d5
Don't auto-add domains we don't know about.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r b7e975425dd6 -r 039c7fd6a4d2 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Jul 27 15:32:44 2005
+++ b/tools/python/xen/xend/XendDomain.py Wed Jul 27 16:57:01 2005
@@ -54,6 +54,10 @@
self.dbmap = DBMap(db=XenNode("/domain"))
eserver.subscribe('xend.virq', self.onVirq)
self.initial_refresh()
+
+ dom0 = self.domain_lookup(0)
+ if not dom0:
+ dom0 = self.domain_unknown(0)
def list(self):
"""Get list of domain objects.
@@ -218,10 +222,6 @@
if cleanup:
self.reap()
doms = self.xen_domains()
- # Add entries for any domains we don't know about.
- for id in doms.keys():
- if id not in self.domains:
- self.domain_lookup(id)
# Remove entries for domains that no longer exist.
# Update entries for existing domains.
do_domain_restarts = False
@@ -331,22 +331,25 @@
self.update_domain(id)
return self.domains.get(id)
+ def domain_unknown(self, id):
+ try:
+ info = self.xen_domain(id)
+ if info:
+ uuid = getUuid()
+ log.info(
+ "Creating entry for unknown domain: id=%d uuid=%s",
+ id, uuid)
+ db = self.dbmap.addChild(uuid)
+ dominfo = XendDomainInfo.recreate(db, info)
+ dominfo.setdom(id)
+ self._add_domain(dominfo)
+ return dominfo
+ except Exception, ex:
+ log.exception("Error creating domain info: id=%d", id)
+ return None
+
def domain_lookup(self, id):
- dominfo = self.domains.get(id)
- if not dominfo:
- try:
- info = self.xen_domain(id)
- if info:
- uuid = getUuid()
- log.info(
- "Creating entry for unknown domain: id=%d uuid=%s",
- id, uuid)
- db = self.dbmap.addChild(uuid)
- dominfo = XendDomainInfo.recreate(db, info)
- self._add_domain(dominfo)
- except Exception, ex:
- log.exception("Error creating domain info: id=%d", id)
- return dominfo
+ return self.domains.get(id)
def domain_lookup_by_name(self, name):
dominfo = self.domains.get_by_name(name)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|