CONF add suppress_requests_ssl_warnings

Many cinder drivers now seem to use the python requests library
to talk to their arrays.  One of the joys of the requests library
is that it correctly complains when it connects to a service where
the SSL certificate is bogus or out of date.  While this is a much
needed warning to raise in production environments, it's often a
useless warning for developers and or for POC deployments of Cinder.

This patch adds a CONF setting that allows the volume manager to
disable all requests ssl warnings for each driver instance.
This greatly cleans up the c-vol logs and makes them readable.

By default the CONF setting is False, or disabled.  So the admin
has to manually edit the cinder.conf file and turn this on.

DocImpact
Change-Id: I2f3d21d828aea9a04cf006dcd471ece668bfd947
This commit is contained in:
Walter A. Boring IV
2016-01-14 06:27:11 -08:00
parent f1d60b155e
commit ac9fa5de6b

View File

@@ -36,7 +36,7 @@ intact.
"""
import requests
import time
from oslo_config import cfg
@@ -106,6 +106,9 @@ volume_manager_opts = [
'location of a backend, then creating a volume type to '
'allow the user to select by these different '
'properties.'),
cfg.BoolOpt('suppress_requests_ssl_warnings',
default=False,
help='Suppress requests library SSL certificate warnings.'),
]
CONF = cfg.CONF
@@ -256,6 +259,13 @@ class VolumeManager(manager.SchedulerDependentManager):
else:
curr_active_backend_id = service.active_backend_id
if self.configuration.suppress_requests_ssl_warnings:
LOG.warning(_LW("Suppressing requests library SSL Warnings"))
requests.packages.urllib3.disable_warnings(
requests.packages.urllib3.exceptions.InsecureRequestWarning)
requests.packages.urllib3.disable_warnings(
requests.packages.urllib3.exceptions.InsecurePlatformWarning)
self.driver = importutils.import_object(
volume_driver,
configuration=self.configuration,