* Add dmtf.OP_STATUS_DORMANT support, treat it as Pool.STATUS_STOPPED.
* Change dmtf._op_status_to_str() to public as dmtf.op_status_to_str().
* Change dmtf.op_status_to_str() to return raw number in string if not common
know value.
* Only check the primary(first) value of CIM_StoragePool['OperationalStatus'].
* Put extra OperationalStatus into status_info.
* Tested on all hardwares I found, got no extra OperationalStatus.
Signed-off-by: Gris Ge <fge(a)redhat.com>
---
plugin/smispy/dmtf.py | 8 ++++----
plugin/smispy/smis_pool.py | 21 +++++++++++++++++++--
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index f3fe91a..249d5f6 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -156,15 +156,15 @@
}
-def _op_status_to_str(dmtf_op_status):
+def op_status_to_str(dmtf_op_status):
"""
Just convert integer to string. NOT ALLOWING provide a list.
- Return emtpy string is not found.
+ Return a string containing the raw number if not found.
"""
try:
return _OP_STATUS_STR_CONV[dmtf_op_status]
except KeyError:
- return ''
+ return '%d' % dmtf_op_status
def op_status_list_conv(conv_dict, dmtf_op_status_list,
@@ -177,7 +177,7 @@ def op_status_list_conv(conv_dict, dmtf_op_status_list,
else:
if dmtf_op_status in _OP_STATUS_STR_CONV.keys():
status |= other_value
- status_info_list.append(_op_status_to_str(dmtf_op_status))
+ status_info_list.append(op_status_to_str(dmtf_op_status))
continue
if status == 0:
status = unknown_value
diff --git a/plugin/smispy/smis_pool.py b/plugin/smispy/smis_pool.py
index cb06867..52fbade 100644
--- a/plugin/smispy/smis_pool.py
+++ b/plugin/smispy/smis_pool.py
@@ -189,17 +189,34 @@ def _pool_element_type(smis_common, cim_pool):
dmtf.OP_STATUS_DEGRADED: Pool.STATUS_DEGRADED,
dmtf.OP_STATUS_NON_RECOVERABLE_ERROR: Pool.STATUS_ERROR,
dmtf.OP_STATUS_SUPPORTING_ENTITY_IN_ERROR: Pool.STATUS_ERROR,
+ dmtf.OP_STATUS_DORMANT: Pool.STATUS_STOPPED,
}
def _pool_status_of_cim_pool(dmtf_op_status_list):
"""
Convert CIM_StoragePool['OperationalStatus'] to LSM
+ As SMI-S 1.6 block book section 5.2.1 'StoragePool OperationalStatus'
+ indicate, we only check primary OperationalStatus here, if additional
+ OperationalStatus found, we add it to status_info.
"""
- return dmtf.op_status_list_conv(
- _LSM_POOL_OP_STATUS_CONV, dmtf_op_status_list,
+ if len(dmtf_op_status_list) == 0:
+ raise LsmError(
+ ErrorNumber.PLUGIN_BUG,
+ "Got empty OperationalStatus")
+
+ lsm_status, status_info = dmtf.op_status_list_conv(
+ _LSM_POOL_OP_STATUS_CONV, [dmtf_op_status_list[0]],
Pool.STATUS_UNKNOWN, Pool.STATUS_OTHER)
+ if len(dmtf_op_status_list) > 1:
+ extra_status_str_list = [dmtf.op_status_to_str(x)
+ for x in dmtf_op_status_list[1:]]
+ status_info += " Extra OperationalStatus: %s" % \
+ " ".join(extra_status_str_list)
+
+ return lsm_status, status_info
+
def cim_pool_to_lsm_pool(smis_common, cim_pool, system_id):
"""
--
1.8.3.1