[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Trap bad return values from Xen-API method handlers, and return an internal



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173913979 0
# Node ID acdfb333af532b4eed41a6b4fd72800531cca497
# Parent  e4e1435e4c6399ffe9cbfab3338f6d2e31a4c191
Trap bad return values from Xen-API method handlers, and return an internal
error.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/util/xmlrpclib2.py |   12 ++++++++++++
 1 files changed, 12 insertions(+)

diff -r e4e1435e4c63 -r acdfb333af53 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Wed Mar 14 21:59:11 2007 +0000
+++ b/tools/python/xen/util/xmlrpclib2.py       Wed Mar 14 23:12:59 2007 +0000
@@ -199,6 +199,18 @@ class TCPXMLRPCServer(SocketServer.Threa
                 response = dispatch_method(method, params)
             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

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.