sasutils
sasutils copied to clipboard
sas_mpath_snic_alias AttributeError: 'NoneType' object has no attribute 'enclosure'
sas_mpath_snic_alias seems to depend on all subdevices of a multipath dm entry having an enclosure_device symlink in /sys/block/dm-37/slaves/*/device. There are some cases where this doesn't happen due to a bug in the ses driver (seemingly when you have multipath split between multiple hbas and jbod controllers). I have a ticket open with our OS vendor to hopefully address this, but I've been looking into ways to work around it in the mean time.
If you run sas_mpath_snic_alias on in impacted host you get the following
[root@host ~]# sas_mpath_snic_alias dm-6
Traceback (most recent call last):
File "/usr/bin/sas_mpath_snic_alias", line 11, in <module>
load_entry_point('sasutils==0.6.1', 'console_scripts', 'sas_mpath_snic_alias')()
File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_mpath_snic_alias.py", line 97, in main
result = sas_mpath_snic_alias(sys.argv[1])
File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_mpath_snic_alias.py", line 63, in sas_mpath_snic_alias
ses_sg = blkdev.scsi_device.array_device.enclosure.scsi_generic.sg_name
AttributeError: 'NoneType' object has no attribute 'enclosure'
from https://github.com/stanford-rc/sasutils/blob/fd8e57de6b1a15b0b7ea219ed5c440fb64ed4d30/sasutils/cli/sas_mpath_snic_alias.py#L63
I think it's safe to alter the code in sas_mpath_snic.alias.py to be
try:
ses_sg = blkdev.scsi_device.array_device.enclosure.scsi_generic.sg_name
except AttributeError:
# due to ses driver issue not every devicemapper node may have an enclosure populated
continue
but I'm not super familiar with the code base to be completely certain of that.