HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_reset_rmc.cpython-310.pyc
o

�Ad"�@sUdZddlZddlmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
dd	lmZdd
lmZdZdd
deegeggd�Ze
ed<dZdZdZdZe�e�ZdZdedede	dededdfdd�Zdd�Zd d!�Z d"d#�Z!d$d�Z"d%d&�Z#dS)'zReset RMC: Reset rsct node id�N)�Logger)�log)�subp�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�PER_INSTANCEa|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.
�cc_reset_rmcz	Reset RMCzreset rsct node id)�id�name�title�description�distros�	frequency�examples�activate_by_schema_keys�meta�z/opt/rsct/install/bin�rmcctrl�recfgctz/etc/ct_node_idr
�cfg�cloudr�args�returnc	Cs�|jjdkr
t�d�dStj�t�st�d�dStj�	d�}zt
|�t�W|r2|tjd<dStjd=dS|r@|tjd<wtjd=w)N�nonez(Skipping creation of new ct_node_id nodez&module disabled, RSCT_PATH not present�PATH)�
datasource�
platform_type�LOG�debug�os�path�isdir�	RSCT_PATH�environ�get�add_path�	reset_rmc)r
rrrr�	orig_path�r+�?/usr/lib/python3/dist-packages/cloudinit/config/cc_reset_rmc.py�handleDs 

�
r-cCsDzt�tg�d}t�|���|WStjy!t�td��w)Nrz*Failed to reconfigure the RSCT subsystems.)r�RECFGCTr r!�strip�ProcessExecutionErrorr�logexc)�outr+r+r,�reconfigure_rsct_subsystems[s�r3cCs@zt�t�}|�d�d}|WStyt�tdt��w)N�
rz#Failed to get node ID from file %s.)r�	load_file�NODE_ID_FILE�split�	Exceptionr1r )�fp�node_idr+r+r,�get_node_idhs
�r;cCs(|rd|nd}t|tjd<tjdS)N�:rr)r%r"r&)r*�suffr+r+r,r(rs
r(cCs.zt�tdg�WStyt�td��w)Nz-zz!Failed to stop the RMC subsystem.)r�RMCCTRLr8rr1r r+r+r+r,r{s�cCs\t�d�t�}t�d|�t�t�t�}t�d|�||kr,d}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.)r r!r;rr3�errorr8)�node_id_before�
node_id_after�msgr+r+r,r)�s

�r))$�__doc__r"�loggingr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.distrosr	�cloudinit.settingsr
�MODULE_DESCRIPTIONr�__annotations__r%r>r.�	getLogger�__name__r r6�str�listr-r3r;r(rr)r+r+r+r,�<module>sX�
�����
�