Xend domain_lookup XendInvalidDomain error reporting patch
Hi,
The error reporting when a domain is invalid is currently XendError (raise XendError("No domain named '%s'." % str(domid))), this should really be XendInvaildDomain (raise XendInvalidDomain ("No domain named '%s'." % str(domid)) for the correct Xend error reporting. And since Xend is already raising XendInvaildDomain exception in the domain_lookup function we don't need check the same exception again in functions that use domain_lookup.
Here is the patch that should fix this problem, please take a look. Thanks!
-Yung Giang
[email protected] <[email protected]>
This patch fixes Xend domain_lookup error report when looking up an invaild domain, it will raise the correct error code (XendInvalidDomain instead of XendError). The patch also removed redundance exception code that is handled by domain_lookup.
Email: Yung Giang <[email protected]>
tools/python/xen/xend/XendDomain.py +2 -2
@@ -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()
tools/python/xen/xend/server/SrvDomainDir.py +0 -2
@@ -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):
tools/python/xen/xend/server/XMLRPCServer.py +0 -2
@@ -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):
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel