MINI MINI MANI MO

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

ó
©=[c@sÍddlmZddlZddlmZddlmZddl	m
Z
ddlmZddl
jZddlZddlZddlZddlZddlZddlZdefd	„ƒYZdS(
iÿÿÿÿ(tprint_functionN(tcommands(tLocatori(tTunedAdminDBusException(tTunedExceptiontAdmincBs^eZeeeejejd„Zd„Z	d„Z
d„Zd„Zd„Z
d„Zd„Zd„Zd	„Zd
„Zd„Zdd
„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$d„Z%d„Z&d „Z'd!„Z(d"„Z)d#„Z*RS($cCs
||_||_||_||_t|ƒ|_ttjƒ|_	t
jƒ|_d|_
t|_d|_d|_d|_||_|jrtjjtjtjtj|ƒ|_y|jjtj|jƒWqtk
r}|j|ƒt |_qXndS(Nt(!t_dbust_debugt_asynct_timeoutRt_cmdtprofiles_locatortconststLOAD_DIRECTORIESt_profiles_locatort	threadingtEventt_daemon_action_finishedt_daemon_action_profiletTruet_daemon_action_resultt_daemon_action_errstrtNonet_controllert
_log_tokent
_log_levelttunedtadmintDBusControllertDBUS_BUStDBUS_INTERFACEtDBUS_OBJECTtset_signal_handlertDBUS_SIGNAL_PROFILE_CHANGEDt_signal_profile_changed_cbRt_errortFalse(tselftdbustdebugtasyncttimeoutt	log_levelte((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt__init__s(											'
cCst|dtjƒdS(Ntfile(tprinttsyststderr(R&tmessage((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR$)scCs>|jjƒs:||_||_||_|jjƒndS(N(Rtis_setRRRtset(R&tprofile_nametresultterrstr((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR#,s
			cCsiy)tjt|jjtjƒƒdƒWn9tk
rK}|jtj	kSt
tfk
rd}tSXt
S(Ni(tostkilltintRt	read_fileR
tPID_FILEtOSErrorterrnotEPERMt
ValueErrortIOErrorR%R(R&R,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_tuned_is_running4s)cOsF|dks|dkrtSd}d}t}yt|d|ƒ}Wntk
rc}t|_nXyt|d|ƒ}Wn5tk
r²}|js³|j|d|ƒtSnX|jr'y<|jj|jƒ|jj	|||Ž|jj
ƒ}Wq'tk
r#}|j|ƒt|_q'Xn|jsB|||Ž}n|S(NRt
_action_dbus_t_action_s , action '%s' is not implemented(RR%tgetattrtAttributeErrorRR$Rtset_on_exit_actiont_log_capture_finisht
set_actiontrunR(R&taction_nametargstkwargstactiontaction_dbustresR,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRN>s6
			

	c	Cs€tdƒxo|D]g}|ddk	rf|ddkrft|jjd|ddd|dƒƒqtd|dƒqWdS(NsAvailable profiles:iRs- %sii(R/RRt	align_str(R&t
profile_namestprofile((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profiles\s


 /cCsxy|jjƒ}Wn;tk
rP}g|jjƒD]}|df^q5}nX|j|ƒ|jƒ|jjtƒS(NR(Rt	profiles2RtprofilesRTt_action_dbus_activetexitR(R&RRR,RS((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_listds,

cCs$|j|jjƒƒ|jƒtS(N(RTRtget_known_names_summaryt_action_activeR(R&((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_listns
cCs8|jjƒ}|dkr$d}n|jjtƒ|S(NR(Rtactive_profileRRXR(R&R5((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_dbus_get_active_profiless
	cCs|jjƒ\}}|S(N(Rtget_active_profile(R&R5tmanual((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_get_active_profilezscCsD|jjƒ\}}|dkr0|dk	}n|r=tjStjS(N(RR_RR
tACTIVE_PROFILE_MANUALtACTIVE_PROFILE_AUTO(R&RSR`((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_get_profile_mode~scCs€|dtkrjtdƒt|dƒtƒtdƒt|dƒtƒtdƒt|dƒtStd|ƒtSdS(	Nis
Profile name:isProfile summary:isProfile description:is,Unable to get information about profile '%s'(RR/R%(R&RStprofile_info((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_info„s


RcCsC|dkr|jƒ}n|jj|j||jj|ƒƒƒS(NR(R^RRXRfRe(R&RS((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profile_info“scCs—|dkrcy*|jƒ}|dkr5tdƒtSWqctk
r_}|jt|ƒƒtSXn|j||jj	|t
jt
jgddgƒƒS(NRsNo current active profile.(
RaRR/R%RR$tstrRfRtget_profile_attrsR
tPROFILE_ATTR_SUMMARYtPROFILE_ATTR_DESCRIPTION(R&RSR,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profile_info˜s
cCs,|dkrtdƒtStd|ƒtS(NsNo current active profile.sCurrent active profile: %s(RR/R%R(R&R5((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_name¤s

cCs|jj|j|jƒƒƒS(N(RRXRmR^(R&((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRW¬scCs|y|jƒ}Wn'tk
r9}|jt|ƒƒtSX|dk	ro|jƒrotdƒtd|ƒtS|j	|ƒS(NsKIt seems that tuned daemon is not running, preset profile is not activated.sPreset profile: %s(
RaRR$RhR%RRBR/RRm(R&R5R,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR[¯s
cCstd|ƒdS(NsProfile selection mode: (R/(R&tmode((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_mode»scCs[|jjƒ\}}|j|ƒ|dkrK|j|ƒ|jjtƒS|jjtƒS(NR(Rtprofile_modeRoR$RXR%R(R&Rnterror((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profile_mode¾s

cCsOy!|jƒ}|j|ƒtSWn'tk
rJ}|jt|ƒƒtSXdS(N(RdRoRRR$RhR%(R&RnR,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profile_modeÆs
cCsP|r?|jjƒrL|jjƒrL|jdƒt}qLn
|j|ƒ|S(NsCannot enable the tuning.(Rt
is_runningtstartR$R%(R&trettmsg((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_profile_print_statusÏs 

cCsœtjƒ|j|jkr=td|jƒ|jjtƒS|jjƒr˜|j	|kr˜|j
s…td|jƒ|jjtƒS|jjtƒSntS(Ns‰Operation timed out after waiting %d seconds(s), you may try to increase timeout by using --timeout command line option or using --async.sError changing profile: %s(
ttimet
_timestampR
R/RRXR%RtisSetRRRR(R&R5((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_wait_profileØs	cCs‘|jdks|jdkr"dSyH|jj|jƒ}d|_t|dddtjƒtjjƒWn tk
rŒ}|j	dƒnXdS(NRtendR.sUError: Failed to stop log capture. Restart the Tuned daemon to prevent a memory leak.(
RRRtlog_capture_finishR/R0R1tflushRR$(R&tlog_msgsR,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRHäs		cCst|ƒdkr|jƒSdj|ƒ}|dkrG|jjtƒS|jjƒ|jrœ|j	dk	rœ|jdd}|jj|j	|ƒ|_
n|jj|ƒ\}}|jsÄ|rà|jj|j||ƒƒStjƒ|_|jj|j|ƒ|j||ƒS(Nit Rii(tlenRYtjoinRRXR%RtclearR	RRR
tlog_capture_startRtswitch_profileRxRyRzRIR|(R&RVR5R*RvRw((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profileðs 

	cCsRtdƒ|jjdddgƒ\}}|dkrDtdƒn
tdƒdS(NsTrying to (re)start tuned...tserviceRtrestartis#Tuned (re)started, changes applied.sQTuned (re)start failed, you need to (re)start tuned by hand for changes to apply.(R/Rtexecute(R&RvRw((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_restart_tuneds

!
cCs||jjƒkrty%|jj||ƒ|jƒtSWq‰tk
rp}|jt|ƒƒ|jdƒt	SXn|jd|ƒt	SdS(NsUnable to switch profile.s%Requested profile '%s' doesn't exist.(
Rtget_known_namesRtsave_active_profileR‹RRR$RhR%(R&R5R`R,((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_set_profiles

cCsKt|ƒdkr|jƒSdj|ƒ}|dkr;tS|j|tƒS(NiRR(R‚R\RƒR%RŽR(R&RVR5((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profiles
cCsÚ|jjƒ}|jjƒ|jrd|jdk	rd|jdd}|jj|j|ƒ|_	n|jj
ƒ\}}|js‰|r¥|jj|j||ƒƒSt
j
ƒ|_|jj|j|ƒ|j||ƒS(Nii(Rtrecommend_profileRR„R	RRR
R…Rtauto_profileRXRxRyRzRIR|(R&R5R*RvRw((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_auto_profile"s
	cCs|jjƒ}|j|tƒS(N(RRRŽR%(R&R5((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_auto_profile2scCs#t|jjƒƒ|jjtƒS(N(R/RRRXR(R&((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_recommend_profile6scCst|jjƒƒtS(N(R/RRR(R&((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_recommend_profile:scCs—|r|jjƒ}n|jjƒ}|r:tdƒn<tdƒtdƒtdƒtdƒtdƒtdƒtdtjƒ|jj|ƒS(	NsHVerfication succeeded, current system settings match the preset profile.sLVerification failed, current system settings differ from the preset profile.s=You can mostly fix this by restarting the Tuned daemon, e.g.:s  systemctl restart tunedtors  service tuned restartsNSometimes (if some plugins like bootloader are used) a reboot may be required.s&See tuned log file ('%s') for details.(Rtverify_profile_ignore_missingtverify_profileR/R
tLOG_FILERX(R&tignore_missingRv((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_verify_profile>s






cCstdƒtS(Ns Not supported in no_daemon mode.(R/R%(R&Rš((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_verify_profileOs
cCsVd}|jj|j|ƒ|_|jjƒ}|sF|jdƒn|jj|ƒS(NiisCannot disable active profile.i(RR…RRtoffR$RX(R&R*Rv((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_offSs	cCstdƒtS(Ns Not supported in no_daemon mode.(R/R%(R&((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_off]s
(+t__name__t
__module__RR%R
t
ADMIN_TIMEOUTtloggingtERRORR-R$R#RBRNRTRYR\R^RaRdRfRgRlRmRWR[RoRrRsRxR|RHR‡R‹RŽRR’R“R”R•R›RœRžRŸ(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRsJ				
			
																											
(t
__future__Rttuned.adminRttuned.utils.commandsRttuned.profilesRRt
exceptionsRttuned.exceptionsRttuned.constsR
R8R0R>RyRR£tobjectR(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt<module>s

OHA YOOOO