Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

xm list problem with python 2.7

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


m.a.young at durham

Aug 7, 2010, 10:02 AM

Post #1 of 6 (3054 views)
Permalink
xm list problem with python 2.7

If I try xm list (with xen-4.0.0) I get the following traceback

Unexpected error: <type 'exceptions.AttributeError'>

Please report to xen-devel [at] lists
Traceback (most recent call last):
File "/usr/sbin/xm", line 7, in <module>
main.main(sys.argv)
File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3616, in
main
_, rc = _run_cmd(cmd, cmd_name, args)
File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3640, in
_run_c
md
return True, cmd(args)
File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 969, in
xm_list
doms = getDomains(params, state, use_long)
File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 933, in
getDoma
ins
return server.xend.domains_with_state(True, state, full)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.7/site-packages/xen/util/xmlrpcclient.py", line
118,
in __request
response = xmlrpclib.ServerProxy.__request(self, methodname, params)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
verbose=self.__verbose
File "/usr/lib64/python2.7/site-packages/xen/util/xmlrpcclient.py", line
55, i
n request
request_body, verbose)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1294, in single_request
response = h.getresponse(buffering=True)
AttributeError: HTTPUnix instance has no attribute 'getresponse'

Michael Young

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xensource.com/xen-devel


m.a.young at durham

Aug 18, 2010, 1:43 AM

Post #2 of 6 (2977 views)
Permalink
Re: xm list problem with python 2.7 [In reply to]

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'>
>
> Please report to xen-devel [at] lists
> Traceback (most recent call last):
> File "/usr/sbin/xm", line 7, in <module>
> main.main(sys.argv)
> File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3616, in
> main
> _, rc = _run_cmd(cmd, cmd_name, args)
> File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 3640, in
> _run_c
> md
> return True, cmd(args)
> File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 969, in
> xm_list
> doms = getDomains(params, state, use_long)
> File "/usr/lib64/python2.7/site-packages/xen/xm/main.py", line 933, in
> getDoma
> ins
> return server.xend.domains_with_state(True, state, full)
> File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
> return self.__send(self.__name, args)
> File "/usr/lib64/python2.7/site-packages/xen/util/xmlrpcclient.py", line
> 118,
> in __request
> response = xmlrpclib.ServerProxy.__request(self, methodname, params)
> File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
> verbose=self.__verbose
> File "/usr/lib64/python2.7/site-packages/xen/util/xmlrpcclient.py", line
> 55, i
> n request
> request_body, verbose)
> File "/usr/lib64/python2.7/xmlrpclib.py", line 1264, in request
> return self.single_request(host, handler, request_body, verbose)
> File "/usr/lib64/python2.7/xmlrpclib.py", line 1294, in single_request
> response = h.getresponse(buffering=True)
> AttributeError: HTTPUnix instance has no attribute 'getresponse'

I eventually tracked this down to xmlrpc changes in python 2.7 . 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.

Michael Young

--- xen-4.0.1/tools/python/xen/util/xmlrpcclient.py.orig 2010-02-02 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpcclient.py 2010-08-15 22:52:22.000000000 +0100
@@ -54,7 +54,7 @@
return xmlrpclib.Transport.request(self, host, '/RPC2',
request_body, verbose)
def make_connection(self, host):
- return HTTPUnix(self.__handler)
+ 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 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpclib2.py 2010-08-17 23:56:26.000000000 +0100
@@ -61,6 +61,7 @@

def __init__(self, hosts_allowed, request, client_address, server):
self.hosts_allowed = hosts_allowed
+ self.disable_nagle_algorithm = False
SimpleXMLRPCRequestHandler.__init__(self, request, client_address,
server)


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xensource.com/xen-devel


Ian.Jackson at eu

Aug 18, 2010, 7:46 AM

Post #3 of 6 (2979 views)
Permalink
Re: xm list problem with python 2.7 [In reply to]

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.)

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xensource.com/xen-devel


m.a.young at durham

Aug 18, 2010, 1:44 PM

Post #4 of 6 (2981 views)
Permalink
Re: Re: xm list problem with python 2.7 [In reply to]

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 [at] durham>

--- xen-4.0.1/tools/python/xen/util/xmlrpcclient.py.orig 2010-02-02 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpcclient.py 2010-08-18 21:36:05.000000000 +0100
@@ -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
--- xen-4.0.1/tools/python/xen/util/xmlrpclib2.py.orig 2010-02-02 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpclib2.py 2010-08-18 21:35:40.000000000 +0100
@@ -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-devel mailing list
Xen-devel [at] lists
http://lists.xensource.com/xen-devel


Ian.Jackson at eu

Aug 19, 2010, 7:39 AM

Post #5 of 6 (2975 views)
Permalink
Re: Re: xm list problem with python 2.7 [In reply to]

M A Young writes ("Re: [Xen-devel] Re: xm list problem with python 2.7"):
> Here is revised patch. I have tested it (without comments) in python 2.6
> and 2.7 and should work in earlier versions.

Thanks, that's handy, but it doesn't apply, apparently because your
mailer has mangled the whitespace near the beginning of each line.

Can you try sending it again please , this time both inline and as an
attachment ?

Regards,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xensource.com/xen-devel


m.a.young at durham

Aug 19, 2010, 8:59 AM

Post #6 of 6 (2972 views)
Permalink
Re: Re: xm list problem with python 2.7 [In reply to]

On Thu, 19 Aug 2010, Ian Jackson wrote:

> M A Young writes ("Re: [Xen-devel] Re: xm list problem with python 2.7"):
>> Here is revised patch. I have tested it (without comments) in python 2.6
>> and 2.7 and should work in earlier versions.
>
> Thanks, that's handy, but it doesn't apply, apparently because your
> mailer has mangled the whitespace near the beginning of each line.
>
> Can you try sending it again please , this time both inline and as an
> attachment ?

Sorry, about that, here it is again in both formats.

Signed-off-by: Michael Young <m.a.young [at] durham>

--- xen-4.0.1/tools/python/xen/util/xmlrpcclient.py.orig 2010-02-02 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpcclient.py 2010-08-18 21:36:05.000000000 +0100
@@ -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
--- xen-4.0.1/tools/python/xen/util/xmlrpclib2.py.orig 2010-02-02 20:43:01.000000000 +0000
+++ xen-4.0.1/tools/python/xen/util/xmlrpclib2.py 2010-08-18 21:35:40.000000000 +0100
@@ -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
Attachments: localpy27fixes.patch (1.52 KB)

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.