From 54293fed3c9bfce489fe1a90cec3329c6dac7f2b Mon Sep 17 00:00:00 2001 From: Simon Dodsley Date: Fri, 8 Mar 2019 18:44:04 -0500 Subject: [PATCH] Update purefa_facts module to support NVMe and preferred arrays (#53567) --- .../modules/storage/purestorage/purefa_facts.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/ansible/modules/storage/purestorage/purefa_facts.py b/lib/ansible/modules/storage/purestorage/purefa_facts.py index 8dc17c5ecd4..cc94bbbf909 100644 --- a/lib/ansible/modules/storage/purestorage/purefa_facts.py +++ b/lib/ansible/modules/storage/purestorage/purefa_facts.py @@ -340,6 +340,8 @@ LATENCY_REQUIRED_API_VERSION = '1.16' AC_REQUIRED_API_VERSION = '1.14' CAP_REQUIRED_API_VERSION = '1.6' SAN_REQUIRED_API_VERSION = '1.10' +NVME_API_VERSION = '1.16' +PREFERRED_API_VERSION = '1.15' def generate_default_dict(array): @@ -578,6 +580,7 @@ def generate_vol_dict(array): def generate_host_dict(array): + api_version = array._list_available_rest_versions() host_facts = {} hosts = array.list_hosts() for host in range(0, len(hosts)): @@ -589,6 +592,13 @@ def generate_host_dict(array): 'personality': array.get_host(hostname, personality=True)['personality'] } + if NVME_API_VERSION in api_version: + host_facts[hostname]['nqn'] = hosts[host]['nqn'] + if PREFERRED_API_VERSION in api_version: + hosts = array.list_hosts(preferred_array=True) + for host in range(0, len(hosts)): + hostname = hosts[host]['name'] + host_facts[hostname]['preferred_array'] = hosts[host]['preferred_array'] return host_facts @@ -705,6 +715,7 @@ def generate_hgroups_dict(array): def generate_interfaces_dict(array): + api_version = array._list_available_rest_versions() int_facts = {} ports = array.list_ports() for port in range(0, len(ports)): @@ -713,6 +724,9 @@ def generate_interfaces_dict(array): int_facts[int_name] = ports[port]['wwn'] if ports[port]['iqn']: int_facts[int_name] = ports[port]['iqn'] + if NVME_API_VERSION in api_version: + if ports[port]['nqn']: + int_facts[int_name] = ports[port]['nqn'] return int_facts