diff options
author | emellor@ewan <emellor@ewan> | 2005-10-04 16:38:04 +0100 |
---|---|---|
committer | emellor@ewan <emellor@ewan> | 2005-10-04 16:38:04 +0100 |
commit | 440e4b259a4a7f934a2ad981369caf7c68ed13be (patch) | |
tree | 34749e28cb96ade7cb1fefc477a709aa2c867051 /tools/python | |
parent | ceb5b3d25605715802e6a795381a2087ea373be5 (diff) | |
download | xen-440e4b259a4a7f934a2ad981369caf7c68ed13be.tar.gz xen-440e4b259a4a7f934a2ad981369caf7c68ed13be.tar.bz2 xen-440e4b259a4a7f934a2ad981369caf7c68ed13be.zip |
Removed unused xen_domain method, and unused imports. Comment those methods
expecting domains_lock protection. Remove notifications through eserver for
_add_domain and _delete_domain, and remove the notify parameters therein.
Tidy the exception handling in domain_restore_fd.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/python')
-rw-r--r-- | tools/python/xen/xend/XendDomain.py | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index c18c0f61cb..ce05e43f92 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -22,14 +22,12 @@ Needs to be persistent for one uptime. """ import os -import string import threading import xen.lowlevel.xc import XendDomainInfo -from xen.xend import sxp from xen.xend import XendRoot from xen.xend import XendCheckpoint from xen.xend import EventServer @@ -116,8 +114,10 @@ class XendDomain: from xen.xend.xenstore.xswatch import xswatch self.releaseDomain = xswatch("@releaseDomain", self.onReleaseDomain) + def xen_domains(self): - """Get table of domains indexed by id from xc. + """Get table of domains indexed by id from xc. Expects to be + protected by the domains_lock. """ domlist = xc.domain_getinfo() doms = {} @@ -126,57 +126,34 @@ class XendDomain: doms[domid] = d return doms - def xen_domain(self, dom): - """Get info about a single domain from xc. - Returns None if not found. - - @param dom domain id (int) - """ - dominfo = xc.domain_getinfo(dom, 1) - if dominfo == [] or dominfo[0]['dom'] != dom: - dominfo = None - else: - dominfo = dominfo[0] - return dominfo - def dom0_setup(self): + """Expects to be protected by the domains_lock.""" dom0 = self.domains[PRIV_DOMAIN] dom0.dom0_enforce_vcpus() - def _add_domain(self, info, notify=True): - """Add a domain entry to the tables. - - @param info: domain info object - @param notify: send a domain created event if true + def _add_domain(self, info): + """Add the given domain entry to this instance's internal cache. + Expects to be protected by the domains_lock. """ - if info.getDomid() in self.domains: - notify = False self.domains[info.getDomid()] = info - #info.exportToDB() - #if notify: - # eserver.inject('xend.domain.create', [info.getName(), - # info.getDomid()]) - def _delete_domain(self, domid, notify=True): - """Remove a domain from the tables. - @param id: domain id - @param notify: send a domain died event if true + def _delete_domain(self, domid): + """Remove the given domain from this instance's internal cache. + Expects to be protected by the domains_lock. """ info = self.domains.get(domid) if info: del self.domains[domid] info.cleanupDomain() info.cleanupVm() - if notify: - eserver.inject('xend.domain.died', [info.getName(), - info.getDomid()]) def refresh(self): - """Refresh domain list from Xen. + """Refresh domain list from Xen. Expects to be protected by the + domains_lock. """ doms = self.xen_domains() for d in self.domains.values(): @@ -249,7 +226,10 @@ class XendDomain: try: return XendCheckpoint.restore(self, fd) - except Exception, ex: + except: + # I don't really want to log this exception here, but the error + # handling in the relocation-socket handling code (relocate.py) is + # poor, so we need to log this for debugging. log.exception("Restore failed") raise |