From ac9fa5de6bbaaa12723debe71d6334b2dab71f15 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Thu, 14 Jan 2016 06:27:11 -0800 Subject: [PATCH] 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 --- cinder/volume/manager.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 3bb833000..d39d9a570 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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, -- 2.45.2