set up ca file configuration in drver

add 3 items in configuration file:zvm_ssl_enabled, zvm_verify_enabled
and zvm_ca_file.

Change-Id: I1adc33882689513865bb850618e558a09810ccfe
This commit is contained in:
SharpRazor 2017-12-20 17:29:56 +08:00
parent 77e5cfa112
commit 6e0d114546
3 changed files with 22 additions and 2 deletions

View File

@ -49,6 +49,13 @@ Possible Values:
but it will vary depending on instance and system load.
A value of 0 is used for debug. In this case the underlying z/VM guest
will not be deleted when the instance is marked in ERROR state.
"""),
cfg.StrOpt('zvm_ca_file',
default=None,
help="""
CA certificate file to be verified in httpd server
A string, it must be a path to a CA bundle to use.
"""),
]

View File

@ -45,7 +45,20 @@ class zVMConnectorRequestHandler(object):
def __init__(self):
_url = urlparse.urlparse(CONF.zvm_cloud_connector_url)
self._conn = connector.ZVMConnector(_url.hostname, _url.port)
_ca_file = CONF.zvm_ca_file
if _url.scheme == 'https':
_ssl_enabled = True
else:
_ssl_enabled = False
if _ssl_enabled and _ca_file:
self._conn = connector.ZVMConnector(_url.hostname, _url.port,
ssl_enabled=_ssl_enabled,
verify=_ca_file)
else:
self._conn = connector.ZVMConnector(_url.hostname, _url.port,
ssl_enabled=_ssl_enabled,
verify=False)
def call(self, func_name, *args, **kwargs):
results = self._conn.send_request(func_name, *args, **kwargs)

View File

@ -9,4 +9,4 @@ oslo.service>=1.10.0 # Apache-2.0
oslo.utils>=3.20.0 # Apache-2.0
six>=1.9.0
zVMCloudConnector>=0.3.2 # Apache 2.0 License
zVMCloudConnector>=0.3.3 # Apache 2.0 License