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

ó
æ”\c@sÝddlmZddlZddlmZddlmZddl	m
Z
ddlmZddl
jZddlmZddlZddlZddlZddlZddlZddlZd	efd
„ƒYZdS(iÿÿÿÿ(tprint_functionN(tcommands(tLocatori(tTunedAdminDBusException(tTunedException(tProfileRecommendertAdmincBs”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*d$ed%„Z+d$ed&„Z,ed'„Z-ed(„Z.RS()cCs||_||_||_||_t|ƒ|_ttjƒ|_	t
jƒ|_d|_
t|_d|_d|_d|_||_tƒ|_|jrtjjtjtjtj|ƒ|_y|jjtj|jƒWqt k
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_levelRt_profile_recommenderttunedtadmintDBusControllertDBUS_BUStDBUS_INTERFACEtDBUS_OBJECTtset_signal_handlertDBUS_SIGNAL_PROFILE_CHANGEDt_signal_profile_changed_cbRt_errortFalse(tselftdbustdebugtasyncottimeoutt	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(tostkilltintRt	read_fileRtPID_FILEtOSErrorterrnotEPERMt
ValueErrortIOErrorR'R(R(R.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_tuned_is_running6s)cOsL|dks|dkrtSd}d}t}yt|d|ƒ}Wntk
rc}t|_nXyt|d|ƒ}Wn;tk
r¸}|js¹|jt|ƒd|ƒtSnX|jr-y<|jj|j	ƒ|jj
|||Ž|jjƒ}Wq-tk
r)}|j|ƒt|_q-Xn|jsH|||Ž}n|S(NRt
_action_dbus_t_action_s , action '%s' is not implemented(
RR'tgetattrtAttributeErrorRR&tstrRtset_on_exit_actiont_log_capture_finisht
set_actiontrunR(R(taction_nametargstkwargstactiontaction_dbustresR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRQ@s6
			

	c	Cs€tdƒxo|D]g}|ddk	rf|ddkrft|jjd|ddd|dƒƒqtd|dƒqWdS(NsAvailable profiles:iRs- %sii(R1RRt	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	profiles2RtprofilesRWt_action_dbus_activetexitR(R(RUR.RV((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_list_profilesfs,

cCs$|j|jjƒƒ|jƒtS(N(RWRtget_known_names_summaryt_action_activeR(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_list_profilesps
cCs8|jjƒ}|dkr$d}n|jjtƒ|S(NR(Rtactive_profileRR[R(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_dbus_get_active_profileus
	cCs|jjƒ\}}|S(N(Rtget_active_profile(R(R7tmanual((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_get_active_profile|scCsD|jjƒ\}}|dkr0|dk	}n|r=tjStjS(N(RRbRRtACTIVE_PROFILE_MANUALtACTIVE_PROFILE_AUTO(R(RVRc((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'(RR1R'(R(RVt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(RaRR[RiRh(R(RV((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.(
RdRR1R'RR&RIRiRtget_profile_attrsRtPROFILE_ATTR_SUMMARYtPROFILE_ATTR_DESCRIPTION(R(RVR.((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(RR1R'R(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_name¦s

cCs|jj|j|jƒƒƒS(N(RR[RoRa(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRZ®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(
RdRR&RIR'RRDR1RRo(R(R7R.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR^±s
cCstd|ƒdS(NsProfile selection mode: (R1(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_modeRqR&R[R'R(R(Rpterror((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(RgRqRRR&RIR'(R(RpR.((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
_timestampRR1RR[R'RtisSetRRRR(R(R7((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(NRtendR0sUError: Failed to stop log capture. Restart the Tuned daemon to prevent a memory leak.(
RRRtlog_capture_finishR1R2R3tflushRR&(R(tlog_msgsR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRKæ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(tlent_action_dbus_listtjoinRR[R'RtclearR
RRRtlog_capture_startRtswitch_profileRzR{R|RLR~(R(RYR7R,RxRy((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.(R1Rtexecute(R(RxRy((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_namesRtsave_active_profileRŽRRR&RIR'(R(R7RcR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_set_profiles

cCsKt|ƒdkr|jƒSdj|ƒ}|dkr;tS|j|tƒS(NiRƒR(R„R_R†R'R‘R(R(RYR7((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
RRRRˆRtauto_profileR[RzR{R|RLR~(R(R7R,RxRy((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_auto_profile$s
	cCs|jjƒ}|j|tƒS(N(Rt	recommendR‘R'(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_auto_profile4scCs#t|jjƒƒ|jjtƒS(N(R1RR“R[R(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_recommend_profile8scCst|jjƒƒtS(N(R1RR–R(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_profileR1RtLOG_FILER[(R(tignore_missingRx((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.(R1R'(R(Rž((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_verify_profileQs
cCsVd}|jj|j|ƒ|_|jjƒ}|sF|jdƒn|jj|ƒS(NiisCannot disable active profile.i(RRˆRRtoffR&R[(R(R,Rx((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_offUs	cCstdƒtS(Ns Not supported in no_daemon mode.(R1R'(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_off_s
RYcCs6|dkr|jƒS|dkr2|jd|ƒSdS(sDPrint accessible profiles or plugins got from tuned dbus api

		Keyword arguments:
		list_choice -- argument from command line deciding what will be listed
		verbose -- if True then list plugin's config options and their hints
			if possible. Functional only with plugin listing, with profiles
			this argument is omitted
		RYtpluginstverboseN(R\t_action_dbus_list_plugins(R(tlist_choiceR¥((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR…cs	
cCs6|dkr|jƒS|dkr2|jd|ƒSdS(saPrint accessible profiles or plugins with no daemon mode

		Keyword arguments:
		list_choice -- argument from command line deciding what will be listed
		verbose -- Plugins cannot be listed in this mode, so verbose argument
			is here only because argparse module always supplies verbose
			option and if verbose was not here it would result in error
		RYR¤R¥N(R_t_action_list_plugins(R(R§R¥((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_listqs	
cCsÁ|jjƒ}xŸ|jƒD]‘}t|ƒ|st||ƒdkrOqn|jj|ƒ}xI||D]=}td|ƒ|j|dƒ}|rltd|ƒqlqlWqW|jjt	ƒS(svPrint accessible plugins

		Keyword arguments:
		verbose -- if is set to True then parameters and hints are printed
		is	%ss		%sN(
Rtget_pluginstkeysR1R„tget_plugin_hintstgetRR[R(R(R¥R¤tpluginthintst	parameterthint((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR¦s
cCstdƒtS(Ns Not supported in no_daemon mode.(R1R'(R(R¥((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR¨’s
(/t__name__t
__module__RR'Rt
ADMIN_TIMEOUTtloggingtERRORR/R&R%RDRQRWR\R_RaRdRgRiRjRnRoRZR^RqRtRuRzR~RKRŠRŽR‘R’R•R—R˜R™RŸR R¢R£R…R©R¦R¨(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRsR				
			
																											
	(t
__future__Rttuned.adminRttuned.utils.commandsRttuned.profilesRR
t
exceptionsRttuned.exceptionsRttuned.constsRttuned.utils.profile_recommenderRR:R2R@R{RRµtobjectR(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt<module>s
Back to Directory File Manager