Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/tuned/plugins/ |
| [Home] [System Details] [Kill Me] |
�
��\c@s�ddlmZddlTddlZddlmZddlmZddlj Z ddl
Z
ddlZejj
�Zdejfd��YZdS( i(tbase(t*i����N(t
exceptions(tcommandst
SystemdPlugincBs�eZdZd�Zd�Zd�Zed��Zd�Zd�Z d�Z
d�Zd �Zd
�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.pyRscCst|_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(Ntcpu_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_tuningVscCs8|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_unpackisRt
per_devicecCsld}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__RRRtclassmethodRR%R-R0R6R=RARERRIRPtcommand_customR_(((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyR
s (R.Rt
decoratorst
tuned.logsttunedRttuned.utils.commandsRttuned.constsRRRtlogstgetR3tPluginR(((s@/usr/lib/python2.7/site-packages/tuned/plugins/plugin_systemd.pyt<module>s