From: John Griffith Date: Sun, 9 Aug 2015 16:00:51 +0000 (-0600) Subject: Ignore InsecureReq warning in SolidFire Driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7584925f4335329c34ee3578f003073c54f47386;p=openstack-build%2Fcinder-build.git Ignore InsecureReq warning in SolidFire Driver The python requests package logs the use of Insecure as a warning. Currently the use of http vs https is a configurable option, and for those that use http, the log files include a Warning message for every single request to the SolidFire Cluster. In our case we're explicitly providing the option to use http instead of https, so we can safely ignore this message and remove it from the logs. Change-Id: I746b5f7d7351ef594bf0004ec76458fc1a633031 --- diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index e330d9892..8cefc45fc 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -26,6 +26,9 @@ from oslo_utils import importutils from oslo_utils import timeutils from oslo_utils import units import requests +from requests.packages.urllib3 import exceptions +import warnings + import six from cinder import context @@ -212,11 +215,13 @@ class SolidFireDriver(san.SanISCSIDriver): payload = {'method': method, 'params': params} url = '%s/json-rpc/%s/' % (endpoint['url'], version) - req = requests.post(url, - data=json.dumps(payload), - auth=(endpoint['login'], endpoint['passwd']), - verify=False, - timeout=30) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", exceptions.InsecureRequestWarning) + req = requests.post(url, + data=json.dumps(payload), + auth=(endpoint['login'], endpoint['passwd']), + verify=False, + timeout=30) response = req.json() req.close()