%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/cc_reset_rmc.cpython-39.pyc

a

'�DgP�@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	Cs�|jjdkrt�d�dStj�t�s4t�d�dStj�	d�}z*t
|�t�W|rb|tjd<q�tjd=n|r||tjd<ntjd=0dS)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�A/usr/lib/python3.9/site-packages/cloudinit/config/cc_reset_rmc.py�handle<s 


�r cCsLz$t�tg�d}t�|���|WStjyFt�td��Yn0dS)Nrz*Failed to reconfigure the RSCT subsystems.)r�RECFGCTrr�stripZProcessExecutionErrorr�logexc)�outrrr�reconfigure_rsct_subsystemsQsr%cCsHzt�t�}|�d�d}|WStyBt�tdt��Yn0dS)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)rZsuffrrrrhsrcCs6zt�tdg�WSty0t�td��Yn0dS)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�


	

Zerion Mini Shell 1.0