* Use 'storcli /c0/v1 show all' command line output to determine RAID type, strip size and disk count.
* Calculate optimal I/O size by strip size multiple with RAID data(not mirrot, not parity) disks count. * Tested query on RAID 0, 1, 5, 10, 50. * Tested the optimal I/O size on RAID 5: [root@storageqe-08 ~]# lsmenv mega lsmcli vri --vol SV03403550:VD1 Device alias: mega URI: megaraid:// lsmcli vri --vol SV03403550:VD1 Volume ID | RAID Type | Strip Size | Extent Count | Minimum I/O Size | Optimal I/O Size -------------------------------------------------------------------------------------------- SV03403550:VD1 | RAID5 | 131072 | 5 | 131072 | 524288 Time: 0:00.29 [root@storageqe-08 ~]# dd if=/dev/urandom of=test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes (1.0 GB) copied, 153.174 s, 6.8 MB/s [root@storageqe-08 ~]# dd if=./test.img of=/dev/sdb bs=131072 oflag=direct 8000+0 records in 8000+0 records out 1048576000 bytes (1.0 GB) copied, 58.9573 s, 17.8 MB/s [root@storageqe-08 ~]# dd if=./test.img of=/dev/sdb bs=524288 oflag=direct 2000+0 records in 2000+0 records out 1048576000 bytes (1.0 GB) copied, 37.7282 s, 27.8 MB/s [root@storageqe-08 ~]# dd if=./test.img of=/dev/sdb bs=524288 oflag=direct 2000+0 records in 2000+0 records out 1048576000 bytes (1.0 GB) copied, 35.3351 s, 29.7 MB/s [root@storageqe-08 ~]# dd if=./test.img of=/dev/sdb bs=131072 oflag=direct 8000+0 records in 8000+0 records out 1048576000 bytes (1.0 GB) copied, 70.0779 s, 15.0 MB/s Signed-off-by: Gris Ge <f...@redhat.com> --- plugin/megaraid/megaraid.py | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py index 83abf63..e754cd8 100644 --- a/plugin/megaraid/megaraid.py +++ b/plugin/megaraid/megaraid.py @@ -157,6 +157,33 @@ def _pool_id_of(dg_id, sys_id): return "%s:DG%s" % (sys_id, dg_id) +_RAID_TYPE_MAP = { + 'RAID0': Volume.RAID_TYPE_RAID0, + 'RAID1': Volume.RAID_TYPE_RAID1, + 'RAID5': Volume.RAID_TYPE_RAID5, + 'RAID6': Volume.RAID_TYPE_RAID6, + 'RAID00': Volume.RAID_TYPE_RAID0, + # Some MegaRAID only support max 16 disks in each span. + # To support 16+ disks in on group, MegaRAI has RAID00 or even RAID000. + # All of them are considered as RAID0 + 'RAID10': Volume.RAID_TYPE_RAID10, + 'RAID50': Volume.RAID_TYPE_RAID50, + 'RAID60': Volume.RAID_TYPE_RAID60, +} + + +def _mega_raid_type_to_lsm(vd_basic_info, vd_prop_info): + raid_type = _RAID_TYPE_MAP.get( + vd_basic_info['TYPE'], Volume.RAID_TYPE_UNKNOWN) + + # In LSI, four disks or more RAID1 is actually a RAID10. + if raid_type == Volume.RAID_TYPE_RAID1 and \ + int(vd_prop_info['Number of Drives Per Span']) >= 4: + raid_type = Volume.RAID_TYPE_RAID10 + + return raid_type + + class MegaRAID(IPlugin): _DEFAULT_MDADM_BIN_PATHS = [ "/opt/MegaRAID/storcli/storcli64", "/opt/MegaRAID/storcli/storcli"] @@ -459,3 +486,52 @@ class MegaRAID(IPlugin): vd_pd_info_list, vd_prop_info, key_name)) return search_property(lsm_vols, search_key, search_value) + + @_handle_errors + def volume_raid_info(self, volume, flags=Client.FLAG_RSVD): + if not volume.plugin_data: + raise LsmError( + ErrorNumber.INVALID_ARGUMENT, + "Ilegal input volume argument: missing plugin_data property") + + vd_path = volume.plugin_data + vol_show_output = self._storcli_exec([vd_path, "show", "all"]) + vd_basic_info = vol_show_output[vd_path][0] + vd_id = int(vd_basic_info['DG/VD'].split('/')[-1]) + vd_prop_info = vol_show_output['VD%d Properties' % vd_id] + + raid_type = _mega_raid_type_to_lsm(vd_basic_info, vd_prop_info) + strip_size = _mega_size_to_lsm(vd_prop_info['Strip Size']) + disk_count = ( + int(vd_prop_info['Number of Drives Per Span']) * + int(vd_prop_info['Span Depth'])) + if raid_type == Volume.RAID_TYPE_RAID0: + strip_count = disk_count + elif raid_type == Volume.RAID_TYPE_RAID1: + strip_count = 1 + elif raid_type == Volume.RAID_TYPE_RAID5: + strip_count = disk_count - 1 + elif raid_type == Volume.RAID_TYPE_RAID6: + strip_count = disk_count - 2 + elif raid_type == Volume.RAID_TYPE_RAID50: + strip_count = ( + (int(vd_prop_info['Number of Drives Per Span']) - 1) * + int(vd_prop_info['Span Depth'])) + elif raid_type == Volume.RAID_TYPE_RAID60: + strip_count = ( + (int(vd_prop_info['Number of Drives Per Span']) - 2) * + int(vd_prop_info['Span Depth'])) + elif raid_type == Volume.RAID_TYPE_RAID10: + strip_count = ( + int(vd_prop_info['Number of Drives Per Span']) / 2 * + int(vd_prop_info['Span Depth'])) + else: + # MegaRAID does not support 15 or 16 yet. + raise LsmError( + ErrorNumber.PLUGIN_BUG, + "volume_raid_info(): Got unexpected RAID type: %s" % + vd_basic_info['TYPE']) + + return [ + raid_type, strip_size, disk_count, strip_size, + strip_size * strip_count] -- 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