Add checks for Cloud Block Store (#62068)

This commit is contained in:
Simon Dodsley 2019-09-24 15:11:15 -04:00 committed by ansibot
parent 09ac8c154a
commit 8a4c8ae20a
3 changed files with 24 additions and 2 deletions

View file

@ -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)

View file

@ -177,6 +177,20 @@ PREFERRED_ARRAY_API_VERSION = '1.15'
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):
"""Set host initiators."""
if module.params['protocol'] in ['nvme', 'mixed']:
@ -417,6 +431,8 @@ def main():
module = AnsibleModule(argument_spec, supports_check_mode=True)
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()
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.')

View file

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