܍~c" UdZddlZddlmZddlmZddlmZmZddlm Z ddl m Z ddl m Z dd lmZdd lmZd Zd d deegeggdZe ed<dZdZdZdZejeZdZdede de dededdf dZdZdZ dZ!d Z"d!Z#dS)"zReset RMC: Reset rsct node idN)Logger)log)subputil)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)idnametitle descriptiondistros frequencyexamplesactivate_by_schema_keysmetaz/opt/rsct/install/binrmcctrlrecfgctz/etc/ct_node_idrcfgcloudrargsreturnc|jjdkrtddStjtstddStj d} t|t|r|tjd<dStjd=dS#|r|tjd<n tjd=wxYw)Nnonez(Skipping creation of new ct_node_id nodez&module disabled, RSCT_PATH not presentPATH) datasource platform_typeLOGdebugospathisdir RSCT_PATHenvirongetadd_path reset_rmc)rrrrr orig_paths ?/usr/lib/python3/dist-packages/cloudinit/config/cc_reset_rmc.pyhandler.Ds %// <=== 7== # # :;;; v&&I#  #!*BJv    6"""  #!*BJv   6" " " " "s C !C-c tjtgd}t||S#tj$rt jtdwxYw)Nrz*Failed to reconfigure the RSCT subsystems.)rRECFGCTr"r#stripProcessExecutionErrorrlogexc)outs r-reconfigure_rsct_subsystemsr5[spi ""1% #))++  % CEFFF s A A+A;c tjt}|dd}|S#t$r$tjt dtzwxYw)N rz#Failed to get node ID from file %s.)r load_file NODE_ID_FILEsplit Exceptionr3r")fpnode_ids r- get_node_idr>hse ^L ) )((4..#  C>MNNN s 58.A&cf|rd|znd}t|ztjd<tjdS)N:rr)r'r$r()r,suffs r-r*r*rs4( /3??RD"T)BJv :f c tjtdgS#t$rtjt dwxYw)Nz-zz!Failed to stop the RMC subsystem.)rRMCCTRLr;rr3r"rBr-rr{sLy'4)))  C<=== s &Acxtdt}td|tt t}td|||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>rr5errorr;)node_id_before node_id_aftermsgs r-r+r+sII())) ]]NII2NCCC III!!!MMMII,m<<<&&2 #nn'&rB)$__doc__r$loggingr cloudinitrrrcloudinit.cloudrcloudinit.configrcloudinit.config.schemar cloudinit.distrosr cloudinit.settingsr MODULE_DESCRIPTIONr__annotations__r'rDr0 getLogger__name__r"r9strlistr.r5r>r*rr+rErBr-rYs $## $$$$$$ !!!!!!######......))))))++++++,   !%}!  j     $  g!! # ###(#/5#=A# ####.   rB