components/openstack/cinder/patches/05-keepalive.patch
changeset 5405 66fd59fecd68
parent 5404 55e409ba4e72
child 5406 5ac656f02914
--- a/components/openstack/cinder/patches/05-keepalive.patch	Fri Feb 05 11:09:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-In-house patch to allow the TCP keepalive parameters from cinder.conf
-to be used on Solaris. Patch has not yet been submitted upstream.
-
---- cinder-2014.2.2/cinder/openstack/common/network_utils.py.orig	2014-12-04 21:00:20.000000000 -0800
-+++ cinder-2014.2.2/cinder/openstack/common/network_utils.py	2015-01-23 18:46:17.465276851 -0800
-@@ -18,6 +18,7 @@ Network-related utilities and helper fun
- """
- 
- import socket
-+import sys
- 
- from six.moves.urllib import parse
- 
-@@ -135,26 +136,44 @@ def set_tcp_keepalive(sock, tcp_keepaliv
-     if not tcp_keepalive:
-         return
- 
--    # These options aren't available in the OS X version of eventlet,
--    # Idle + Count * Interval effectively gives you the total timeout.
--    if tcp_keepidle is not None:
--        if hasattr(socket, 'TCP_KEEPIDLE'):
--            sock.setsockopt(socket.IPPROTO_TCP,
--                            socket.TCP_KEEPIDLE,
--                            tcp_keepidle)
-+    if sys.platform == 'sunos5':
-+        # Should match definitions in <netinet/tcp.h>
-+        TCP_KEEPALIVE_THRESHOLD = 0x16
-+        TCP_KEEPALIVE_ABORT_THRESHOLD = 0x17
-+
-+        if tcp_keepidle is not None:
-+            sock.setsockopt(socket.IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD,
-+                            tcp_keepidle * 1000)
-+        if tcp_keepalive_interval is None and tcp_keepalive_count is None:
-+            return
-+        if tcp_keepalive_interval is None or tcp_keepalive_count is None:
-+            LOG.warning(_LW('tcp_keepintvl and tcp_keepknt must be set '
-+                            'together'))
-         else:
--            LOG.warning(_LW('tcp_keepidle not available on your system'))
--    if tcp_keepalive_interval is not None:
--        if hasattr(socket, 'TCP_KEEPINTVL'):
--            sock.setsockopt(socket.IPPROTO_TCP,
--                            socket.TCP_KEEPINTVL,
--                            tcp_keepalive_interval)
--        else:
--            LOG.warning(_LW('tcp_keepintvl not available on your system'))
--    if tcp_keepalive_count is not None:
--        if hasattr(socket, 'TCP_KEEPCNT'):
--            sock.setsockopt(socket.IPPROTO_TCP,
--                            socket.TCP_KEEPCNT,
--                            tcp_keepalive_count)
--        else:
--            LOG.warning(_LW('tcp_keepknt not available on your system'))
-+            sock.setsockopt(
-+                socket.IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD,
-+                tcp_keepalive_interval * tcp_keepalive_count * 1000)
-+    else:
-+        # These options aren't available in the OS X version of eventlet,
-+        # Idle + Count * Interval effectively gives you the total timeout.
-+        if tcp_keepidle is not None:
-+            if hasattr(socket, 'TCP_KEEPIDLE'):
-+                sock.setsockopt(socket.IPPROTO_TCP,
-+                                socket.TCP_KEEPIDLE,
-+                                tcp_keepidle)
-+            else:
-+                LOG.warning(_LW('tcp_keepidle not available on your system'))
-+        if tcp_keepalive_interval is not None:
-+            if hasattr(socket, 'TCP_KEEPINTVL'):
-+                sock.setsockopt(socket.IPPROTO_TCP,
-+                                socket.TCP_KEEPINTVL,
-+                                tcp_keepalive_interval)
-+            else:
-+                LOG.warning(_LW('tcp_keepintvl not available on your system'))
-+        if tcp_keepalive_count is not None:
-+            if hasattr(socket, 'TCP_KEEPCNT'):
-+                sock.setsockopt(socket.IPPROTO_TCP,
-+                                socket.TCP_KEEPCNT,
-+                                tcp_keepalive_count)
-+            else:
-+                LOG.warning(_LW('tcp_keepknt not available on your system'))