On Wed, 18 Aug 2010, Ian Jackson wrote:
M A Young writes ("[Xen-devel] Re: xm list problem with python 2.7"):
On Sat, 7 Aug 2010, M A Young wrote:
If I try xm list (with xen-4.0.0) I get the following traceback
Unexpected error: <type 'exceptions.AttributeError'>
AttributeError: HTTPUnix instance has no attribute 'getresponse'
I eventually tracked this down to xmlrpc changes in python 2.7 .
Thanks for looking into this. How irritating.
The patch below fixes the xm problem, and a xend problem serving
xmlrpc. Note that the first part won't work as written with earlier
versions of python, though the second part is probably safe as
disable_nagle_algorithm was introduced in python 2.7.
Hrm. Would you care to suggest a patch that should work for earlier
versions of python too ? We can't really do something that breaks
everything before 2.7. (I would say that we probably still support
back to 2.4 at least.)
Here is revised patch. I have tested it (without comments) in python 2.6
and 2.7 and should work in earlier versions.
Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx>
--- xen-4.0.1/tools/python/xen/util/xmlrpcclient.py.orig 2010-02-02
+++ xen-4.0.1/tools/python/xen/util/xmlrpcclient.py 2010-08-18
@@ -22,6 +22,7 @@
from types import StringTypes
+from sys import hexversion
@@ -54,7 +55,12 @@
return xmlrpclib.Transport.request(self, host, '/RPC2',
def make_connection(self, host):
- return HTTPUnix(self.__handler)
+ if hexversion < 0x02070000:
+ # python 2.6 or earlier
+ return HTTPUnix(self.__handler)
+ # xmlrpclib.Transport changed in python 2.7
+ return HTTPUnixConnection(self.__handler)
# We need our own transport for HTTPS, because xmlrpclib.SafeTransport is
--- xen-4.0.1/tools/python/xen/util/xmlrpclib2.py.orig 2010-02-02
+++ xen-4.0.1/tools/python/xen/util/xmlrpclib2.py 2010-08-18
@@ -58,6 +58,9 @@
# some bugs in Keep-Alive handling and also enabled it by default
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-devel mailing list