%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/sos/collector/clusters/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/sos/collector/clusters/__pycache__/pacemaker.cpython-312.pyc

�

i��d:��F�ddlZddlmZddlmZddlmZGd�de�Zy)�N)�Cluster)�
parse_version)�ElementTreec�>�eZdZdZdgZdZdZgd�Zd�Zd�Z	d�Z
d�Zy	)
�	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���g|_	|jd�s	|j�|js|j�|jD�cgc]	}d|vs�|��}}|r#|j	ddj|�z�|jS#t$r}|j	d|z�Yd}~��d}~wwxYw#t$r}|j
d|z�Yd}~��d}~wwxYwcc}w)Nr
zJFalling back to sourcing corosync.conf. Could not parse crm_mon output: %sz*Could not determine nodes from cluster: %s�.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�n�_shortss    �B/usr/lib/python3/dist-packages/sos/collector/clusters/pacemaker.py�	get_nodeszpacemaker.get_nodess�����
�	O��?�?�?�3�N��+�+�-��:�:��,�,�.�#�j�j�9��C�q�L�1�9��9���M�M�J��(�(�7�#�$�
��z�z���%!�N��M�M�#G�IL�#M�N�N��N���	O��N�N�G�#�M�N�N��	O��:sK�C�B�C�	C*�C*�	B=�B8�3C�8B=�=C�	C'�	C"�"C'c�&�d}|jd�}|ddk(rB|dj�djd�d}t|�td�kDsd	}ny
|jd|zd�
�}|ddk(r|j|d�y
y
)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�_outs     rrzpacemaker.get_nodes_from_crm9s���#���$�$�%8�9����>�Q����>�'�'�)�!�,�2�2�3�7��:�D� ��&��w�)?�?�#����$�$�.��7��%�
����>�Q�����t�H�~�.��c�X�tj|�}|jd�}|D]}|j}|j	d�r'|ddk(r|j
j
|d��G|j	d�s�Y|ddk(s�b|j
j
|d���y)zA
        Parse the xml output string provided by crm_mon
        rr�true�namer	�falseN)r�
fromstring�find�attribrr�append)r�	xmlstring�_xmlr�node�_nodes      rr$zpacemaker.parse_crm_xmlMs����%�%�i�0���	�	�'�"���	1�D��K�K�E����x�(�U�8�_��-F��
�
�!�!�%��-�0�����+��h��7�0J��
�
�!�!�%��-�0�	1r)c���|jd�|jjd�}tjd|�}|D].}|j
j
|dj���0y)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�findallrr1�strip)r�ccrr4s    rrz!pacemaker.get_nodes_from_corosyncZsi��
	
�
�
�G�	H�
�\�\�
#�
#�$A�
B���
�
�3�R�8���	0�D��J�J���d�2�h�n�n�.�/�	0r)N)�__name__�
__module__�__qualname__�cluster_name�sos_plugins�packages�strict_node_list�option_listrrr$r�r)rrrs4��@�L��-�K��H����K��6/�(1�
0r)r)r:�sos.collector.clustersr�
sos.utilitiesr�	xml.etreerrrFr)r�<module>rJs!��
�*�'�!�R0��R0r)

Zerion Mini Shell 1.0