Fix Xend domain_lookup error report when looking up an invalid

domain: raise the correct error code (XendInvalidDomain instead of
XendError). Also remove redundance exception code that is handled by
domain_lookup.

Signed-off-by: Yung Giang <ygiang@gmail.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-03-01 13:48:31 +00:00
1 parent 0ba49c38df
commit 279a6c16e6
3 files changed
+2 -6

No files matched your search

+2 -2
View File
@@ -488,14 +488,14 @@ class XendDomain:
@type domid: int or string
@return: Found domain.
@rtype: XendDomainInfo
@raise XendError: If domain is not found.
@raise XendInvalidDomain: If domain is not found.
"""
self.domains_lock.acquire()
try:
self._refresh(refresh_shutdown = False)
dom = self.domain_lookup_nr(domid)
if not dom:
raise XendError("No domain named '%s'." % str(domid))
raise XendInvalidDomain("No domain named '%s'." % str(domid))
return dom
finally:
self.domains_lock.release()
@@ -42,8 +42,6 @@ class SrvDomainDir(SrvDir):
def domain(self, x):
dom = self.xd.domain_lookup(x)
if not dom:
raise XendError('No such domain ' + str(x))
return SrvDomain(dom)
def get(self, x):
@@ -43,8 +43,6 @@ def fixup_sxpr(sexpr):
def lookup(domid):
info = XendDomain.instance().domain_lookup(domid)
if not info:
raise XendInvalidDomain(str(domid))
return info
def dispatch(domid, fn, args):
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.