Discussion:
[PATCH 1/3] SMI-S Plugin: Check support of 'Disk Sparing' profile before call CIM_IsSpare
Gris Ge
2015-04-02 13:51:31 UTC
Permalink
* In disks() method, check 'Disk Sparing' 1.4+ before call CIM_IsSpare
association.
This fix the disks() on HP 3PAR which does not support CIM_IsSpare yet.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis_common.py | 1 +
plugin/smispy/smis_disk.py | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 2129ac8..b0acce8 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -165,6 +165,7 @@ class SmisCommon(object):
SNIA_GROUP_MASK_PROFILE = 'Group Masking and Mapping'
SNIA_FC_TGT_PORT_PROFILE = 'FC Target Ports'
SNIA_ISCSI_TGT_PORT_PROFILE = 'iSCSI Target Ports'
+ SNIA_SPARE_DISK_PROFILE = 'Disk Sparing'
SMIS_SPEC_VER_1_4 = '1.4'
SMIS_SPEC_VER_1_5 = '1.5'
SMIS_SPEC_VER_1_6 = '1.6'
diff --git a/plugin/smispy/smis_disk.py b/plugin/smispy/smis_disk.py
index e5bd5ea..9fd94e0 100644
--- a/plugin/smispy/smis_disk.py
+++ b/plugin/smispy/smis_disk.py
@@ -18,6 +18,8 @@
from lsm import Disk, md5, LsmError, ErrorNumber
import dmtf
from utils import merge_list
+from pywbem import CIM_ERR_NOT_FOUND, CIM_ERR_INVALID_PARAMETER
+from lsm.plugin.smispy.smis_common import SmisCommon


_LSM_DISK_OP_STATUS_CONV = {
@@ -179,11 +181,14 @@ def cim_disk_to_lsm_disk(smis_common, cim_disk):
property_list=['BlockSize', 'NumberOfBlocks'])

status = _disk_status_of_cim_disk(cim_disk)
- cim_srss = smis_common.AssociatorNames(
- cim_ext.path, AssocClass='CIM_IsSpare',
- ResultClass='CIM_StorageRedundancySet')
- if len(cim_srss) >= 1:
- status |= Disk.STATUS_SPARE_DISK
+ if smis_common.profile_check(SmisCommon.SNIA_SPARE_DISK_PROFILE,
+ SmisCommon.SMIS_SPEC_VER_1_4,
+ raise_error=False):
+ cim_srss = smis_common.AssociatorNames(
+ cim_ext.path, AssocClass='CIM_IsSpare',
+ ResultClass='CIM_StorageRedundancySet')
+ if len(cim_srss) >= 1:
+ status |= Disk.STATUS_SPARE_DISK

if 'EMCInUse' in cim_disk.keys() and cim_disk['EMCInUse'] is False:
status |= Disk.STATUS_FREE
--
1.8.3.1
Gris Ge
2015-04-02 13:51:32 UTC
Permalink
* The _profile_check() method will keep return True if profile name is found,
no matter whether version equal or bigger. The fix is just adding the
missing 'return False' if version check failed.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis_common.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index b0acce8..7b6924f 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -126,6 +126,8 @@ def _profile_check(profile_dict, profile_name, spec_ver,
(profile_name, spec_ver) +
"target SMI-S provider. Only version %s is supported" %
profile_dict[profile_name])
+ else:
+ return False
return True
--
1.8.3.1
Gris Ge
2015-04-02 13:51:33 UTC
Permalink
* HP 3PAR are supporting multiple iSCSI node bind to same iSCSI
TCP/IP settings(CIM_iSCSIProtocolEndpoint).

Fixed by changing _iscsi_node_name_of() to _iscsi_node_names_of()
to allow multiple CIM_SCSIProtocolController(iSCSI node) of single
CIM_iSCSIProtocolEndpoint. No SNIA document deny or confirm it.
This also introduced the target_ports() support on Dell Compellent Storage
Center.

* HP 3PAR only support '1.2.0' version of 'iSCSI Target' profile.

Fixed by only need 1.1+ version. The download link of SNIA SMI-S 1.2
is broken. By checking SMI-S 1.1, all we required is included.

* EMC VMAX are supporting no iSCSI node bind to existing iSCSI
TCP/IP settings(CIM_iSCSIProtocolEndpoint).

Fixed by allowing empty association from CIM_iSCSIProtocolEndpoint
to CIM_SCSIProtocolController.

* NetApp-E indicates support status of 1.0 'iSCSI Target' and 'FC Target'
profiles.

There is no 'iSCSI Target' or 'FC Target' profiles in SMI-S 1.0.
Override it in SmisCommon.__init__() at plugin_register() stage.

* Tested on all SMI-S providers I have via
lsmenv all lsmcli lt

* Tested on EMC VNX via 'lsmenv vnx plugin_test'.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 55 ++++++++++++++++++++++----------------------
plugin/smispy/smis_cap.py | 13 ++++-------
plugin/smispy/smis_common.py | 12 ++++++++++
3 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 6a165ea..4dc478c 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1531,7 +1531,7 @@ def _cim_fc_tgt_to_lsm(cim_fc_tgt, system_id):
return TargetPort(port_id, port_type, wwpn, wwpn, wwpn, port_name,
system_id, plugin_data)

- def _iscsi_node_name_of(self, cim_iscsi_pg_path):
+ def _iscsi_node_names_of(self, cim_iscsi_pg_path):
"""
CIM_iSCSIProtocolEndpoint
|
@@ -1542,7 +1542,6 @@ def _iscsi_node_name_of(self, cim_iscsi_pg_path):
|
v
CIM_SCSIProtocolController # iSCSI Node
-
"""
cim_spcs = self._c.Associators(
cim_iscsi_pg_path,
@@ -1559,16 +1558,8 @@ def _iscsi_node_name_of(self, cim_iscsi_pg_path):
cim_iscsi_nodes.extend([cim_spc])

if len(cim_iscsi_nodes) == 0:
- raise LsmError(ErrorNumber.PLUGIN_BUG,
- "_iscsi_node_of(): No iSCSI node "
- "CIM_SCSIProtocolController associated to %s"
- % cim_iscsi_pg_path)
- if len(cim_iscsi_nodes) > 1:
- raise LsmError(ErrorNumber.PLUGIN_BUG,
- "_iscsi_node_of(): Got two or more iSCSI node "
- "CIM_SCSIProtocolController associated to %s: %s"
- % (cim_iscsi_pg_path, cim_iscsi_nodes))
- return cim_iscsi_nodes[0]['Name']
+ return []
+ return [n['Name'] for n in cim_iscsi_nodes]

def _cim_iscsi_pg_of(self, cim_sys_path, property_list=None):
"""
@@ -1633,7 +1624,10 @@ def _cim_iscsi_pg_to_lsm(self, cim_iscsi_pg, system_id):
"_cim_iscsi_pg_to_lsm(): "
"No CIM_TCPProtocolEndpoint associated to %s"
% cim_iscsi_pg.path)
- iscsi_node_name = self._iscsi_node_name_of(cim_iscsi_pg.path)
+ iscsi_node_names = self._iscsi_node_names_of(cim_iscsi_pg.path)
+
+ if len(iscsi_node_names) == 0:
+ return []

for cim_tcp in cim_tcps:
tcp_port = cim_tcp['PortNumber']
@@ -1704,13 +1698,17 @@ def _cim_iscsi_pg_to_lsm(self, cim_iscsi_pg, system_id):

if ipv4_addr:
network_address = "%s:%s" % (ipv4_addr, tcp_port)
- port_id = md5("%s:%s:%s" % (mac_address,
- network_address,
- iscsi_node_name))
+
rc.extend(
- [TargetPort(port_id, port_type, iscsi_node_name,
- network_address, mac_address,
- port_name, system_id, plugin_data)])
+ [TargetPort(
+ md5(
+ "%s:%s:%s" % (
+ mac_address, network_address,
+ iscsi_node_name)),
+ port_type, iscsi_node_name,
+ network_address, mac_address, port_name,
+ system_id, plugin_data)
+ for iscsi_node_name in iscsi_node_names])
if ipv6_addr:
# DMTF or SNIA did defined the IPv6 string format.
# we just guess here.
@@ -1721,13 +1719,16 @@ def _cim_iscsi_pg_to_lsm(self, cim_iscsi_pg, system_id):
ipv6_addr, 32, 4)

network_address = "[%s]:%s" % (ipv6_addr, tcp_port)
- port_id = md5("%s:%s:%s" % (mac_address,
- network_address,
- iscsi_node_name))
- rc.extend(
- [TargetPort(port_id, port_type, iscsi_node_name,
- network_address, mac_address,
- port_name, system_id, plugin_data)])
+ rc.extend([
+ TargetPort(
+ md5(
+ "%s:%s:%s" % (
+ mac_address, network_address,
+ iscsi_node_name)),
+ port_type, iscsi_node_name,
+ network_address, mac_address, port_name,
+ system_id, plugin_data)
+ for iscsi_node_name in iscsi_node_names])
return rc

def _leaf_cim_syss_path_of(self, cim_sys_path):
@@ -1783,7 +1784,7 @@ def target_ports(self, search_key=None, search_value=None, flags=0):
"these profiles: '%s %s', '%s %s'"
% (SmisCommon.SMIS_SPEC_VER_1_4,
SmisCommon.SNIA_FC_TGT_PORT_PROFILE,
- SmisCommon.SMIS_SPEC_VER_1_4,
+ SmisCommon.SMIS_SPEC_VER_1_1,
SmisCommon.SNIA_ISCSI_TGT_PORT_PROFILE))

if flag_fc_support:
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 23a3449..f42ce94 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -248,10 +248,7 @@ def _tgt_cap_set(smis_common, cim_sys_path, cap):
return

flag_fc_support = fc_tgt_is_supported(smis_common)
- flag_iscsi_support = smis_common.profile_check(
- SmisCommon.SNIA_ISCSI_TGT_PORT_PROFILE,
- SmisCommon.SMIS_SPEC_VER_1_4,
- raise_error=False)
+ flag_iscsi_support = iscsi_tgt_is_supported(smis_common)

if flag_fc_support or flag_iscsi_support:
cap.set(Capabilities.TARGET_PORTS)
@@ -311,12 +308,12 @@ def fc_tgt_is_supported(smis_common):

def iscsi_tgt_is_supported(smis_common):
"""
- Return True if FC Target Port 1.4+ profile is supported.
+ Return True if FC Target Port 1.1+ profile is supported.
We use CIM_iSCSIProtocolEndpoint as it's a start point we are
using in our code of target_ports().
"""
if smis_common.profile_check(SmisCommon.SNIA_ISCSI_TGT_PORT_PROFILE,
- SmisCommon.SMIS_SPEC_VER_1_4,
+ SmisCommon.SMIS_SPEC_VER_1_1,
raise_error=False):
return True
return False
@@ -324,12 +321,12 @@ def iscsi_tgt_is_supported(smis_common):

def multi_sys_is_supported(smis_common):
"""
- Return True if Multiple ComputerSystem 1.4+ profile is supported.
+ Return True if Multiple ComputerSystem 1.1+ profile is supported.
Return False else.
"""
flag_multi_sys_support = smis_common.profile_check(
SmisCommon.SNIA_MULTI_SYS_PROFILE,
- SmisCommon.SMIS_SPEC_VER_1_4,
+ SmisCommon.SMIS_SPEC_VER_1_1,
raise_error=False)
if flag_multi_sys_support:
return True
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 7b6924f..f4bd024 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -168,6 +168,7 @@ class SmisCommon(object):
SNIA_FC_TGT_PORT_PROFILE = 'FC Target Ports'
SNIA_ISCSI_TGT_PORT_PROFILE = 'iSCSI Target Ports'
SNIA_SPARE_DISK_PROFILE = 'Disk Sparing'
+ SMIS_SPEC_VER_1_1 = '1.1'
SMIS_SPEC_VER_1_4 = '1.4'
SMIS_SPEC_VER_1_5 = '1.5'
SMIS_SPEC_VER_1_6 = '1.6'
@@ -232,6 +233,17 @@ def __init__(self, url, username, password,

if namespace.lower() == SmisCommon._NETAPP_E_NAMESPACE.lower():
self._vendor_product = SmisCommon._PRODUCT_NETAPP_E
+ # NetApp-E indicates they support 1.0 version of FC/iSCSI target
+ # But 1.0 does not define thoese profiles. Forcly change
+ # support version to 1.4
+ self._profile_dict[SmisCommon.SNIA_FC_TGT_PORT_PROFILE] = \
+ SmisCommon.SMIS_SPEC_VER_1_4
+ self._profile_dict[SmisCommon.SNIA_ISCSI_TGT_PORT_PROFILE] = \
+ SmisCommon.SMIS_SPEC_VER_1_4
+ # NetApp-E indicates support of Mask and Mapping 1.2. But
+ # SNIA website link for 1.2 broken. Change it to 1.4.
+ self._profile_dict[SmisCommon.SNIA_MASK_PROFILE] = \
+ SmisCommon.SMIS_SPEC_VER_1_4

# Check 'Array' 1.4 support status.
_profile_check(
--
1.8.3.1
Tony Asleson
2015-04-02 18:20:32 UTC
Permalink
Hi Gris,

Tests look better in the lab!

github branch merged for this patch set!


Thanks,
Tony
Post by Gris Ge
* In disks() method, check 'Disk Sparing' 1.4+ before call CIM_IsSpare
association.
This fix the disks() on HP 3PAR which does not support CIM_IsSpare yet.
---
plugin/smispy/smis_common.py | 1 +
plugin/smispy/smis_disk.py | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 2129ac8..b0acce8 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
SNIA_GROUP_MASK_PROFILE = 'Group Masking and Mapping'
SNIA_FC_TGT_PORT_PROFILE = 'FC Target Ports'
SNIA_ISCSI_TGT_PORT_PROFILE = 'iSCSI Target Ports'
+ SNIA_SPARE_DISK_PROFILE = 'Disk Sparing'
SMIS_SPEC_VER_1_4 = '1.4'
SMIS_SPEC_VER_1_5 = '1.5'
SMIS_SPEC_VER_1_6 = '1.6'
diff --git a/plugin/smispy/smis_disk.py b/plugin/smispy/smis_disk.py
index e5bd5ea..9fd94e0 100644
--- a/plugin/smispy/smis_disk.py
+++ b/plugin/smispy/smis_disk.py
@@ -18,6 +18,8 @@
from lsm import Disk, md5, LsmError, ErrorNumber
import dmtf
from utils import merge_list
+from pywbem import CIM_ERR_NOT_FOUND, CIM_ERR_INVALID_PARAMETER
+from lsm.plugin.smispy.smis_common import SmisCommon
_LSM_DISK_OP_STATUS_CONV = {
property_list=['BlockSize', 'NumberOfBlocks'])
status = _disk_status_of_cim_disk(cim_disk)
- cim_srss = smis_common.AssociatorNames(
- cim_ext.path, AssocClass='CIM_IsSpare',
- ResultClass='CIM_StorageRedundancySet')
- status |= Disk.STATUS_SPARE_DISK
+ if smis_common.profile_check(SmisCommon.SNIA_SPARE_DISK_PROFILE,
+ SmisCommon.SMIS_SPEC_VER_1_4,
+ cim_srss = smis_common.AssociatorNames(
+ cim_ext.path, AssocClass='CIM_IsSpare',
+ ResultClass='CIM_StorageRedundancySet')
+ status |= Disk.STATUS_SPARE_DISK
status |= Disk.STATUS_FREE
Loading...