Hi Gris, Sorry, I forgot to ask this before, but why are you making changes to support megaraid SMI-S provider when we now have a specific plugin for them?
Thanks, Tony On 03/14/2015 08:04 AM, Gris Ge wrote: > * 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. > > Signed-off-by: Gris Ge <f...@redhat.com> > --- > plugin/smispy/smis_disk.py | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > > diff --git a/plugin/smispy/smis_disk.py b/plugin/smispy/smis_disk.py > index 6b476f1..0321bd1 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): > @@ -173,11 +174,34 @@ def cim_disk_to_lsm_disk(smis_common, cim_disk): > """ > # CIM_DiskDrive does not have disk size information. > # We have to find out the Primordial CIM_StorageExtent for that. > + # The 'StoragePool_InstanceID' is for LSI MegaRAID only. > cim_ext = _pri_cim_ext_of_cim_disk( > smis_common, cim_disk.path, > - property_list=['BlockSize', 'NumberOfBlocks']) > + property_list=[ > + 'BlockSize', 'NumberOfBlocks', 'StoragePool_InstanceID']) > > status = _disk_status_of_cim_disk(cim_disk) > + # Check spare disk, LSI MegaRAID use dedicate spare 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.is_megaraid(): > + # Dirty hack: > + # On LSI MegaRAID, free or spare disks will assigned to a internal > + # storage pool with instance ID like '500605B002884430_SASHDD' > + # In stread of find out all valid storage pool, we just > + # assume valid pool of LSI holds 'Pool' keywords in DeviceID. > + if 'Pool' not in cim_ext['StoragePool_InstanceID']: > + # Check spare disk, LSI MegaRAID use dedicate spare disk. > + if not status & Disk.STATUS_SPARE_DISK: > + status |= Disk.STATUS_FREE > + > + elif '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 > ------------------------------------------------------------------------------ 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