diff --git a/tools/python/xen/web/SrvBase.py b/tools/python/xen/web/SrvBase.py index 49a9e058d1..e0b528fcc0 100644 --- a/tools/python/xen/web/SrvBase.py +++ b/tools/python/xen/web/SrvBase.py @@ -81,7 +81,14 @@ class SrvBase(resource.Resource): req.write("Operation not implemented: " + op) return '' else: - return op_method(op, req) + try: + res = op_method(op, req) + except Exception, exn: + log.exception("Request %s failed.", op) + if req.useSxp(): + return ['xend.err', "Exception: " + str(exn)] + else: + return "
%s
" % str(exn) def print_path(self, req): """Print the path with hyperlinks. diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index dd983e4984..0ec777f6ab 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -547,6 +547,7 @@ class XendDomain: except XendError: raise except Exception, exn: + log.exception("") raise XendError(str(exn)) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 21d365591c..45c0b2be44 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -615,7 +615,7 @@ class XendDomainInfo: if not reason in shutdown_reasons.values(): raise XendError('invalid reason:' + reason) self.storeVm("control/shutdown", reason) - if not reason in ['suspend']: + if not reason == 'suspend': self.storeVm('xend/shutdown_start_time', time.time()) diff --git a/tools/python/xen/xend/server/SrvDomainDir.py b/tools/python/xen/xend/server/SrvDomainDir.py index 942a69ea9a..00a498d559 100644 --- a/tools/python/xen/xend/server/SrvDomainDir.py +++ b/tools/python/xen/xend/server/SrvDomainDir.py @@ -152,11 +152,11 @@ class SrvDomainDir(SrvDir): domains = self.xd.list_sorted() req.write('