Opened 12 years ago
Last modified 12 years ago
#252 closed enhancement
add disks on megaraid sas controller to DEVICESCAN — at Version 1
Reported by: | Alex Samorukov | Owned by: | Alex Samorukov |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | all | Version: | 6.0 |
Keywords: | linux, megaraid | Cc: |
Description (last modified by )
I decided to add autoscan functionality for drives on MegaSAS controllers. Main motivation for this was that devices on such controllers having random numbers, from 0 to ~250 and it is very annoying to write smartd configuration (i used shell + MegaCli in the past). There is no ioctl documentation provided, so i did patch based on MegaCli tool behaviour (with strace and LD_PRELAOD for IOCTL) and FreeBSD driver sources which contain similar code. What this patch is doing:
1) In autoscan mode, if megaraid_sas_ioctl is found in /proc/devices it is trying to identify SCSI host number with megasas controllers using sysfs (/sys/class/scsi_host/hostN/proc_name). If sysfs is not mounted it scans first 16 buses. I believe that native tool do the same.
2) If controller is found i am getting device list using driver ioctl and adding them to device list
Code changes:
1) megaraid.h updated to include constant/structures to get drive list
2) set_fd added to linux_smart_device. I need this to override is_open check in megaraid.
3) -d megaraid allows to specify devices in pseudo /dev/bus/N format. We can`t easy get drive name from the bus number, and also it is possible that drive name is not exists at all (unconfigured RAID).
4) Added private functions get_dev_megasas, megasas_dcmd_cmd and megasas_pd_get_list to the linux_smart_interface.
5) I disabled "MegaRAID SAT layer is reportedly buggy" error. Everything was fixed after chk_cond check was added. I am unable to reproduce problem with different hardware.
6) I added set_info().dev_type = strprintf("megaraid,%d", tgt) to set device number in type. Without it --scan will show just -"d megaraid" devices. Not sure if this is correct.
Change History (1)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | new → assigned |