Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_reset_rmc.cpython-38.pyc

U

�Ad"�	@s�UdZddlZddlmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
dd	lmZdd
lmZdZdd
deegeggd�Ze
ed<dZdZdZdZe�e�ZdZeee	eedd�dd�Zdd�Zdd�Z dd�Z!dd�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.
Zcc_reset_rmcz	Reset RMCzreset rsct node id)�id�name�titleZdescriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keys�meta�z/opt/rsct/install/bin�rmcctrlZrecfgctz/etc/ct_node_id)r�cfg�cloudr�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rrrr�	orig_path�r!�?/usr/lib/python3/dist-packages/cloudinit/config/cc_reset_rmc.py�handleDs


r#cCsNz$t�tg�d}t�|���|WStjk
rHt�td��YnXdS)Nrz*Failed to reconfigure the RSCT subsystems.)r�RECFGCTrr�stripZProcessExecutionErrorr�logexc)�outr!r!r"�reconfigure_rsct_subsystems[sr(cCsJzt�t�}|�d�d}|WStk
rDt�tdt��YnXdS)N�
rz#Failed to get node ID from file %s.)rZ	load_file�NODE_ID_FILE�split�	Exceptionr&r)�fpZnode_idr!r!r"�get_node_idhs
r.cCs(|rd|nd}t|tjd<tjdS)N�:rr)rrr)r Zsuffr!r!r"rrsrcCs8zt�tdg�WStk
r2t�td��YnXdS)Nz-zz!Failed to stop the RMC subsystem.)r�RMCCTRLr,rr&rr!r!r!r"r{s
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.rr(�errorr,)Znode_id_beforeZ
node_id_after�msgr!r!r"r�s

r)$�__doc__rZloggingrZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.distrosr	Zcloudinit.settingsr
ZMODULE_DESCRIPTIONr�__annotations__rr0r$Z	getLogger�__name__rr*�str�listr#r(r.rrrr!r!r!r"�<module>sJ�
�