File manager - Edit - /usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__/pacemaker.cpython-310.pyc
Back
o -�_g> � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�ElementTree)�Cluster)�sos_parse_versionc @ 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 s1| �� W n tyL } z| �d|� �� W Y d }~nd }~ww dd� | j D �}|rc| �dd�|�� d�� | j S ) Nr zHFalling back to sourcing corosync.conf. Could not parse crm_mon output: z(Could not determine nodes from cluster: c 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>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_nodes s0 �������zpacemaker.get_nodesc C s� d}| � d�}|d dkr%|d �� d �d�d }t|�td�kr$d }nd S | j d|� �dd �}|d dkr@| �|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-xmlNzcrm_mon --one-shot --inactive T)� need_root)�exec_primary_cmd�splitr � 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 r1 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 )r6 � xml.etreer �sos.collector.clustersr � sos.utilitiesr r r r r r �<module> s
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings