aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2007-03-14 23:12:59 +0000
committerEwan Mellor <ewan@xensource.com>2007-03-14 23:12:59 +0000
commit3c924c8c4c2bc468e4056059d53e7945c9d6d336 (patch)
treedc7c4cbbfda67f7a248b1c58d0992bad50c228d5 /tools
parentefcaa9d8d3f050ecc03285f6215ab47d646162cc (diff)
downloadxen-3c924c8c4c2bc468e4056059d53e7945c9d6d336.tar.gz
xen-3c924c8c4c2bc468e4056059d53e7945c9d6d336.tar.bz2
xen-3c924c8c4c2bc468e4056059d53e7945c9d6d336.zip
Trap bad return values from Xen-API method handlers, and return an internal
error. Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/util/xmlrpclib2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/python/xen/util/xmlrpclib2.py b/tools/python/xen/util/xmlrpclib2.py
index a77b61b5ee..0d0f3ade20 100644
--- a/tools/python/xen/util/xmlrpclib2.py
+++ b/tools/python/xen/util/xmlrpclib2.py
@@ -200,6 +200,18 @@ class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
else:
response = self._dispatch(method, params)
+ if self.xenapi and \
+ (response is None or
+ not isinstance(response, dict) or
+ 'Status' not in response):
+ log.exception('Internal error handling %s: Invalid result %s',
+ method, response)
+ response = { "Status": "Failure",
+ "ErrorDescription":
+ ['INTERNAL_ERROR',
+ 'Invalid result %s handling %s' %
+ (response, method)]}
+
# With either Unicode or normal strings, we can only transmit
# \t, \n, \r, \u0020-\ud7ff, \ue000-\ufffd, and \u10000-\u10ffff
# in an XML document. xmlrpclib does not escape these values