[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.145.53.35: ~ $
�
��\c@s�ddlZddlmZddlTddlZddljZddlm	Z	ddl
Z
ddlZejj
�Zdejfd��YZdS(i����Ni(thotplug(t*(tcommandst
DiskPlugincBs'eZdZd�Zd�Zd�Zed��Zd�Zd�Z	d�Z
d�Zd	�Zed
��Z
ed��Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zedde�d��Zed�ed��Z edde�d��Z!ed�ed��Z"ed de�d!��Z#ed �ed"��Z$d#�Z%d$�Z&ed%de�d&��Z'ed%�ed'��Z(e)d(de�d)��Z*d*�Z+ed+de�d,��Z,ed+�ed-��Z-RS(.s'
	Plugin for tuning options of disks.
	cOs�tt|�j||�ddddddddd	d
ddg|_d
dddddddddd	dg|_t|j�|_d|_d|_t	�|_
dS(Ni�i�i�i�i�i}iiiUiFi7iiii�i�i�i�i�i�i�iniZi<ig{�G�z�?(tsuperRt__init__t
_power_levelst_spindown_levelstlent_levelst_level_stepst_load_smallestRt_cmd(tselftargstkwargs((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRs--		cCsztt|�j�t|_t�|_x?|jjd�D]+}|j	|�r;|jj
|j�q;q;Wt�|_dS(Ntblock(
RRt
_init_devicestTruet_devices_supportedtsett
_free_devicest_hardware_inventorytget_devicest_device_is_supportedtaddtsys_namet_assigned_devices(R
tdevice((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRs	cCs&g|D]}|jjd|�^qS(NR(Rt
get_device(R
tdevicestx((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_get_device_objects%scCsI|jdkoH|jjdd�dkoH|jdkpH|jjdkS(Ntdiskt	removablet0tscsitvirtiotxen(R$R%R&(tdevice_typet
attributestgettNonetparentt	subsystem(tclsR((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyR(scCs|jj|d|j�dS(NR(Rt	subscribet_hardware_events_callback(R
((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_hardware_events_init/scCs|jj|�dS(N(Rtunsubscribe(R
((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_hardware_events_cleanup2scCs;|j|�s|dkr7tt|�j||�ndS(Ntremove(RRRR/(R
teventR((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyR/5scCs?|jdk	r"|jj|�ntt|�j||�dS(N(t
_load_monitorR*t
add_deviceRRt_added_device_apply_tuning(R
tinstancetdevice_name((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyR79scCs?|jdk	r"|jj|�ntt|�j||�dS(N(R5R*t
remove_deviceRRt_removed_device_unapply_tuning(R
R8R9((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyR;>scCs5itd6dd6dd6dd6dd6dd6dd6S(Ntdynamictelevatortapmtspindownt	readaheadtreadahead_multiplytscheduler_quantum(RR*(R-((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_get_config_optionsCscCs
ddgS(NR>R?((R-((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt#_get_config_options_used_by_dynamicOscCs�t|_d|_d|_|j|jd�r|t|_|jjd|j	�|_
i|_i|_i|_
i|_nt|_d|_
dS(NiR<R!(Rt_has_static_tuningt_apm_errcntt_spindown_errcntt_option_booltoptionst_has_dynamic_tuningt_monitors_repositorytcreatetassigned_devicesR5t_device_idlet_statst_idlet_spindown_change_delayedtFalseR*(R
R8((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_instance_initVs									cCs2|jdk	r.|jj|j�d|_ndS(N(R5R*RKtdelete(R
R8((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_instance_cleanupiscCs�|rd}|j}nd}|j}|tjkr:dS|dkrOd}ne|tjkr�tjd|_|_tjd�dS|d7}|tjkr�tjd|�n|r�||_n	||_dS(NR?R>iisIhdparm command not found, ignoring future set_apm / set_spindown commandss5disabling set_%s command: too many consecutive errors(	RGRFtconststERROR_THRESHOLDterrnotENOENTtlogtwarntinfo(R
trcR?tstcnt((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_update_errcntns&		

cCsgtjd|�|jjdd|d|gdtjg�\}}|j|t�t|j	|<dS(Nschanging spindown to %dthdparms-S%ds/dev/%st	no_errors(
RZtdebugRtexecuteRXRYR`RRRRQ(R
R8Rtnew_spindown_levelR]tout((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_change_spindown�s5cCsG|jjddd|gdtjg�\}}d|koFd|kS(NRas-Cs/dev/%sRbtstandbytsleeping(RRdRXRY(R
RR]Rf((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_drive_spinning�s1cCs�|jj|�}|dkr"dS||jkrD|j||�n|j|||�|j||�|j|}|j|}|dd|jkr�|d|j	kr�|d|j	kr�d}n?|ddkr|ddks�|ddkrd}nd}|dkr,|dc|7<|j
|d}|j|d}tj
d|d�|jtjkr�|j|�r�|dkr�tj
d|�t|j|<q�|j|||�n|jtjkrotj
d	|�|jjd
d|d|gd
tjg�\}	}
|j|	t�qonC|j|ro|j|�ro|j|d}|j|||�ntj
d||d|df�tj
d||d|d|df�dS(Ntlevelitreadtwriteii����stuning level changed to %ds;delaying spindown change to %d, drive has already spun downschanging APM_level to %dRas-B%ds/dev/%sRbs %s load: read %0.2f, write %0.2fs$%s idle: read %d, write %d, level %d(R5tget_device_loadR*ROt_init_stats_and_idlet
_update_statst_update_idleRPR	R
RRRZRcRGRVRWRjRRQRgRFRRdRXRYR`RR(R
R8Rtloadtstatstidletlevel_changetnew_power_levelReR]Rf((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_instance_update_dynamic�sB

=	0	5"cCsjiddgd6ddgd6ddgd6|j|<idd6dd6dd	6|j|<t|j|<dS(
NiitnewtolditmaxRkRlRm(RORPRRRQ(R
R8R((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRo�s7"c
Cs|j|d|j|d<}||j|d<gt||�D]}|d|d^qA}||j|d<|j|d}gt||�D]}t|�^q�}	|	|j|d<t|d�t|	d�|j|d<t|d�t|	d�|j|d	<dS(
NRxRyiitdiffRzRliRm(ROtzipRztfloat(
R
R8Rtnew_loadtold_loadtnew_oldR{told_max_loadtpairtmax_load((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRp�s .()cCs`xYddgD]K}|j|||jkrG|j||cd7<q
d|j||<q
WdS(NRlRmii(RORRP(R
R8Rt	operation((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRq�scCsdS(N((R
R8R((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_instance_unapply_dynamic�ss/sys/block/cCs_d|krItjj||jdd�|�}tjj|�rI|Sntjj|||�S(Nt/t!(tostpathtjointreplacetexists(R
Rtsuffixtprefixtdev((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_sysfs_path�s
$cCs|j|d�S(Nsqueue/scheduler(R�(R
R((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_elevator_file�sR=t
per_devicecCs/|j|�}|s+|jj||�n|S(N(R�Rt
write_to_file(R
tvalueRtsimtsys_file((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt
_set_elevator�scCs1|j|�}|jj|jj|d|��S(Ntno_error(R�Rtget_active_optiont	read_file(R
Rtignore_missingR�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt
_get_elevator�sR>cCsw|jtjkro|se|jjddt|�d|gdtjg�\}}|j|t	�nt|�SdSdS(NRas-Bs/dev/Rb(RFRVRWRRdtstrRXRYR`RRR*(R
R�RR�R]Rf((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_set_apm�s:
cCs�d}t}|jjddd|gdtjg�\}}|tjkrQdS|dkrft}nTtjd|tj	�}|r�yt
|jd��}Wq�tk
r�t}q�Xn|r�t
jd|�n|S(	NRas-Bs/dev/Rbis
.*=\s*(\d+).*is2could not get current APM settings for device '%s'(R*RRRRdRXRYRtretmatchtStinttgroupt
ValueErrorRZterror(R
RR�R�terrR]Rftm((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_get_apms 1	

R?cCsw|jtjkro|se|jjddt|�d|gdtjg�\}}|j|t	�nt|�SdSdS(NRas-Ss/dev/Rb(RGRVRWRRdR�RXRYR`RR*(R
R�RR�R]Rf((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt
_set_spindowns:
cCsdS(Ni�((R
RR�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt
_get_spindown!scCs|j|d�S(Nsqueue/read_ahead_kb(R�(R
R((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_readahead_file&scCs_t|�jdd�}t|d�}t|�dkr[|dddkr[|d:}n|S(NiiR^i(R�tsplitR*R�R(R
R�tvaltv((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt	_parse_ra)s
&
R@cCsB|j|�}|j|�}|s>|jj|d|�n|S(Ns%d(R�R�RR�(R
R�RR�R�R�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_set_readahead1s
cCsM|j|�}|jj|d|�j�}t|�dkrCdSt|�S(NR�i(R�RR�tstripRR*R�(R
RR�R�R�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_get_readahead9s
RAc	Cs�|r
dS|jddd|�}|r�|j|�}|dkrGdStt|�|�}|jj||�|j||t�nE|jj	|�}|dkr�dS|j||t�|jj
|�dS(Ntcommand_nameRAR9(R*t_storage_keyR�R�R}t_storageRR�RRR)tunset(	R
tenablingt
multiplierRtverifyR�tstorage_keyt
old_readaheadt
new_readahead((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_multiply_readaheadAs"		cCs|j|d�S(Nsqueue/iosched/quantum(R�(R
R((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_scheduler_quantum_fileVsRBcCs9|j|�}|s5|jj|dt|��n|S(Ns%d(R�RR�R�(R
R�RR�R�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_set_scheduler_quantumYs cCsc|j|�}|jj|d|�j�}t|�dkrY|sUtjd�ndSt|�S(NR�is9disk_scheduler_quantum option is not supported by this HW(	R�RR�R�RRZR\R*R�(R
RR�R�R�((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt_get_scheduler_quantum`s(.t__name__t
__module__t__doc__RRR tclassmethodRR0R2R/R7R;RCRDRSRUR`RgRjRwRoRpRqR�R�R�tcommand_setRR�tcommand_getRRR�R�R�R�R�R�R�R�R�tcommand_customR�R�R�R�(((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyRsV	
	
												0						
	
						(RXtRt
decoratorst
tuned.logsttunedttuned.constsRVttuned.utils.commandsRR�R�tlogsR)RZtPluginR(((s=/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.pyt<module>s


Filemanager

Name Type Size Permission Actions
instance Folder 0755
.__init__.pyo.40009 File 232 B 0644
.base.pyo.40009 File 24.43 KB 0644
.decorators.pyo.40009 File 1.52 KB 0644
.exceptions.pyo.40009 File 460 B 0644
.hotplug.pyo.40009 File 4.09 KB 0644
.plugin_audio.pyo.40009 File 4.36 KB 0644
.plugin_bootloader.pyo.40009 File 15.47 KB 0644
.plugin_disk.pyo.40009 File 15.23 KB 0644
.plugin_eeepc_she.pyo.40009 File 3.3 KB 0644
.plugin_modules.pyo.40009 File 5.64 KB 0644
.plugin_mounts.pyo.40009 File 6.36 KB 0644
.plugin_net.pyo.40009 File 16.5 KB 0644
.plugin_scheduler.pyo.40009 File 25.28 KB 0644
.plugin_scsi_host.pyo.40009 File 5.01 KB 0644
.plugin_selinux.pyo.40009 File 2.96 KB 0644
.plugin_sysctl.pyo.40009 File 7.33 KB 0644
.plugin_sysfs.pyo.40009 File 3.77 KB 0644
.plugin_systemd.pyo.40009 File 6.87 KB 0644
.plugin_usb.pyo.40009 File 3.06 KB 0644
.plugin_video.pyo.40009 File 4.2 KB 0644
.plugin_vm.pyo.40009 File 4.31 KB 0644
__init__.py File 49 B 0644
__init__.pyc File 232 B 0644
__init__.pyo File 232 B 0644
base.py File 21.7 KB 0644
base.pyc File 24.43 KB 0644
base.pyo File 24.43 KB 0644
decorators.py File 983 B 0644
decorators.pyc File 1.52 KB 0644
decorators.pyo File 1.52 KB 0644
exceptions.py File 99 B 0644
exceptions.pyc File 460 B 0644
exceptions.pyo File 460 B 0644
hotplug.py File 2.97 KB 0644
hotplug.pyc File 4.09 KB 0644
hotplug.pyo File 4.09 KB 0644
plugin_audio.py File 2.46 KB 0644
plugin_audio.pyc File 4.36 KB 0644
plugin_audio.pyo File 4.36 KB 0644
plugin_bootloader.py File 12.6 KB 0644
plugin_bootloader.pyc File 15.47 KB 0644
plugin_bootloader.pyo File 15.47 KB 0644
plugin_cpu.py File 12.95 KB 0644
plugin_cpu.pyc File 15.46 KB 0644
plugin_cpu.pyo File 15.42 KB 0644
plugin_disk.py File 13.77 KB 0644
plugin_disk.pyc File 16.92 KB 0644
plugin_disk.pyo File 16.92 KB 0644
plugin_eeepc_she.py File 2.04 KB 0644
plugin_eeepc_she.pyc File 3.3 KB 0644
plugin_eeepc_she.pyo File 3.3 KB 0644
plugin_modules.py File 3.8 KB 0644
plugin_modules.pyc File 5.64 KB 0644
plugin_modules.pyo File 5.64 KB 0644
plugin_mounts.py File 5.17 KB 0644
plugin_mounts.pyc File 6.36 KB 0644
plugin_mounts.pyo File 6.36 KB 0644
plugin_net.py File 14.02 KB 0644
plugin_net.pyc File 16.5 KB 0644
plugin_net.pyo File 16.5 KB 0644
plugin_scheduler.py File 23.2 KB 0644
plugin_scheduler.pyc File 25.28 KB 0644
plugin_scheduler.pyo File 25.28 KB 0644
plugin_script.py File 2.47 KB 0644
plugin_script.pyc File 3.77 KB 0644
plugin_script.pyo File 3.71 KB 0644
plugin_scsi_host.py File 2.59 KB 0644
plugin_scsi_host.pyc File 5.01 KB 0644
plugin_scsi_host.pyo File 5.01 KB 0644
plugin_selinux.py File 1.56 KB 0644
plugin_selinux.pyc File 2.96 KB 0644
plugin_selinux.pyo File 2.96 KB 0644
plugin_sysctl.py File 5.45 KB 0644
plugin_sysctl.pyc File 7.33 KB 0644
plugin_sysctl.pyo File 7.33 KB 0644
plugin_sysfs.py File 2.05 KB 0644
plugin_sysfs.pyc File 3.77 KB 0644
plugin_sysfs.pyo File 3.77 KB 0644
plugin_systemd.py File 4.82 KB 0644
plugin_systemd.pyc File 6.87 KB 0644
plugin_systemd.pyo File 6.87 KB 0644
plugin_usb.py File 1.49 KB 0644
plugin_usb.pyc File 3.06 KB 0644
plugin_usb.pyo File 3.06 KB 0644
plugin_video.py File 2.81 KB 0644
plugin_video.pyc File 4.2 KB 0644
plugin_video.pyo File 4.2 KB 0644
plugin_vm.py File 2.74 KB 0644
plugin_vm.pyc File 4.31 KB 0644
plugin_vm.pyo File 4.31 KB 0644
repository.py File 1.49 KB 0644
repository.pyc File 2.46 KB 0644
repository.pyo File 2.4 KB 0644