/usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__
Edit: /usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__/pacemaker.cpython-310.pyc (3303B)
o
G%@i> @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS ) N)ElementTree)Cluster)sos_parse_versionc @ sF e Zd ZdZd gZdZdZg dZdd 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/| ds*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 ). ).0nr
r
B/usr/lib/python3/dist-packages/sos/collector/clusters/pacemaker.py
/ s z'pacemaker.get_nodes..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_optionget_nodes_from_crm Exceptionlog_warnget_nodes_from_corosync log_errorjoin)selferr_shortsr
r
r
get_nodes s0
zpacemaker.get_nodesc C s d}| d}|d dkr%|d d dd }t|tdkr$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 --versionstatusr output -z2.0.3z--as-xmlNzcrm_mon --one-shot --inactive T) need_root)exec_primary_cmdsplitr
parse_crm_xml)r xmlopt_vercver_outr
r
r
r 9 s
zpacemaker.get_nodes_from_crmc C sv t |}|d}|D ],}|j}| dr%|d dkr%| j|d q| dr8|d dkr8| j|d qdS )zA
Parse the xml output string provided by crm_mon
r r truenamer falseN)r
fromstringfindattribr r append)r xmlstring_xmlr node_noder
r
r
r# M s
zpacemaker.parse_crm_xmlc C sD | d | jd}td|}|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_filerefindallr r. strip)r ccr r1 r
r
r
r Z s
z!pacemaker.get_nodes_from_corosyncN)__name__
__module____qualname__cluster_namesos_pluginspackagesstrict_node_listoption_listr r r# r r
r
r
r
r s
r )r6 xml.etreer sos.collector.clustersr
sos.utilitiesr r r
r
r
r
s