https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
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

-�_g>�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�ElementTree)�Cluster)�sos_parse_versionc@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|js1|��WntyL}z|�d|���WYd}~nd}~wwdd�|jD�}|rc|�dd�|��d��|jS)	NrzHFalling back to sourcing corosync.conf. Could not parse crm_mon output: z(Could not determine nodes from cluster: cSsg|]}d|vr|�qS)�.�)�.0�nr
r
�B/usr/lib/python3/dist-packages/sos/collector/clusters/pacemaker.py�
<listcomp>/sz'pacemaker.get_nodes.<locals>.<listcomp>zWARNING: Node addresses '�,z�' 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_nodess0
�������zpacemaker.get_nodescCs�d}|�d�}|ddkr%|d��d�d�d}t|�td�kr$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-xmlNzcrm_mon --one-shot --inactive T)�	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�	xml.etreer�sos.collector.clustersr�
sos.utilitiesrrr
r
r
r
�<module>s



https://t.me/RX1948 - 2025