<s> """<STR_LIT>""" <EOL> import logging <EOL> from ganeti import config <EOL> from ganeti import constants <EOL> from ganeti import jqueue <EOL> from ganeti import utils <EOL> import ganeti . rpc . node as rpc <EOL> CLIENT_REQUEST_WORKERS = <NUM_LIT:16> <EOL> EXIT_NOTMASTER = constants . EXIT_NOTMASTER <EOL> EXIT_NODESETUP_ERROR = constants . EXIT_NODESETUP_ERROR <EOL> class GanetiContext ( object ) : <EOL> """<STR_LIT>""" <EOL> _instance = None <EOL> def __init__ ( self , livelock = None ) : <EOL> """<STR_LIT>""" <EOL> assert self . __class__ . _instance is None , "<STR_LIT>" <EOL> if livelock is None : <EOL> self . livelock = utils . livelock . LiveLock ( "<STR_LIT>" ) <EOL> else : <EOL> self . livelock = livelock <EOL> cfg = self . GetConfig ( None ) <EOL> logging . debug ( "<STR_LIT>" ) <EOL> self . jobqueue = jqueue . JobQueue ( self , cfg ) <EOL> self . __class__ . _instance = self <EOL> def __setattr__ ( self , name , value ) : <EOL> """<STR_LIT>""" <EOL> assert self . __class__ . _instance is None , "<STR_LIT>" <EOL> object . __setattr__ ( self , name , value ) <EOL> def GetWConfdContext ( self , ec_id ) : <EOL> return config . GetWConfdContext ( ec_id , self . livelock ) <EOL> def GetConfig ( self , ec_id ) : <EOL> return config . GetConfig ( ec_id , self . livelock ) <EOL> def GetRpc ( self , cfg ) : <EOL> return rpc . RpcRunner ( cfg , lambda _ : None ) <EOL> def AddNode ( self , cfg , node , ec_id ) : <EOL> """<STR_LIT>""" <EOL> cfg . AddNode ( node , ec_id ) <EOL> def RemoveNode ( self , cfg , node ) : <EOL> """<STR_LIT>""" <EOL> cfg . RemoveNode ( node . uuid ) </s>
