Viewing File: /usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyo

ó
+cc@sðddlZddlmZddlTddlZddlTddlmZddl	j
Z
ddlZddlZej
jƒZddgZdd	gZd
ejfd„ƒYZd„Zd
„Zd„Zd„Zd„Zed„ZdS(iÿÿÿÿNi(tbase(t*(tcommandstbase_reachable_timetretrans_times
/run/sysctl.ds
/etc/sysctl.dtSysctlPlugincBsGeZdZd„Zd„Zd„Zd„Zd„Zed„Z	RS(s.
	Plugin for applying custom sysctl options.
	cOs2tt|ƒj||Žt|_tƒ|_dS(N(tsuperRt__init__tTruet_has_dynamic_optionsRt_cmd(tselftargstkwargs((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRs	cCs—t|_t|_|j|jƒ}|jj|iƒ|_t	|jƒdkr‡t
jdƒ|j|ƒi|_|jj
|ƒn|j|_dS(Nis0recovering old sysctl settings from previous run(tFalset_has_dynamic_tuningRt_has_static_tuningt_storage_keytnamet_storagetgett_sysctl_originaltlentlogtinfot_instance_unapply_statictunsettoptionst_sysctl(Rtinstancetstorage_key((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_inits		

	cCs&|j|jƒ}|jj|ƒdS(N(RRRR(RRR((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_cleanup+scCs	x¨t|jjƒƒD]‘\}}t|ƒ}|dkrNtjd|ƒq|jj|j	j
|ƒƒ}|j||ƒ}|dk	r||j|<t
||ƒqqW|j|jƒ}|jj||jƒ|jjtjtjƒrtjdƒtƒndS(NsDsysctl option %s will not be set, failed to read the original value.sreapplying system sysctl(tlistRtitemst_read_sysctltNoneRterrort
_variablestexpandR
tunquotet_process_assignment_modifiersRt
_write_sysctlRRRtsett_global_cfgtget_booltconststCFG_REAPPLY_SYSCTLtCFG_DEF_REAPPLY_SYSCTLRt_apply_system_sysctl(RRtoptiontvaluetoriginal_valuet	new_valueR((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_apply_static/s""		

cCs®t}t}x›t|jjƒƒD]„\}}t|ƒ}|j|jj|ƒ|ƒ}|dk	r"|j	||j
j|ƒ|j
j|ƒ|ƒtkr¦t}q¦q"q"W|S(N(
RR!RR"R#R)R&R'R$t
_verify_valueR
t	remove_wsR(RRtignore_missingtdevicestretR2R3tcurr_val((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_verify_staticEs"6cCs7x0t|jjƒƒD]\}}t||ƒqWdS(N(R!RR"R*(RRt
full_rollbackR2R3((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRQs"(
t__name__t
__module__t__doc__RRR R6R=RR(((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRs					cCsÅi}xmtD]e}ytj|ƒ}Wn
q
nXx<|D]4}|jdƒsUq:n||kr:|||<q:q:Wq
Wx>t|jƒƒD]*}||}d||f}t|ƒq‰WtdƒdS(Ns.confs%s/%ss/etc/sysctl.conf(tSYSCTL_CONFIG_DIRStostlistdirtendswithtsortedtkeyst_apply_sysctl_config_file(tfilestdtflisttfnametpath((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR1Vs 


c	CsÀtjd|ƒy]t|dƒ7}x-t|dƒD]\}}t|||ƒq6WWdQXtjd|ƒWnKttfk
r»}|jtjkr¼tj	d|t
|ƒfƒq¼nXdS(Ns%Applying sysctl settings from file %stris.Finished applying sysctl settings from file %ss.Error reading sysctl settings from file %s: %s(Rtdebugtopent	enumeratet_apply_sysctl_config_linetOSErrortIOErrorterrnotENOENTR%tstr(RMtftlinenotlinete((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRHis		cCsé|jƒ}t|ƒdks>|ddks>|ddkrBdS|jddƒ}t|ƒdkrtjd||fƒdS|\}}|jƒ}t|ƒdkrÆtjd||fƒdS|jƒ}t||dtƒdS(	Nit#t;t=iis Syntax error in file %s, line %dR9(tstripRtsplitRR%R*R(RMRYRZttmpR2R3((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRRvs 2		cCsd|jddƒS(Ns/proc/sys/%st.t/(treplace(R2((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_get_sysctl_pathˆscCs÷t|ƒ}y‡t|dƒW}d}x;t|ƒD]-\}}|dkr4tjd|ƒdSq4W|jƒ}WdQXtjd||fƒ|SWn]tt	fk
rò}|j
t
jkrÑtjd|ƒntjd|t|ƒfƒdSXdS(NRNtisGFailed to read sysctl parameter '%s', multi-line values are unsupporteds&Value of sysctl parameter '%s' is '%s'sBFailed to read sysctl parameter '%s', the parameter does not exists(Failed to read sysctl parameter '%s': %s(
ReRPRQRR%R$R_RORSRTRURVRW(R2RMRXRZtiR3R[((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR#‹s(				cCsÿt|ƒ}tjj|ƒtkr9tjd|ƒtSyDtjd||fƒt	|dƒ}|j
|ƒWdQXtSWn{tt
fk
rú}|jtjkrÖ|r¶tjntj}|d||fƒn tjd||t|ƒfƒtSXdS(Ns+Refusing to set deprecated sysctl option %ss%Setting sysctl parameter '%s' to '%s'twsIFailed to set sysctl parameter '%s' to '%s', the parameter does not exists/Failed to set sysctl parameter '%s' to '%s': %s(ReRCRMtbasenametDEPRECATED_SYSCTL_OPTIONSRR%RRORPtwriteRRSRTRURVRW(R2R3R9RMRXR[tlog_func((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR*¢s&			(treRfRt
decoratorst
tuned.logsttunedt
subprocessttuned.utils.commandsRttuned.constsR.RURCtlogsRRRjRBtPluginRR1RHRRReR#RR*(((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt<module>s&

	E		
			
Back to Directory File Manager