Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/mellanox_firmware.cpython-36.opt-1.pyc

3

�f��@s6ddlZddlZddlmZmZGdd�dee�ZdS)�N)�Plugin�IndependentPluginc@s8eZdZdZdZdZdZdZdd	�Zd
d�Z	dd
�Z
dS)�MellanoxFirmwarez&Nvidia(Mellanox) firmware tools outputZmellanox_firmware�hardware�system�mst�mstflintzMellanox TechnologiescCs$|jd�}|ddko"|j|dkS)z�
        Checks if this plugin should be executed at all.
        We will only enable the plugin if there is a
        Mellanox Technologies network adapter
        zlspci -D -d 15b3::0200�statusr�output)�exec_cmd�MLNX_STRING)�selfZlspci�r�'/usr/lib/python3.6/mellanox_firmware.py�
check_enableds
zMellanoxFirmware.check_enabledcCs�|jd�s|jd�dS|jd�}|ddkr2dS|jd�}|ddkrLdS|jd�|jdd	d
�|jdd	d
�tjd�}g}x|D]}d
|kr�|j|�q�Wx8|D]0}|jd|�d�d	d
�|jd|�d�d	d
�q�W|jddd�dS)NZallow_system_changesztSkipping mst/mlx cable commands as system changeswould be made. Use --allow-system-changes toenable this collection.zflint --versionr	rz	mst startz
mst cable addz
mst status -v�
)�timeout�	mlxcablesz/dev/mstZcablez
mlxcables -d z --DDMz --dumpzmst stopT)Zchanges)Z
get_optionZ	_log_infor�collect_cmd_output�os�listdir�append)r
�coutr�deviceZmlxcablerrr�collect#s.







zMellanoxFirmware.collectc		Cs2g}|jd�}|ddkrdSx*|dj�D]}|j|dd�d�q,Wt|�}g}|jd�}|ddkr�dd	gd
dgd
dgd
dgddgg}n.ddgdd	gddgddgddgddgddgg}xn|D]f}x2|D]*}|j|d�d|�d|d��dd�q�Wx,td�D] }|jd|���tjd��qWq�WdS)Nzlspci -D -d 15b3::0200r	rr
�z00.0zflint --versionz
mstconfig -d z -e qzmstflint -d z dcz qz
mstreg -d z --reg_name ROCE_ACCL --getzmstlink -d �zmlxdump -d z pcie_uc --allz	flint -d z
mlxreg -d zmlxlink -d zfwtrace -d z -i all --tracer_mode FIFO� ��)r�zmstdump )	r�
splitlinesr�setrZadd_cmd_output�range�timeZsleep)	r
ZdevicesZdevice_list�lineZcommandsrrZcommand�_rrr�setupCs:




zMellanoxFirmware.setupN)rr)rr)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesZpackagesrrrr'rrrrrs	 r)rr$Zsos.report.pluginsrrrrrrr�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists