Add checks for Cloud Block Store (#62068)

pull/62808/head
Simon Dodsley 5 years ago committed by ansibot
parent 09ac8c154a
commit 8a4c8ae20a

@ -0,0 +1,3 @@
bugfixes:
- purefa_info - Add support for Cloud Block Store (https://github.com/ansible/ansible/pull/62068)
- purefa_host - Add support for Cloud Block Store (https://github.com/ansible/ansible/pull/62068)

@ -177,6 +177,20 @@ PREFERRED_ARRAY_API_VERSION = '1.15'
NVME_API_VERSION = '1.16' NVME_API_VERSION = '1.16'
def _is_cbs(module, array, is_cbs=False):
"""Is the selected array a Cloud Block Store"""
model = ''
ct0_model = array.get_hardware('CT0')['model']
if ct0_model:
model = ct0_model
else:
ct1_model = array.get_hardware('CT1')['model']
model = ct1_model
if 'CBS' in model:
is_cbs = True
return is_cbs
def _set_host_initiators(module, array): def _set_host_initiators(module, array):
"""Set host initiators.""" """Set host initiators."""
if module.params['protocol'] in ['nvme', 'mixed']: if module.params['protocol'] in ['nvme', 'mixed']:
@ -417,6 +431,8 @@ def main():
module = AnsibleModule(argument_spec, supports_check_mode=True) module = AnsibleModule(argument_spec, supports_check_mode=True)
array = get_system(module) array = get_system(module)
if _is_cbs(module, array) and module.params['wwns'] or module.params['nqn']:
module.fail_json(msg='Cloud block Store only support iSCSI as a protocol')
api_version = array._list_available_rest_versions() api_version = array._list_available_rest_versions()
if module.params['nqn'] is not None and NVME_API_VERSION not in api_version: if module.params['nqn'] is not None and NVME_API_VERSION not in api_version:
module.fail_json(msg='NVMe protocol not supported. Please upgrade your array.') module.fail_json(msg='NVMe protocol not supported. Please upgrade your array.')

@ -965,7 +965,7 @@ def main():
info = {} info = {}
if 'minimum' in subset or 'all' in subset: if 'minimum' in subset or 'all' in subset or 'apps' in subset:
info['default'] = generate_default_dict(array) info['default'] = generate_default_dict(array)
if 'performance' in subset or 'all' in subset: if 'performance' in subset or 'all' in subset:
info['performance'] = generate_perf_dict(array) info['performance'] = generate_perf_dict(array)
@ -1000,7 +1000,10 @@ def main():
info['nfs_offload'] = generate_nfs_offload_dict(array) info['nfs_offload'] = generate_nfs_offload_dict(array)
info['s3_offload'] = generate_s3_offload_dict(array) info['s3_offload'] = generate_s3_offload_dict(array)
if 'apps' in subset or 'all' in subset: if 'apps' in subset or 'all' in subset:
if 'CBS' not in info['default']['array_model']:
info['apps'] = generate_apps_dict(array) info['apps'] = generate_apps_dict(array)
else:
info['apps'] = {}
if 'arrays' in subset or 'all' in subset: if 'arrays' in subset or 'all' in subset:
info['arrays'] = generate_conn_array_dict(array) info['arrays'] = generate_conn_array_dict(array)
if 'certs' in subset or 'all' in subset: if 'certs' in subset or 'all' in subset:

Loading…
Cancel
Save