HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/lib/python3.6/site-packages/sos/collector/clusters/__pycache__/pacemaker.cpython-36.pyc
3

3��d:�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�Cluster)�
parse_version)�ElementTreec@sHeZdZdZdgZdZdZdddgZd
d�Zdd
�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 nodescCs�g|_yZ|jd�sPy|j�Wn0tk
rN}z|jd|�WYdd}~XnX|js^|j�Wn0tk
r�}z|jd|�WYdd}~XnXdd�|jD�}|r�|jddj|��|jS)Nz
only-corosynczJFalling back to sourcing corosync.conf. Could not parse crm_mon output: %sz*Could not determine nodes from cluster: %scSsg|]}d|kr|�qS)�.�)�.0�nr
r
�/usr/lib/python3.6/pacemaker.py�
<listcomp>/sz'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_nodess$
 zpacemaker.get_nodescCs~d}|jd�}|ddkrJ|dj�djd�d}t|�td�ksNd	}nd
S|jd|dd
�}|ddkrz|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)rZxmloptZ_verZcverZ_outr
r
rr9s
zpacemaker.get_nodes_from_crmcCsztj|�}|jd�}x`|D]X}|j}|jd�rL|ddkrL|jj|d�q|jd�r|ddkr|jj|d�qWdS)zA
        Parse the xml output string provided by crm_mon
        rr�true�namerZfalseN)rZ
fromstring�findZattribrr�append)rZ	xmlstringZ_xmlr�nodeZ_noder
r
rr!Ms


zpacemaker.parse_crm_xmlcCsH|jd�|jjd�}tjd|�}x |D]}|jj|dj��q(WdS)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:)(.*))rN���)rZprimaryZ	read_file�re�findallrr%�strip)rZccrr&r
r
rrZs


z!pacemaker.get_nodes_from_corosyncN)r)rTr)rTr	)r
Fr)�__name__�
__module__�__qualname__Zcluster_nameZsos_pluginsZpackagesZstrict_node_listZoption_listrrr!rr
r
r
rrs
r)r(Zsos.collector.clustersrZ
sos.utilitiesrZ	xml.etreerrr
r
r
r�<module>s