ia64/xen-unstable

changeset 7531:0240a69e1f97

Move exception handler for sxp.ParseError above that for Exception, as the
latter subsumes the former. Minor tidy-ups.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Oct 26 14:59:29 2005 +0100 (2005-10-26)
parents 98fd1359eecd
children 20d1a79ebe31
files tools/python/xen/xend/server/SrvDomainDir.py
line diff
     1.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Wed Oct 26 14:58:13 2005 +0100
     1.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Wed Oct 26 14:59:29 2005 +0100
     1.3 @@ -25,7 +25,6 @@ from xen.xend import XendDomain
     1.4  from xen.xend.XendDomainInfo import XendDomainInfo
     1.5  from xen.xend.Args import FormFn
     1.6  from xen.xend.XendError import XendError
     1.7 -from xen.xend.XendLogging import log
     1.8  
     1.9  from xen.web.SrvDir import SrvDir
    1.10  from SrvDomain import SrvDomain
    1.11 @@ -52,7 +51,7 @@ class SrvDomainDir(SrvDir):
    1.12          else:
    1.13              return self.domain(x)
    1.14  
    1.15 -    def op_create(self, op, req):
    1.16 +    def op_create(self, _, req):
    1.17          """Create a domain.
    1.18          Expects the domain config in request parameter 'config' in SXP format.
    1.19          """
    1.20 @@ -66,12 +65,12 @@ class SrvDomainDir(SrvDir):
    1.21              pin.input_eof()
    1.22              config = pin.get_val()
    1.23              ok = 1
    1.24 +        except sxp.ParseError, ex:
    1.25 +            errmsg = 'Invalid configuration ' + str(ex)
    1.26          except Exception, ex:
    1.27              print 'op_create> Exception in config', ex
    1.28              traceback.print_exc()
    1.29              errmsg = 'Configuration error ' + str(ex)
    1.30 -        except sxp.ParseError, ex:
    1.31 -            errmsg = 'Invalid configuration ' + str(ex)
    1.32          if not ok:
    1.33              raise XendError(errmsg)
    1.34          try:
    1.35 @@ -108,7 +107,7 @@ class SrvDomainDir(SrvDir):
    1.36          """
    1.37          return req.threadRequest(self.do_restore, op, req)
    1.38  
    1.39 -    def do_restore(self, op, req):
    1.40 +    def do_restore(self, _, req):
    1.41          fn = FormFn(self.xd.domain_restore,
    1.42                      [['file', 'str']])
    1.43          dominfo = fn(req.args)