Nir Soffer has uploaded a new change for review.

Change subject: osschedproxyd: Disable needless and slow dns lookup
......................................................................

osschedproxyd: Disable needless and slow dns lookup

BaseHTTPServer.BaseRequestHandler is invoking socket.getfqdn() after each
request, to log the client fully qualified hostname. If dns is not configured
properly, this cause needless delay after each request.

This patch override address_string to return client address, avoiding
the dns lookup.

Change-Id: Id622cfdc07419c8ad52ad88323b10639288c3668
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M src/ovirtscheduler/oschedproxyd.py
1 file changed, 15 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-scheduler-proxy 
refs/changes/13/24913/1

diff --git a/src/ovirtscheduler/oschedproxyd.py 
b/src/ovirtscheduler/oschedproxyd.py
index 2517c15..36253e4 100644
--- a/src/ovirtscheduler/oschedproxyd.py
+++ b/src/ovirtscheduler/oschedproxyd.py
@@ -29,6 +29,17 @@
     pass
 
 
+class XMLPRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
+
+    def address_string(self):
+        """
+        Override BaseHTTPServer.BaseRequestHandler implementation to avoid
+        pointless and slow attempt to get the fully qualified host name from
+        the client address.
+        """
+        return self.client_address[0]
+
+
 def setup_logging(path):
     file_handler = RotatingFileHandler(path,
                                        maxBytes=50*1024,
@@ -51,8 +62,10 @@
 
     def setup(self):
         logging.info("Setting up server")
-        self._server = SimpleThreadedXMLRPCServer(("localhost", 18781),
-                                                  allow_none=True)
+        self._server = SimpleThreadedXMLRPCServer(
+            ("localhost", 18781),
+            allow_none=True,
+            requestHandler=XMLPRPCRequestHandler)
 
         # TODO make by config
         plugins_path = os.path.join(os.getcwd(), "plugins")


-- 
To view, visit http://gerrit.ovirt.org/24913
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id622cfdc07419c8ad52ad88323b10639288c3668
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-scheduler-proxy
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to