Commit [34e9a6] Maximize Restore History

C API & PY: Initiator verification. (V2)

C additions and python changes to support initiator
validation. I changes the iqn validation to only
check the first 3 characters 'iqn|eui|naa'. The
WWPN allows the same permutations and combinations
as Gris's original patch, but allows both the command
line and the plug-ins to use any of these different formats
when supplying initiators to the library. In both cases
the library will re-format to the internal representation
which is nn:nn:nn:nn:nn:nn:nn:nn.

Plugins that take the wwpn and need it in another format will
need to convert to what ever format they require.

To ensure that this is consistently done, when creating an instance
of an access group the C and the Python code will convert the
initiator list automatically. If the list contains invalid initiator
addresses the python code will raise an exception and the C code will
return NULL on the new record create. The ambiguity in the C API
can be avoided if the caller validates their initiator id(s) before
creating a new access group record.

Both C and Python API have a single new public function added which
can be used to verify an initiator id.

Python:
def initiator_id_verify(init_id, init_type=None, raise_exception=False):
"""
Public method which can be used to verify an initiator id
:param init_id:
:param init_type:
:param raise_exception: Will throw a LsmError INVALID_ARGUMENT if
not a valid initiator address
:return:(Bool, init_type, init_id) Note: init_id will be returned in
normalized format if it's a WWPN
"""
C:
/**
* Checks to see if initiator id is valid
* @param init_id Initiator value
* @param init_type Type of initiator id, will get modified
* to determined if type passed in is UNKNOWN
* @return LSM_ERR_OK if initiator id is OK, else LSM_INVALID_ARGUMENT
*/
int LSM_DLL_EXPORT lsm_initiator_id_verify( const char *init_id,
lsm_access_group_init_type *init_type);

V2: Fix convert from lsm to smis for wwpn

Signed-off-by: Tony Asleson <tasleson@redhat.com>

Tony Asleson Tony Asleson 2014-08-11

changed c_binding
changed c_binding/include
changed c_binding/include/libstoragemgmt
changed c_binding/include/libstoragemgmt/libstoragemgmt_common.h
changed c_binding/lsm_datatypes.cpp
changed c_binding/lsm_datatypes.hpp
changed c_binding/lsm_mgmt.cpp
changed plugin
changed plugin/smispy
changed plugin/smispy/smis.py
changed python_binding
changed python_binding/lsm
changed python_binding/lsm/_client.py
changed python_binding/lsm/_data.py
changed tools
changed tools/lsmcli
changed tools/lsmcli/cmdline.py
c_binding
Directory.
c_binding/include
Directory.
c_binding/include/libstoragemgmt/libstoragemgmt_common.h Diff Switch to side-by-side view
Loading...
c_binding/lsm_datatypes.cpp Diff Switch to side-by-side view
Loading...
c_binding/lsm_datatypes.hpp Diff Switch to side-by-side view
Loading...
c_binding/lsm_mgmt.cpp Diff Switch to side-by-side view
Loading...
plugin
Directory.
plugin/smispy
Directory.
plugin/smispy/smis.py Diff Switch to side-by-side view
Loading...
python_binding
Directory.
python_binding/lsm
Directory.
python_binding/lsm/_client.py Diff Switch to side-by-side view
Loading...
python_binding/lsm/_data.py Diff Switch to side-by-side view
Loading...
tools
Directory.
tools/lsmcli
Directory.
tools/lsmcli/cmdline.py Diff Switch to side-by-side view
Loading...