Server IP : 172.24.0.40 / Your IP : 216.73.216.10 Web Server : Apache System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64 User : apache ( 48) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/sos/collector/clusters/__pycache__/ |
Upload File : |
3 3��d: � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�Cluster)� parse_version)�ElementTreec @ sH e Zd ZdZd gZdZdZdddgZd d� Zdd � Z dd� Z dd� ZdS )� pacemakerz+Pacemaker High Availability Cluster ManagerT�online�Collect nodes listed as online�offline�Collect nodes listed as offline� only-corosyncF�)Only use corosync.conf to enumerate nodesc C s� g | _ yZ| jd�sPy| j� W n0 tk rN } z| jd| � W Y d d }~X nX | j s^| j� W n0 tk r� } z| jd| � W Y d d }~X nX dd� | j D �}|r�| jddj|� � | j S )Nz only-corosynczJFalling back to sourcing corosync.conf. Could not parse crm_mon output: %sz*Could not determine nodes from cluster: %sc S s g | ]}d |kr|�qS )�.� )�.0�nr r �/usr/lib/python3.6/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_corosyncZ log_error�join)�self�errZ_shortsr r r � get_nodes s$ zpacemaker.get_nodesc C s~ d}| j d�}|d dkrJ|d j� d jd�d }t|�td�ksNd }nd S | j d| dd �}|d dkrz| j|d � d S )zG Try to parse crm_mon output for node list and status. z--output-as=xmlzcrm_mon --versionZstatusr �output� �-z2.0.3z--as-xmlNz crm_mon --one-shot --inactive %sT)Z need_root)Zexec_primary_cmd�splitr � parse_crm_xml)r ZxmloptZ_verZcverZ_outr r r r 9 s zpacemaker.get_nodes_from_crmc C sz t j|�}|jd�}x`|D ]X}|j}| jd�rL|d dkrL| jj|d � q| jd�r|d dkr| jj|d � qW dS )zA Parse the xml output string provided by crm_mon r r �true�namer ZfalseN)r Z fromstring�findZattribr r �append)r Z xmlstringZ_xmlr �nodeZ_noder r r r! M s zpacemaker.parse_crm_xmlc C sH | j d� | jjd�}tjd|�}x |D ]}| jj|d j� � q(W dS )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:)(.*))r N���)r ZprimaryZ read_file�re�findallr r% �strip)r Zccr r&