diff --git a/cinder/volume/drivers/huawei/rest_client.py b/cinder/volume/drivers/huawei/rest_client.py index 0a6b631abf1..31003b2dec9 100644 --- a/cinder/volume/drivers/huawei/rest_client.py +++ b/cinder/volume/drivers/huawei/rest_client.py @@ -17,6 +17,7 @@ import json import re import six import socket +import ssl import time from oslo_log import log as logging @@ -72,6 +73,14 @@ class RestClient(object): opener = urllib.request.build_opener(handler) urllib.request.install_opener(opener) res_json = None + try: + create_unverified_https_context = ssl._create_unverified_context + except AttributeError: + # Legacy Python that doesn't verify HTTPS certificates by default + pass + else: + # Handle target environment that doesn't support HTTPS verification + ssl._create_default_https_context = create_unverified_https_context try: socket.setdefaulttimeout(calltimeout) diff --git a/releasenotes/notes/globally-disble-verification-6354b916c0c47918.yaml b/releasenotes/notes/globally-disble-verification-6354b916c0c47918.yaml new file mode 100644 index 00000000000..8a44bf290f7 --- /dev/null +++ b/releasenotes/notes/globally-disble-verification-6354b916c0c47918.yaml @@ -0,0 +1,3 @@ +--- +fixes: + SSL certificate validation is now disabled for the Huawei driver. \ No newline at end of file