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

[Xen-changelog] [xen-3.4-testing] tools/python: fix xm list for Python 2.7



# HG changeset patch
# User Keith Coleman <keith.coleman@xxxxxxxxxxxxx>
# Date 1324430237 18000
# Node ID 2598a5ff535c50b2657443fbd5f9308683039c74
# Parent  356a5ea2e9fbd813185a9dce1b45119b6cead7ea
tools/python: fix xm list for Python 2.7

This patch fixes
  Unexpected error: <type 'exceptions.AttributeError'>
This is due to xmlrpc changes in Python 2.7.  This patch should
fixe it for both old and new versions.

Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
xen-unstable changeset:   22045:2940165380de
xen-unstable date:        Thu Aug 19 17:09:30 2010 +0100
---


diff -r 356a5ea2e9fb -r 2598a5ff535c tools/python/xen/util/xmlrpcclient.py
--- a/tools/python/xen/util/xmlrpcclient.py     Tue Dec 20 20:16:47 2011 -0500
+++ b/tools/python/xen/util/xmlrpcclient.py     Tue Dec 20 20:17:17 2011 -0500
@@ -22,6 +22,7 @@
 import string
 import xmlrpclib
 from types import StringTypes
+from sys import hexversion
 
 
 try:
@@ -54,7 +55,12 @@
         return xmlrpclib.Transport.request(self, host, '/RPC2',
                                            request_body, verbose)
     def make_connection(self, host):
-        return HTTPUnix(self.__handler)
+        if hexversion < 0x02070000:
+            # python 2.6 or earlier
+            return HTTPUnix(self.__handler)
+        else:
+            # xmlrpclib.Transport changed in python 2.7
+            return HTTPUnixConnection(self.__handler)
 
 
 # We need our own transport for HTTPS, because xmlrpclib.SafeTransport is
diff -r 356a5ea2e9fb -r 2598a5ff535c tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Tue Dec 20 20:16:47 2011 -0500
+++ b/tools/python/xen/util/xmlrpclib2.py       Tue Dec 20 20:17:17 2011 -0500
@@ -58,6 +58,9 @@
 # some bugs in Keep-Alive handling and also enabled it by default
 class XMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
     protocol_version = "HTTP/1.1"
+    # xend crashes in python 2.7 unless disable_nagle_algorithm = False
+    # it isn't used in earlier versions so it is harmless to set it generally
+    disable_nagle_algorithm = False
 
     def __init__(self, hosts_allowed, request, client_address, server):
         self.hosts_allowed = hosts_allowed

_______________________________________________
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®.