MINI MINI MANI MO

Path : /usr/lib/python2.7/site-packages/tuned/plugins/
File Upload :
Current File : //usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyc

ó
Đ=[c@s™ddlmZddlTddlZddlmZddlmZddlj	Z	ddl
Z
ddlZejj
ƒZdejfd„ƒYZdS(	i(tbase(t*iĸĸĸĸN(t
exceptions(tcommandst
SystemdPlugincBs§eZdZd„Zd„Zd„Zed„ƒZd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„Zed„Zd
„Zeddeƒd„ƒZRS(sn
	Plugin for tuning systemd options.

	These tunings are unloaded only on profile change followed by reboot.
	cOsWtjjtjƒs.tjdtjƒ‚ntt|ƒj	||Žt
ƒ|_dS(NsERequired systemd '%s' configuration file not found, disabling plugin.(tostpathtisfiletconststSYSTEMD_SYSTEM_CONF_FILERtNotSupportedPluginExceptiontsuperRt__init__Rt_cmd(tselftargstkwargs((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyRscCst|_t|_dS(N(tFalset_has_dynamic_tuningtTruet_has_static_tuning(Rtinstance((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_instance_inits	cCsdS(N((RR((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_instance_cleanupscCsidd6S(Ntcpu_affinity(tNone(tcls((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_get_config_options!scCs^|dk	rZtjd|d|dtjƒ}|dk	rZ|jdkrZ|jdƒSndS(Ns^\s*s\s*=\s*(.*)$tflagsi(Rtretsearcht	MULTILINEt	lastindextgroup(Rtconftkeytmo((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_get_keyval's
#cCs›tjd|ddt|ƒ|dtjƒ\}}|dkr—y!|ddkrb|d7}nWntk
rvnX||dt|ƒd7}|S|S(	Ns^(\s*s\s*=).*$s\g<1>Riiĸĸĸĸs
t=(RtsubntstrRt
IndexError(RR"R#tvaltconf_newtnsubs((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_add_keyval/s6
cCs$tjd|dd|dtjƒS(Ns^\s*s\s*=.*\ntR(RtsubR(RR"R#((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_del_key;scCs<|jjtjddƒ}|dkr8tjdƒdS|S(Nterr_rets(error reading systemd configuration file(R
t	read_fileRR	Rtlogterror(Rtsystemd_system_conf((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_read_systemd_system_conf>s

cCs–tjtj}|jj||ƒsLtjdƒ|jj|dtƒt	S|jj
|tjƒs’tjdtjƒ|jj|dtƒt	StS(Ns(error writing systemd configuration filetno_errors/error replacing systemd configuration file '%s'(RR	tTMP_FILE_SUFFIXR
t
write_to_fileR3R4tunlinkRRtrename(RR"ttmpfile((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_write_systemd_system_confEs
cCstjjtj|jƒS(N(RRtjoinRtPERSISTENT_STORAGE_DIRtname(R((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_get_storage_filenameSscCsĒ|jƒ}|dk	rž|jƒ}|jj|dddtƒ}|jj|ƒ|dkrv|j|tj	ƒ}n|j
|tj	|ƒ}|j|ƒndS(NR1R7(R6RRAR
R2RR:R0RtSYSTEMD_CPUAFFINITY_VARR-R=(RR"tfnametcpu_affinity_saved((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_remove_systemd_tuningVscCs8|r4tjdtjƒ|jƒtjdƒndS(Ns6removing '%s' systemd tuning previously added by Tuneds[you may need to manualy run 'dracut -f' to update the systemd configuration in initrd image(R3tinfoRRBREtconsole(RRt
full_rollback((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_instance_unapply_staticbs
c
CsQ|dkrdSdjd„|jjtjddtjdd|ƒƒƒDƒƒS(NR.t css|]}t|ƒVqdS(N(R((t.0tv((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pys	<genexpr>lss\s+t,s,\s+(RR>R
tcpulist_unpackRR/(Rtcpulist((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_cpulist_convert_unpackisRt
per_devicecCsld}d}|jj|jj|jj|ƒƒƒ}djd„|jj|ƒDƒƒ}|jƒ}	|	dk	rš|j	|	t
jƒ}|j|ƒ}n|rķ|j
d|||ƒS|rh|jƒ}
|jj|
dddtƒ}|dk	r&|dkr&||kr&|jj|
|dtƒntjdt
j|t
jfƒ|j|j|	t
j|ƒƒndS(NRJcss|]}t|ƒVqdS(N(R((RKRL((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pys	<genexpr>ssRR1R7tmakedirs setting '%s' to '%s' in the '%s'(RR
tunescapet
_variablestexpandtunquoteR>RNR6R%RRBRPt
_verify_valueRAR2RR9R3RFR	R=R-(Rtenablingtvaluetverifytignore_missingt
conf_affinitytconf_affinity_unpackedRLt
v_unpackedR"RCRD((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt_cmdlinens"*%$ (t__name__t
__module__t__doc__RRRtclassmethodRR%R-R0R6R=RARERRIRPtcommand_customR_(((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyR
s											(R.Rt
decoratorst
tuned.logsttunedRttuned.utils.commandsRttuned.constsRRRtlogstgetR3tPluginR(((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt<module>s


OHA YOOOO