Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/collector/clusters/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/collector/clusters/__pycache__/pacemaker.cpython-310.pyc
o

i��d:�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�Cluster)�
parse_version)�ElementTreec@sFeZdZdZdgZdZdZgd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
S)�	pacemakerz+Pacemaker High Availability Cluster Manager)rT))�onlineTzCollect nodes listed as online)�offlineTzCollect nodes listed as offline)�
only-corosyncFz)Only use corosync.conf to enumerate nodesc
Cs�g|_z.|�d�s)z|��Wnty(}z
|�d|�WYd}~nd}~ww|js0|��WntyJ}z
|�d|�WYd}~nd}~wwdd�|jD�}|r_|�dd�|��|jS)NrzJFalling back to sourcing corosync.conf. Could not parse crm_mon output: %sz*Could not determine nodes from cluster: %scSsg|]}d|vr|�qS)�.�)�.0�nr
r
�B/usr/lib/python3/dist-packages/sos/collector/clusters/pacemaker.py�
<listcomp>/sz'pacemaker.get_nodes.<locals>.<listcomp>z�WARNING: Node addresses '%s' may not resolve locally if you are not running on a node in the cluster. Try using option '-c pacemaker.only-corosync' if these connections fail.�,)�nodes�
get_option�get_nodes_from_crm�	Exception�log_warn�get_nodes_from_corosync�	log_error�join)�self�err�_shortsr
r
r
�	get_nodess4
��������zpacemaker.get_nodescCs�d}|�d�}|ddkr%|d��d�d�d}t|�td�ks$d	}nd
S|jd|dd
�}|ddkr?|�|d�d
Sd
S)zG
        Try to parse crm_mon output for node list and status.
        z--output-as=xmlzcrm_mon --version�statusr�output��-z2.0.3z--as-xmlNz crm_mon --one-shot --inactive %sT)�	need_root)�exec_primary_cmd�splitr�
parse_crm_xml)r�xmlopt�_ver�cver�_outr
r
r
r9s
���zpacemaker.get_nodes_from_crmcCsvt�|�}|�d�}|D],}|j}|�d�r%|ddkr%|j�|d�q|�d�r8|ddkr8|j�|d�qdS)zA
        Parse the xml output string provided by crm_mon
        rr�true�namer�falseN)r�
fromstring�find�attribrr�append)r�	xmlstring�_xmlr�node�_noder
r
r
r#Ms

��zpacemaker.parse_crm_xmlcCsD|�d�|j�d�}t�d|�}|D]}|j�|d���qdS)z�
        As a fallback measure, read corosync.conf to get the node list. Note
        that this prevents us from separating online nodes from offline nodes.
        z_WARNING: unable to distinguish online nodes from offline nodes when sourcing from corosync.confz/etc/corosync/corosync.confz((\sring0_addr:)(.*))���N)r�primary�	read_file�re�findallrr.�strip)r�ccrr1r
r
r
rZs
�z!pacemaker.get_nodes_from_corosyncN)�__name__�
__module__�__qualname__�cluster_name�sos_plugins�packages�strict_node_list�option_listrrr#rr
r
r
r
rs
r)r6�sos.collector.clustersr�
sos.utilitiesr�	xml.etreerrr
r
r
r
�<module>s



Spamworldpro Mini