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__/gluster.cpython-36.pyc

3

�fo�@sBddlZddlZddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�RedHatPlugin�	PluginOptc@sLeZdZdZdZdZdZdZdZe	d
ddd
�gZ
dd�Zdd�Zdd�Z
dS)�GlusterzGlusterFS storageZgluster�storage�virtz/run/gluster�	glusterfs�glusterfs-core�
/etc/glusterd�/var/lib/glusterd�dumpFzenable glusterdump support)�defaultZdescc	
s�d}�fdd��j|�D�}xb|D]Z}|d}�j||�}d
}x<|dkrzt|ddd��}|j�d}|jd�}Wd	QRXq@Wq"Wd	S)
z Wait until state dump is done rcsg|]}�j|�r|�qS�)Zpath_isfile)�.0�f)�selfr�/usr/lib/python3.6/gluster.py�
<listcomp>"sz.Gluster.wait_for_statedump.<locals>.<listcomp>��rzUTF-8)�encodingZ
DUMP_END_TIMEN���rr)�listdirZ	path_join�open�	readlines�count)	rZname_dirZstatedumps_presentZstatedump_entriesZstatedump_fileZ_spath�retZsfile�	last_liner)rr�wait_for_statedumps

zGluster.wait_for_statedumpcCsv|jd�rr|j|j�sdSyBtj|jd�}|jtj|jd��x|D]}tj|�qHWWntk
rpYnXdS)Nrz/*.dump.[0-9]*z/glusterd_state_[0-9]*_[0-9]*)�
get_option�path_exists�
statedump_dir�glob�extend�os�remove�OSError)rZremove_files�namerrr�postproc-s


zGluster.postprocc
Cs�|jd�|jd�|jddd�|jd�|jddd�|jd	d
ddd
ddgtjd��|jd�sx|jdddg�n
|jd�|jd��r$|j|j�r�d}|j|�ddkr�tj	d�|j
|j�|j|j�q�|jjd�n|jj
d|j�|jd�}|ddk�r$|dj�d-}|j|�|jdd d�}|ddk�r�xx|dj�D]h}|jd!��sb�qN|d"d�}|jd#|d$|d%|d&|d'|d(|d)|d*|d+|d,|g
��qNWdS).Nz,/var/lib/glusterd/geo-replication/secret.pemz6/var/lib/glusterd/glusterfind/glusterfind_*_secret.pemzgluster peer statusZgluster_peer_status)Ztagszgluster pool listzgluster volume statusZgluster_v_statusz/etc/redhat-storage-releasez/etc/swift/z/etc/glusterd.rpmsavez/etc/glusterfsz/var/lib/glusterd/z(/run/gluster/shared_storage/nfs-ganesha/z$/var/lib/glusterd/glusterfind/.keys/z/run/gluster/*tier-dht/*Zall_logsz/var/log/glusterfs/*logz/var/log/glusterfs/*/*logz)/var/log/glusterfs/geo-replication/*/*logz/var/log/glusterfsrz+killall -USR1 glusterfs glusterfsd glusterdZstatusrrz6could not send SIGUSR1 to glusterfs/glusterd processesz4Unable to generate statedumps, no such directory: %szgluster get-state�outputzgluster volume infoZgluster_v_infozVolume Name:�zgluster volume get %s allz(gluster volume geo-replication %s statuszgluster volume heal %s infoz'gluster volume heal %s info split-brainz gluster volume status %s clientszgluster snapshot list %szgluster volume quota %s listz"gluster volume rebalance %s statuszgluster snapshot info %szgluster snapshot status %sr)Zadd_forbidden_pathZadd_cmd_outputZ
add_copy_specr"rr r!Zexec_cmd�timeZsleeprZsoslog�infoZwarning�splitZcollect_cmd_output�
splitlines�
startswith)rZ
statedump_cmd�stateZ
state_fileZ
volume_cmd�lineZvolnamerrr�setup:sl







z
Gluster.setupN)rr)rr	)r
r)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr!Zpackages�filesrZoption_listrr(r2rrrrrs
r)r"r$r+Zsos.report.pluginsrrrrrrrr�<module>	s

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