Skip to content

Commit

Permalink
Merge pull request #51088 from sdodsley/purefa_nvmef_support
Browse files Browse the repository at this point in the history
Update purefa module to support NVMeF NQN for host connectivity
  • Loading branch information
dwoz authored Jan 8, 2019
2 parents cfa5eba + 9c6415c commit 53069a1
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 @@ -615,7 +615,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 @@ -630,14 +630,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 @@ -648,6 +650,12 @@ def host_create(name, iqn=None, wwn=None):
array.create_host(name)
except purestorage.PureError:
return False
if nqn is not None:
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 @@ -666,7 +674,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 @@ -679,6 +687,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 @@ -688,11 +698,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 is not None:
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 53069a1

Please sign in to comment.