+
    i>  c                   sH    ^ RI t ^ RIHt ^ RIHt ^ RIHt  ! R R]4      tR# )i    N)ElementTree)Cluster)sos_parse_versionc                   sR   a  ] tR t^t o RtR .tR	tRt. R
OtR t	R t
R tR tRtV tR# )	pacemakerz+Pacemaker High Availability Cluster ManagerTc                s   . V n          V P                  R 4      '       g    V P                  4        V P                   '       g   V P                  4        T P                    Uu. uF  pRT9  g   K  TNK  	  ppT'       d%   T P	                  RRP                  T4       R24       T P                   #   \         d   pT P	                  RT 24        Rp?LRp?ii ; i  \         d   pT P                  RT 24        Rp?LRp?ii ; iu upi )only-corosynczHFalling back to sourcing corosync.conf. Could not parse crm_mon output: Nz(Could not determine nodes from cluster: Z.zWARNING: Node addresses 'Z,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_crmZ	Exceptionlog_warnget_nodes_from_corosyncZ	log_errorZjoin)selfZerrZnZ_shorts   &   E/usr/lib/python3.14/site-packages/sos/collector/clusters/pacemaker.py	get_nodesZpacemaker.get_nodes   s   
	M???33L++- ::: ,,. #jj9jCqL11j9MM+CHHW,=+> ?* * zz% ! LMM #EEHE#K L LL  	MNNEcUKLL	M :sQ   C B/ C C !	D/D/C:CC CC D&C??Dc                sh   RpV P                  R4      pVR,          ^ 8X  dQ   VR,          P                  4       ^,          P                  R4      ^ ,          p\        V4      \        R4      8:  d   RpMR# V P                  R	V 2R
R7      pVR,          ^ 8X  d   V P                  VR,          4       R# R# )z7
Try to parse crm_mon output for node list and status.
z--output-as=xmlzcrm_mon --versionZstatusZoutputZ-z2.0.3z--as-xmlNzcrm_mon --one-shot --inactive T)Z	need_root)Zexec_primary_cmdZsplitr   parse_crm_xml)r
   ZxmloptZ_verZcverZ_outs   &    r   r   Zpacemaker.get_nodes_from_crm9   s     #$$%89>Q>'')!,2237:D &*;G*DD#$$,VH5 % 
 >QtH~.     c                s   \         P                  ! V4      pVP                  R4      pV F  pVP                  pV P	                  R4      '       d3   VR,          R8X  d%   V P
                  P                  VR,          4       KX  V P	                  R4      '       g   Kq  VR,          R8X  g   K  V P
                  P                  VR,          4       K  	  R# )z1
Parse the xml output string provided by crm_mon
r   onlineZtrueZnameofflineZfalseN)r    Z
fromstringZfindZattribr   r   append)r
   Z	xmlstringZ_xmlr   nodeZ_nodes   &&    r   r   Zpacemaker.parse_crm_xmlM   s     %%i0		'"DKKEx((U8_-F

!!%-0++h70J

!!%-0 r   c                s    V P                  R4       V P                  P                  R4      p\        P                  ! RV4      pV F3  pV P
                  P                  VR,          P                  4       4       K5  	  R# )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:)(.*))Ni)r   ZprimaryZ	read_filereZfindallr   r   Zstrip)r
   Zccr   r   r   r   r	   Z!pacemaker.get_nodes_from_corosyncZ   sd    
 	 G 	H\\##$AB

3R8DJJd2hnn./ r   )r   N)r   ))r   TzCollect nodes listed as online)r   TzCollect nodes listed as offline)r   Fz)Only use corosync.conf to enumerate nodes)Z__name__Z
__module__Z__qualname__Z__firstlineno__Zcluster_nameZsos_pluginsZpackagesZstrict_node_listZoption_listr   r   r   r	   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s<     @L-KHK6/(1
0 
0r   r   )r   Z	xml.etreer    Zsos.collector.clustersr   Zsos.utilitiesr   r   ) r   r   <module>r      s!    
 ! * +R0 R0r   