Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/sos/collector/clusters/__pycache__/ |
Upload File : |
o ���bC � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�Cluster)�version)�ElementTreec @ sF e Zd ZdZd gZdZdZg d�Zdd� Zdd� Z d d � Z dd� Zd S )� pacemakerz+Pacemaker High Availability Cluster Manager)r T))�onlineTzCollect nodes listed as online)�offlineTzCollect nodes listed as offline)� only-corosyncFz)Only use corosync.conf to enumerate nodesc C s� g | _ z.| �d�s)z| �� W n ty( } z | �d| � W Y d }~nd }~ww | j s0| �� W n tyJ } z | �d| � W Y d }~nd }~ww dd� | j D �}|r_| �dd�|� � | j S )Nr zJFalling back to sourcing corosync.conf. Could not parse crm_mon output: %sz*Could not determine nodes from cluster: %sc S s g | ]}d |vr|�qS )�.� )�.0�nr r �B/usr/lib/python3/dist-packages/sos/collector/clusters/pacemaker.py� <listcomp>/ s z'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_nodes s4 ��������zpacemaker.get_nodesc C s� d}| � d�}|d dkr'|d �� d �d�d }t�|�t�d�ks&d }nd S | j d| dd �}|d dkrA| �|d � d S d 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� parse_crm_xml)r �xmlopt�_ver�cver�_outr r r r 9 s ���zpacemaker.get_nodes_from_crmc C sv t �|�}|�d�}|D ],}|j}| �d�r%|d dkr%| j�|d � q| �d�r8|d dkr8| j�|d � qdS )zA Parse the xml output string provided by crm_mon r r �true�namer �falseN)r � fromstring�find�attribr r �append)r � xmlstring�_xmlr �node�_noder r r r$ M s ��zpacemaker.parse_crm_xmlc C sD | � 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�findallr r/ �strip)r �ccr r2 r r r r Z s �z!pacemaker.get_nodes_from_corosyncN)�__name__� __module__�__qualname__�cluster_name�sos_plugins�packages�strict_node_list�option_listr r r$ r r r r r r s r )r7 �sos.collector.clustersr �setuptools._vendor.packagingr � xml.etreer r r r r r �<module> s