HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_scsi_host.cpython-39.pyc
a

Y��d�@slddlZddlmZddlTddlZddlmZddlm	Z	ddl
Z
ddlZej�
�ZGdd�dej�ZdS)�N�)�hotplug)�*)�commandscs�eZdZdZ�fdd�Z�fdd�Zdd�Zedd	��Zd
d�Z	dd
�Z
�fdd�Z�fdd�Z�fdd�Z
edd��Zdd�Zdd�Zdd�Zeddd�dd ��Zed�d$d"d#��Z�ZS)%�SCSIHostPlugina�
	`scsi_host`::
	
	Tunes options for SCSI hosts.
	+
	The plug-in sets Aggressive Link Power Management (ALPM) to the value specified
	by the [option]`alpm` option. The option takes one of three values:
	`min_power`, `medium_power` and `max_performance`.
	+
	NOTE: ALPM is only available on SATA controllers that use the Advanced
	Host Controller Interface (AHCI).
	+
	.ALPM setting when extended periods of idle time are expected
	====
	----
	[scsi_host]
	alpm=min_power
	----
	====
	cs"tt|�j|i|��t�|_dS�N)�superr�__init__r�_cmd)�self�args�kwargs��	__class__��B/usr/lib/python3.9/site-packages/tuned/plugins/plugin_scsi_host.pyr	"szSCSIHostPlugin.__init__csRtt|���d|_t�|_|j�d�D]}|�|�r(|j�	|j
�q(t�|_dS)NT�scsi)rr�
_init_devicesZ_devices_supported�setZ
_free_devices�_hardware_inventoryZget_devices�_device_is_supported�addZsys_nameZ_assigned_devices�r�devicerrrr's
zSCSIHostPlugin._init_devicescs�fdd�|D�S)Ncsg|]}�j�d|��qS)r)rZ
get_device)�.0�x�rrr�
<listcomp>2�z6SCSIHostPlugin._get_device_objects.<locals>.<listcomp>r)rZdevicesrrr�_get_device_objects1sz"SCSIHostPlugin._get_device_objectscCs
|jdkS)NZ	scsi_host)Zdevice_type)�clsrrrrr4sz#SCSIHostPlugin._device_is_supportedcCs|j�|d|j�dS)Nr)rZ	subscribe�_hardware_events_callbackrrrr�_hardware_events_init8sz$SCSIHostPlugin._hardware_events_initcCs|j�|�dSr)rZunsubscriberrrr�_hardware_events_cleanup;sz'SCSIHostPlugin._hardware_events_cleanupcs |�|�rtt|��||�dSr)rrrr!)rZeventrrrrr!>s
z(SCSIHostPlugin._hardware_events_callbackcstt|��||�dSr)rr�_added_device_apply_tuning�r�instanceZdevice_namerrrr$Bsz)SCSIHostPlugin._added_device_apply_tuningcstt|��||�dSr)rr�_removed_device_unapply_tuningr%rrrr'Esz-SCSIHostPlugin._removed_device_unapply_tuningcCsddiS)N�alpmr)r rrr�_get_config_optionsHs�z"SCSIHostPlugin._get_config_optionscCsd|_d|_dS)NTF)Z_has_static_tuningZ_has_dynamic_tuning�rr&rrr�_instance_initNszSCSIHostPlugin._instance_initcCsdSrrr*rrr�_instance_cleanupRsz SCSIHostPlugin._instance_cleanupcCstj�dt|�d�S)Nz/sys/class/scsi_host/Zlink_power_management_policy)�os�path�join�strrrrr�_get_alpm_policy_fileUsz$SCSIHostPlugin._get_alpm_policy_filer(T)Z
per_devicecCsT|durdS|�|�}|sPtj�|�r6|j�||�nt�d|t|�f�dS|S)NzBALPM control file ('%s') not found, skipping ALPM setting for '%s')	r1r-r.�existsr
Z
write_to_file�log�infor0)r�policyrZsim�policy_filerrr�	_set_alpmXs
zSCSIHostPlugin._set_alpmFcCs.|�|�}|jj|dd���}|dkr*|SdS)NT)Zno_error�)r1r
Z	read_file�strip)rrZignore_missingr6r5rrr�	_get_alpmes
zSCSIHostPlugin._get_alpm)F)�__name__�
__module__�__qualname__�__doc__r	rr�classmethodrr"r#r!r$r'r)r+r,r1Zcommand_setr7Zcommand_getr:�
__classcell__rrrrrs(




r)�errnor8rZ
decoratorsZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrr-�reZlogs�getr3ZPluginrrrrr�<module>s