o
    O6uf  ã                   @   s2   d dl Z d dlmZmZmZ G dd„ deeƒZdS )é    N)ÚPluginÚIndependentPluginÚ	PluginOptc                   @   s<   e Zd ZdZdZdZdZedddd�gZd	d
„ Z	dd„ Z
dS )ÚDlmzDLM (Distributed lock manager)Údlm)Úcluster)Úcmanr   Ú	pacemakerÚlockdumpFzcapture lock dumps for DLM)ÚdefaultÚdescc                 C   s4   |   dg¡ |  g d¢¡ |  d¡r|  ¡  d S d S )Nz/etc/sysconfig/dlm)zdlm_tool log_plockzdlm_tool dumpzdlm_tool ls -nr
   )Úadd_copy_specÚadd_cmd_outputÚ
get_optionÚdo_lockdump)Úself© r   ú8/usr/lib/python3/dist-packages/sos/report/plugins/dlm.pyÚsetup   s   ÿ
ÿz	Dlm.setupc                 C   sd   d}|   |¡}|d dkrdS d}t |tj¡}| |d ¡D ]}| jd|› d�d	|› �d
� qdS )z Do dlm lock dumps zdlm_tool lsÚstatusr   Nz^name\s+([^\s]+)$Úoutputzdlm_tool lockdebug -svw 'ú'Ú
dlm_locks_)Úsuggest_filename)Úcollect_cmd_outputÚreÚcompileÚ	MULTILINEÚfindallr   )r   Údlm_toolÚresultÚlock_expÚlock_reÚ	lockspacer   r   r   r   $   s   

þÿzDlm.do_lockdumpN)Ú__name__Ú
__module__Ú__qualname__Ú
short_descÚplugin_nameÚprofilesÚpackagesr   Úoption_listr   r   r   r   r   r   r      s    ÿr   )r   Úsos.report.pluginsr   r   r   r   r   r   r   r   Ú<module>   s   