From Dan Kenigsberg <dan...@redhat.com>:

Dan Kenigsberg has uploaded a new change for review.

Change subject: janitorial: drop kaxmlrpc and unused sslutil constant
......................................................................

janitorial: drop kaxmlrpc and unused sslutil constant

It should have been dropped together with xmlrpc in commit b3d3db.

Change-Id: I9e53a1a4f7017de409d7c4e4abb720196f6c76e7
Signed-off-by: Dan Kenigsberg <dan...@redhat.com>
---
M lib/vdsm/Makefile.am
D lib/vdsm/kaxmlrpclib.py
M lib/vdsm/sslutils.py
M vdsm.spec.in
4 files changed, 0 insertions(+), 151 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/77686/1

diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index bcafbb1..cdcdef6 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -41,7 +41,6 @@
        hugepages.py \
        jobs.py \
        jsonrpcvdscli.py \
-       kaxmlrpclib.py \
        kvm2ovirt.py \
        libvirtconnection.py \
        logUtils.py \
diff --git a/lib/vdsm/kaxmlrpclib.py b/lib/vdsm/kaxmlrpclib.py
deleted file mode 100644
index 235cd57..0000000
--- a/lib/vdsm/kaxmlrpclib.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#
-# Copyright 2008-2017 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-"""xmlrpclib with a keep-alive transport.
-
-Throws a timeout exception to the client when the underlying
-TCP transport is broken.
-
-Inspired by Volodymyr Orlenko,
-http://blog.bjola.ca/2007/08/using-timeout-with-xmlrpclib.html
-
-Sets up an xmlrpc Server with a modified Transport
-(TcpkeepTransport) which uses TcpkeepHTTPConnection when it
-needs to set up a connection.
-"""
-from __future__ import absolute_import
-from __future__ import print_function
-
-import six.moves.xmlrpc_client
-import six.moves.http_client
-import socket
-
-# It would have been nicer to make these server-specific and not module-wide
-# constants. But it is not really important for us, so it should wait.
-KEEPIDLE = 60
-KEEPINTVL = 10
-KEEPCNT = 6
-
-CONNECTTIMEOUT = 160
-
-
-def Server(url, *args, **kwargs):
-    kwargs['transport'] = TcpkeepTransport()
-    server = six.moves.xmlrpc_client.Server(url, *args, **kwargs)
-    return server
-
-ServerProxy = Server
-
-
-class TcpkeepTransport(six.moves.xmlrpc_client.Transport):
-
-    def make_connection(self, host):
-        return TcpkeepHTTPConnection(host)
-
-
-class TcpkeepHTTPConnection(six.moves.http_client.HTTPConnection):
-    def connect(self):
-        """Connect to the host and port specified in __init__.
-
-        taken from httplib.HTTPConnection.connect(), with few additions for
-        connection timeout and keep-alive
-
-        after TCP_KEEPIDLE seconds of silence, TCP_KEEPCNT probes would be
-        sent, TCP_KEEPINTVL seconds apart of each other. If all of them
-        fail, the socket is closed."""
-
-        msg = "getaddrinfo returns an empty list"
-        for res in socket.getaddrinfo(self.host, self.port, 0,
-                                      socket.SOCK_STREAM):
-            af, socktype, proto, canonname, sa = res
-            try:
-                self.sock = socket.socket(af, socktype, proto)
-                if self.debuglevel > 0:
-                    print("connect: (%s, %s)" % (self.host, self.port))
-
-                oldtimeout = self.sock.gettimeout()  # added
-                self.sock.settimeout(CONNECTTIMEOUT)  # added
-                self.sock.connect(sa)
-                self.sock.settimeout(oldtimeout)   # added
-            except socket.error as msg:
-                if self.debuglevel > 0:
-                    print('connect fail:', (self.host, self.port))
-                if self.sock:
-                    self.sock.close()
-                self.sock = None
-                continue
-            break
-        if not self.sock:
-            raise socket.error(msg)
-        # beginning of added code
-        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, KEEPIDLE)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, KEEPINTVL)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, KEEPCNT)
-        # end of added code
-
-
-###################
-# the same, for ssl
-from vdsm import sslutils
-import ssl
-
-
-def SslServer(url, ctx, *args, **kwargs):
-    kwargs['transport'] = TcpkeepSafeTransport(ctx)
-    server = six.moves.xmlrpc_client.Server(url, *args, **kwargs)
-    return server
-
-SslServerProxy = SslServer
-
-
-class TcpkeepSafeTransport(sslutils.VerifyingSafeTransport):
-
-    def make_connection(self, host):
-        chost, self._extra_headers, x509 = self.get_host_info(host)
-        return TcpkeepHTTPSConnection(
-            chost, None, key_file=self.key_file, strict=None,
-            timeout=CONNECTTIMEOUT,
-            cert_file=self.cert_file, ca_certs=self.ca_certs,
-            cert_reqs=self.cert_reqs)
-
-
-class TcpkeepHTTPSConnection(sslutils.VerifyingHTTPSConnection):
-    def __init__(self, host, port=None, key_file=None, cert_file=None,
-                 strict=None, timeout=CONNECTTIMEOUT,
-                 ca_certs=None, cert_reqs=ssl.CERT_REQUIRED):
-        sslutils.VerifyingHTTPSConnection.__init__(
-            self, host, port=port, key_file=key_file, cert_file=cert_file,
-            strict=strict, timeout=timeout,
-            ca_certs=ca_certs, cert_reqs=cert_reqs)
-
-    def connect(self):
-        sslutils.VerifyingHTTPSConnection.connect(self)
-
-        # after TCP_KEEPIDLE seconds of silence, TCP_KEEPCNT probes would be
-        # sent, TCP_KEEPINTVL seconds apart of each other. If all of them fail,
-        # the socket is closed.
-        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, KEEPIDLE)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, KEEPINTVL)
-        self.sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, KEEPCNT)
diff --git a/lib/vdsm/sslutils.py b/lib/vdsm/sslutils.py
index e8baa9e..2a416d3 100644
--- a/lib/vdsm/sslutils.py
+++ b/lib/vdsm/sslutils.py
@@ -32,7 +32,6 @@
 from .config import config
 
 
-DEFAULT_ACCEPT_TIMEOUT = 5
 SOCKET_DEFAULT_TIMEOUT = socket._GLOBAL_DEFAULT_TIMEOUT
 
 
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 43810cf..fa3b98a 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1123,7 +1123,6 @@
 %{python_sitelib}/%{vdsm_name}/hugepages.py*
 %{python_sitelib}/%{vdsm_name}/jobs.py*
 %{python_sitelib}/%{vdsm_name}/jsonrpcvdscli.py*
-%{python_sitelib}/%{vdsm_name}/kaxmlrpclib.py*
 %{python_sitelib}/%{vdsm_name}/kvm2ovirt.py*
 %{python_sitelib}/%{vdsm_name}/libvirtconnection.py*
 %{python_sitelib}/%{vdsm_name}/logUtils.py*


-- 
To view, visit https://gerrit.ovirt.org/77686
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e53a1a4f7017de409d7c4e4abb720196f6c76e7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to