summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-07-27 11:49:25 +0000
committerGerrit Code Review <review@openstack.org>2020-07-27 11:49:25 +0000
commit382edd8bfb777cadd502dc7ad28860e418bba1c4 (patch)
tree77527dec016db1f78d168c121f26d9a8d2f34631
parent81d75bc032e637ce26461c4dc2d1937322fbe3c8 (diff)
parentabdfc35f37520f94f7d6b99c1bc786a9120aa11c (diff)
downloadcinder-382edd8bfb777cadd502dc7ad28860e418bba1c4.tar.gz
Merge "tintri: Enable SSL with requests" into stable/queens
-rw-r--r--cinder/volume/drivers/tintri.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/cinder/volume/drivers/tintri.py b/cinder/volume/drivers/tintri.py
index 63bf80e9b..d82dae3e6 100644
--- a/cinder/volume/drivers/tintri.py
+++ b/cinder/volume/drivers/tintri.py
@@ -113,6 +113,9 @@ class TintriDriver(driver.ManageableVD,
self._api_version = getattr(self.configuration, 'tintri_api_version')
self._image_cache_expiry = getattr(self.configuration,
'tintri_image_cache_expiry_days')
+ self.verify_ssl = getattr(self.configuration, 'driver_ssl_cert_verify')
+ self.ssl_cert_path = getattr(self.configuration,
+ 'driver_ssl_cert_path')
def get_pool(self, volume):
"""Returns pool name where volume resides.
@@ -841,24 +844,31 @@ class TClient(object):
url = self.api_url + api
return requests.get(url, headers=self.headers,
- params=query, verify=False)
+ params=query, verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
def delete(self, api):
url = self.api_url + api
- return requests.delete(url, headers=self.headers, verify=False)
+ return requests.delete(url, headers=self.headers,
+ verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
def put(self, api, payload):
url = self.api_url + api
return requests.put(url, data=json.dumps(payload),
- headers=self.headers, verify=False)
+ headers=self.headers,
+ verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
def post(self, api, payload):
url = self.api_url + api
return requests.post(url, data=json.dumps(payload),
- headers=self.headers, verify=False)
+ headers=self.headers,
+ verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
def login(self, username, password):
# Payload, header and URL for login
@@ -872,7 +882,9 @@ class TClient(object):
url = self.api_url + '/' + self.api_version + '/session/login'
r = requests.post(url, data=json.dumps(payload),
- headers=headers, verify=False)
+ headers=headers,
+ verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
if r.status_code != 200:
msg = _('Failed to login for user %s.') % username
@@ -883,7 +895,9 @@ class TClient(object):
def logout(self):
url = self.api_url + '/' + self.api_version + '/session/logout'
- requests.get(url, headers=self.headers, verify=False)
+ requests.get(url, headers=self.headers,
+ verify=self.verify_ssl,
+ cert=self.ssl_cert_path)
@staticmethod
def _remove_prefix(volume_path, prefix):