* Using SNIA SMI-S 1.4 'Disk Sparing' profile to set Disk.STATUS_SPARE_DISK.
   # Works well on EMC VMAX, Fujitsu ETERNUS, LSI MegaRAID.
   # They are only array have spare disks I got access.

 * Use vendor specific way to set Disk.STATUS_FREE:
    1. EMC:
        'EMCInUse' property of CIM_DiskDrive. False == Free.
       # Tested on EMC VNX.

    2. LSI MegaRAID:
        StoragePool_InstanceID of CIM_StorageExtent,
        if not contain 'Pool' keyword, it could be free disk or spare disk.
        Then filter out spare disk, we got free disks.
       # Tested on LSI MegaRAID.

Changes in V4(No changes in V2, V3):

 * Remove LSI MegaRAID free disk code as we have dedicated plugin for
   MegaRAID.

Signed-off-by: Gris Ge <f...@redhat.com>
---
 plugin/smispy/smis_disk.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/plugin/smispy/smis_disk.py b/plugin/smispy/smis_disk.py
index 6b476f1..e5bd5ea 100644
--- a/plugin/smispy/smis_disk.py
+++ b/plugin/smispy/smis_disk.py
@@ -77,10 +77,11 @@ def cim_disk_pros():
     """
     Return all CIM_DiskDrive Properties needed to create a Disk object.
     The 'Type' and 'MediaType' is only for MegaRAID.
+    The 'EMCInUse' is only for EMC.
     """
     return ['OperationalStatus', 'Name', 'SystemName',
             'Caption', 'InterconnectType', 'DiskType', 'DeviceID',
-            'Type', 'MediaType']
+            'Type', 'MediaType', 'EMCInUse']
 
 
 def sys_id_of_cim_disk(cim_disk):
@@ -178,6 +179,15 @@ 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 'EMCInUse' in cim_disk.keys() and cim_disk['EMCInUse'] is False:
+        status |= Disk.STATUS_FREE
+
     name = ''
     block_size = Disk.BLOCK_SIZE_NOT_FOUND
     num_of_block = Disk.BLOCK_COUNT_NOT_FOUND
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libstoragemgmt-devel mailing list
Libstoragemgmt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libstoragemgmt-devel

Reply via email to