Skip to content

Commit

Permalink
Update purefa module to support NVMeF NQN for host connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
sdodsley authored and twangboy committed Oct 24, 2022
1 parent 489e613 commit b4bc22d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions salt/modules/purefa.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def volume_detach(name, host):
return False


def host_create(name, iqn=None, wwn=None):
def host_create(name, iqn=None, wwn=None, nqn=None):
"""
Add a host on a Pure Storage FlashArray.
Expand All @@ -638,14 +638,16 @@ def host_create(name, iqn=None, wwn=None):
name of host (truncated to 63 characters)
iqn : string
iSCSI IQN of host
nqn : string
NVMeF NQN of host
wwn : string
Fibre Channel WWN of host
CLI Example:
.. code-block:: bash
salt '*' purefa.host_create foo iqn='<Valid iSCSI IQN>' wwn='<Valid WWN>'
salt '*' purefa.host_create foo iqn='<Valid iSCSI IQN>' wwn='<Valid WWN>' nqn='<Valid NQN>'
"""
array = _get_system()
Expand All @@ -656,6 +658,12 @@ def host_create(name, iqn=None, wwn=None):
array.create_host(name)
except purestorage.PureError:
return False
if nqn:
try:
array.set_host(name, addnqnlist=[nqn])
except purestorage.PureError:
array.delete_host(name)
return False
if iqn is not None:
try:
array.set_host(name, addiqnlist=[iqn])
Expand All @@ -674,7 +682,7 @@ def host_create(name, iqn=None, wwn=None):
return True


def host_update(name, iqn=None, wwn=None):
def host_update(name, iqn=None, wwn=None, nqn=None):
"""
Update a hosts port definitions on a Pure Storage FlashArray.
Expand All @@ -687,6 +695,8 @@ def host_update(name, iqn=None, wwn=None):
name : string
name of host
nqn : string
Additional NVMeF NQN of host
iqn : string
Additional iSCSI IQN of host
wwn : string
Expand All @@ -696,11 +706,16 @@ def host_update(name, iqn=None, wwn=None):
.. code-block:: bash
salt '*' purefa.host_update foo iqn='<Valid iSCSI IQN>' wwn='<Valid WWN>'
salt '*' purefa.host_update foo iqn='<Valid iSCSI IQN>' wwn='<Valid WWN>' nqn='<Valid NQN>'
"""
array = _get_system()
if _get_host(name, array) is not None:
if nqn:
try:
array.set_host(name, addnqnlist=[nqn])
except purestorage.PureError:
return False
if iqn is not None:
try:
array.set_host(name, addiqnlist=[iqn])
Expand Down

0 comments on commit b4bc22d

Please sign in to comment.