ia64/xen-unstable

changeset 14201:780ef7701772

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>
author kfraser@localhost.localdomain
date Thu Mar 01 13:48:31 2007 +0000 (2007-03-01)
parents 035d41b6c94c
children 42aa0100574b
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/XMLRPCServer.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Mar 01 13:45:53 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Mar 01 13:48:31 2007 +0000
     1.3 @@ -488,14 +488,14 @@ class XendDomain:
     1.4          @type domid: int or string
     1.5          @return: Found domain.
     1.6          @rtype: XendDomainInfo
     1.7 -        @raise XendError: If domain is not found.
     1.8 +        @raise XendInvalidDomain: If domain is not found.
     1.9          """
    1.10          self.domains_lock.acquire()
    1.11          try:
    1.12              self._refresh(refresh_shutdown = False)
    1.13              dom = self.domain_lookup_nr(domid)
    1.14              if not dom:
    1.15 -                raise XendError("No domain named '%s'." % str(domid))
    1.16 +                raise XendInvalidDomain("No domain named '%s'." % str(domid))
    1.17              return dom
    1.18          finally:
    1.19              self.domains_lock.release()
     2.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Thu Mar 01 13:45:53 2007 +0000
     2.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Thu Mar 01 13:48:31 2007 +0000
     2.3 @@ -42,8 +42,6 @@ class SrvDomainDir(SrvDir):
     2.4  
     2.5      def domain(self, x):
     2.6          dom = self.xd.domain_lookup(x)
     2.7 -        if not dom:
     2.8 -            raise XendError('No such domain ' + str(x))
     2.9          return SrvDomain(dom)
    2.10  
    2.11      def get(self, x):
     3.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Thu Mar 01 13:45:53 2007 +0000
     3.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Thu Mar 01 13:48:31 2007 +0000
     3.3 @@ -43,8 +43,6 @@ def fixup_sxpr(sexpr):
     3.4  
     3.5  def lookup(domid):
     3.6      info = XendDomain.instance().domain_lookup(domid)
     3.7 -    if not info:
     3.8 -        raise XendInvalidDomain(str(domid))
     3.9      return info
    3.10  
    3.11  def dispatch(domid, fn, args):