Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update purefa module to support NVMeF NQN for host connectivity #51088

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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