WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] tools/python: fix xm list for Python 2.7
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Dec 2010 11:35:34 -0800
Delivery-date: Thu, 23 Dec 2010 11:38:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292840480 0
# Node ID 9c2fdcff370481f6bbef854741cd19c1413dc018
# Parent  693ecac22dbdbe74f122249f61da773e95d24cc2
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
---
 tools/python/xen/util/xmlrpcclient.py |    8 +++++++-
 tools/python/xen/util/xmlrpclib2.py   |    3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff -r 693ecac22dbd -r 9c2fdcff3704 tools/python/xen/util/xmlrpcclient.py
--- a/tools/python/xen/util/xmlrpcclient.py     Fri Dec 17 17:57:33 2010 +0000
+++ b/tools/python/xen/util/xmlrpcclient.py     Mon Dec 20 10:21:20 2010 +0000
@@ -22,6 +22,7 @@ import string
 import string
 import xmlrpclib
 from types import StringTypes
+from sys import hexversion
 
 
 try:
@@ -54,7 +55,12 @@ class UnixTransport(xmlrpclib.Transport)
         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 693ecac22dbd -r 9c2fdcff3704 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Fri Dec 17 17:57:33 2010 +0000
+++ b/tools/python/xen/util/xmlrpclib2.py       Mon Dec 20 10:21:20 2010 +0000
@@ -58,6 +58,9 @@ def stringify(value):
 # 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] tools/python: fix xm list for Python 2.7, Xen patchbot-4.0-testing <=