U
    -_g	                     @   s2   d dl m Z  d dlmZmZ G dd deeZdS )    )glob)PluginIndependentPluginc                   @   s$   e Zd ZdZdZdZdZdd ZdS )Scsia  
    Collects various information about the SCSI devices install on the host
    system.

    This plugin will capture a large amount of data from the /sys filesystem,
    as well as several different invocations of the `lsscsi` command.

    Additionally, several `sg_persist` commands will be collected for each
    SCSI device identified by sos. Note that in most cases these commands are
    provided by the `sg3_utils` package which may not be present by default.
    zSCSI devicesZscsi)ZstorageZhardwarec                 C   s   |  dddddddg dg}| d	}|d
 dkrr|d  D ]0}| d |kr@| d }| d|  q@| jdddd | dddddddddg	 td}| jd|d | jdd d!d"gd#d$gd% d S )&Nz
/proc/scsiz/etc/stinit.defz/sys/bus/scsiz/sys/class/scsi_hostz/sys/class/scsi_diskz/sys/class/scsi_devicez/sys/class/scsi_genericZenclosuz	lsscsi -gZstatusr   output   zsg_ses -p2 -b1 z	lsscsi -iZlsscsi)Zsuggest_filenameZtagsz	sg_map -xZlspathz
lsmap -allZlsnportsz	lsscsi -Hz	lsscsi -dz	lsscsi -sz	lsscsi -Lz
lsscsi -iwz/sys/class/scsi_host/*zudevadm info -a %(dev)s)deviceszsg_persist --in -k -d %(dev)szsg_persist --in -r -d %(dev)szsg_persist --in -s -d %(dev)szsg_inq %(dev)sblockzsd.*)r	   Z	whitelist)Zadd_copy_specZcollect_cmd_output
splitlinessplitZadd_cmd_outputr   Zadd_device_cmd)selfZ
scsi_typesresultlineZdevsgZ
scsi_hosts r   9/usr/lib/python3/dist-packages/sos/report/plugins/scsi.pysetup   sR    

 z
Scsi.setupN)__name__
__module____qualname____doc__Z
short_descZplugin_nameZprofilesr   r   r   r   r   r      s
   r   N)r   Zsos.report.pluginsr   r   r   r   r   r   r   <module>	   s   