Change in vdsm[master]: XMLRPCServer able to listen on IPv6 addresses
psebek at redhat.com
psebek at redhat.com
Thu May 16 12:55:15 UTC 2013
Petr Sebek has uploaded a new change for review.
Change subject: XMLRPCServer able to listen on IPv6 addresses
......................................................................
XMLRPCServer able to listen on IPv6 addresses
SimpleXMLRPCServer is derived from SocketServer.TCPServer of which the
default address_family is socket.AF_INET by default, that makes it could
only listen on IPv4 connections. We simply wrap it, extending its
ability on IPv6 networks.
Change-Id: I06fd5386d00973bebd0208a65027399532b690c8
Signed-off-by: Petr Sebek <psebek at redhat.com>
---
M lib/vdsm/SecureXMLRPCServer.py
M lib/vdsm/utils.py
2 files changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/14779/1
diff --git a/lib/vdsm/SecureXMLRPCServer.py b/lib/vdsm/SecureXMLRPCServer.py
index 78c4b72..4250bf4 100644
--- a/lib/vdsm/SecureXMLRPCServer.py
+++ b/lib/vdsm/SecureXMLRPCServer.py
@@ -28,7 +28,7 @@
"""SecureXMLRPCServer.py - simple XML RPC server supporting SSL."""
-import SimpleXMLRPCServer
+from vdsm.utils import IPXMLRPCRequestHandler, IPXMLRPCServer
import xmlrpclib
import ssl
import httplib
@@ -38,7 +38,7 @@
from M2Crypto import SSL, X509
-SecureXMLRPCRequestHandler = SimpleXMLRPCServer.SimpleXMLRPCRequestHandler
+SecureXMLRPCRequestHandler = IPXMLRPCRequestHandler
class SSLSocket(object):
@@ -118,9 +118,9 @@
return client, address
-class SecureXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
+class SecureXMLRPCServer(IPXMLRPCServer):
def __init__(self, addr,
- requestHandler=SimpleXMLRPCServer.SimpleXMLRPCRequestHandler,
+ requestHandler=IPXMLRPCRequestHandler,
logRequests=True, allow_none=False, encoding=None,
bind_and_activate=True,
keyfile=None, certfile=None, ca_certs=None,
@@ -129,7 +129,7 @@
its self.socket member with ssl.
"""
- SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(
+ IPXMLRPCServer.__init__(
self, addr, requestHandler, logRequests, allow_none, encoding,
bind_and_activate=False)
self.socket = SSLServerSocket(raw=self.socket, certfile=certfile,
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index f1a31b6..759e95e 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -27,6 +27,8 @@
Contains a reverse dictionary pointing from error string to its error code.
"""
from SimpleXMLRPCServer import SimpleXMLRPCServer
+from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
+import socket
from StringIO import StringIO
from weakref import proxy
import SocketServer
@@ -84,10 +86,22 @@
exc_info=True)
raise
+IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
+
+
+class IPXMLRPCServer(SimpleXMLRPCServer):
+ def __init__(self, addr, requestHandler=IPXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True):
+ self.address_family = socket.getaddrinfo(addr[0], addr[1])[0][0]
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler,
+ logRequests, allow_none, encoding,
+ bind_and_activate)
+
#Threaded version of SimpleXMLRPCServer
class SimpleThreadedXMLRPCServer(SocketServer.ThreadingMixIn,
- SimpleXMLRPCServer):
+ IPXMLRPCServer):
allow_reuse_address = True
--
To view, visit http://gerrit.ovirt.org/14779
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I06fd5386d00973bebd0208a65027399532b690c8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Sebek <psebek at redhat.com>
More information about the vdsm-patches
mailing list