]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix for using '::' on hosts without ipv6 26751/head
authorNoah Watkins <noahwatkins@gmail.com>
Fri, 22 Feb 2019 22:13:47 +0000 (14:13 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Mon, 4 Mar 2019 19:40:37 +0000 (11:40 -0800)
CherryPy throws an uncaught exception using '::' when the host does not
have an ipv6 loopback address. This is currently the case in kubernetes.
This patch disables the routine in cherrypy that performs the validation
that requested server ports are actually bound.

fixes: http://tracker.ceph.com/issues/38576

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
(cherry picked from commit 384d82a1bb1a3f0c2b1027968f03fe7834daad6a)

Conflicts:
src/pybind/mgr/dashboard/module.py

Contextual conflict as >luminous had nearby SSL code that was never
backported.

src/pybind/mgr/dashboard/module.py
src/pybind/mgr/prometheus/module.py

index 39add806393cded839fd5a07731db203815aab04..c52ff530500d4e8e497e490fd110ba4031ec1c22 100644 (file)
@@ -27,6 +27,7 @@ import socket
 import cherrypy
 import jinja2
 import urlparse
+from distutils.version import StrictVersion
 
 from mgr_module import MgrModule, MgrStandbyModule, CommandResult
 
@@ -46,6 +47,20 @@ log = logging.getLogger("dashboard")
 # python module for the convenience of the GUI?
 LOG_BUFFER_SIZE = 30
 
+# When the CherryPy server in 3.2.2 (and later) starts it attempts to verify
+# that the ports its listening on are in fact bound. When using the any address
+# "::" it tries both ipv4 and ipv6, and in some environments (e.g. kubernetes)
+# ipv6 isn't yet configured / supported and CherryPy throws an uncaught
+# exception.
+if cherrypy is not None:
+    v = StrictVersion(cherrypy.__version__)
+    # the issue was fixed in 3.2.3. it's present in 3.2.2 (current version on
+    # centos:7) and back to at least 3.0.0.
+    if StrictVersion("3.1.2") <= v < StrictVersion("3.2.3"):
+        # https://github.com/cherrypy/cherrypy/issues/1100
+        from cherrypy.process import servers
+        servers.wait_for_occupied_port = lambda host, port: None
+
 # cherrypy likes to sys.exit on error.  don't let it take us down too!
 def os_exit_noop(*args, **kwargs):
     pass
index fc013fb8591277394b308368b8c13824d01dbc9f..16abd07924581a0e261344cc7ef7134d87834a5c 100644 (file)
@@ -1,4 +1,5 @@
 import cherrypy
+from distutils.version import StrictVersion
 import json
 import errno
 import math
@@ -15,6 +16,19 @@ from mgr_module import MgrModule, MgrStandbyModule
 DEFAULT_ADDR = '::'
 DEFAULT_PORT = 9283
 
+# When the CherryPy server in 3.2.2 (and later) starts it attempts to verify
+# that the ports its listening on are in fact bound. When using the any address
+# "::" it tries both ipv4 and ipv6, and in some environments (e.g. kubernetes)
+# ipv6 isn't yet configured / supported and CherryPy throws an uncaught
+# exception.
+if cherrypy is not None:
+    v = StrictVersion(cherrypy.__version__)
+    # the issue was fixed in 3.2.3. it's present in 3.2.2 (current version on
+    # centos:7) and back to at least 3.0.0.
+    if StrictVersion("3.1.2") <= v < StrictVersion("3.2.3"):
+        # https://github.com/cherrypy/cherrypy/issues/1100
+        from cherrypy.process import servers
+        servers.wait_for_occupied_port = lambda host, port: None
 
 # cherrypy likes to sys.exit on error.  don't let it take us down too!
 def os_exit_noop(*args, **kwargs):