HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_reset_rmc.cpython-38.pyc
U

ӇgP�@s�UdZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZd	e
gegd
�Zeed<dZd
ZdZdZe�e�ZdZee	eedd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dS)a�Reset RMC: Reset rsct node id

Reset RMC module is IBM PowerVM Hypervisor specific

Reliable Scalable Cluster Technology (RSCT) is a set of software components,
that  together provide a comprehensive clustering environment (RAS features)
for IBM PowerVM based virtual machines. RSCT includes the Resource monitoring
and control (RMC) subsystem. RMC is a generalized framework used for managing,
monitoring, and manipulating resources. RMC runs as a daemon process on
individual machines and needs creation of unique node id and restarts
during VM boot.
More details refer
https://www.ibm.com/support/knowledgecenter/en/SGVKBA_3.2/admin/bl503_ovrv.htm

This module handles
- creation of the unique RSCT node id to every instance/virtual machine
  and ensure once set, it isn't changed subsequently by cloud-init.
  In order to do so, it restarts RSCT service.

Prerequisite of using this module is to install RSCT packages.
�N)�subp�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�PER_INSTANCEZcc_reset_rmc)�idZdistrosZ	frequencyZactivate_by_schema_keys�meta�z/opt/rsct/install/bin�rmcctrlZrecfgctz/etc/ct_node_id)�name�cfg�cloud�args�returnc	Csr|jjdkrt�d�dStj�t�s4t�d�dStj�	d�}zt
|�t�W5|rd|tjd<ntjd=XdS)NZnonez(Skipping creation of new ct_node_id nodez&module disabled, RSCT_PATH not present�PATH)Z
datasourceZ
platform_type�LOG�debug�os�path�isdir�	RSCT_PATH�environ�get�add_path�	reset_rmc)r
rrr�	orig_path�r�?/usr/lib/python3/dist-packages/cloudinit/config/cc_reset_rmc.py�handle<s


r cCsNz$t�tg�d}t�|���|WStjk
rHt�td��YnXdS)Nrz*Failed to reconfigure the RSCT subsystems.)r�RECFGCTrr�stripZProcessExecutionErrorr�logexc)�outrrr�reconfigure_rsct_subsystemsQsr%cCsJzt�t�}|�d�d}|WStk
rDt�tdt��YnXdS)N�
rz#Failed to get node ID from file %s.)rZload_text_file�NODE_ID_FILE�split�	Exceptionr#r)�fpZnode_idrrr�get_node_id^s
r+cCs(|rd|nd}t|tjd<tjdS)N�:rr)rrr)rZsuffrrrrhsrcCs8zt�tdg�WStk
r2t�td��YnXdS)Nz-zz!Failed to stop the RMC subsystem.)r�RMCCTRLr)rr#rrrrrrqs
cCs\t�d�t�}t�d|�t�t�t�}t�d|�||krXd}t�|�t|��dS)NzAttempting to reset RMC.z"Node ID at beginning of module: %szNode ID at end of module: %sz"New node ID did not get generated.)rrr+rr%�error�RuntimeError)Znode_id_beforeZ
node_id_after�msgrrrr{s

r)!�__doc__ZloggingrZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.distrosrZcloudinit.settingsrr
�__annotations__rr-r!Z	getLogger�__name__rr'�str�listr r%r+rrrrrrr�<module>s2�