HEX
Server: Apache
System: Linux nc-ph-4101.simplemoneygoals.com 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User: dailygoldindex (1004)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_scsi_host.cpython-39.pyc
a

,�gN�@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�
	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>0�z6SCSIHostPlugin._get_device_objects.<locals>.<listcomp>r)rZdevicesrrr�_get_device_objects/sz"SCSIHostPlugin._get_device_objectscCs
|jdkS)NZ	scsi_host)Zdevice_type)�clsrrrrr2sz#SCSIHostPlugin._device_is_supportedcCs|j�|d|j�dS)Nr)rZ	subscribe�_hardware_events_callbackrrrr�_hardware_events_init6sz$SCSIHostPlugin._hardware_events_initcCs|j�|�dSr)rZunsubscriberrrr�_hardware_events_cleanup9sz'SCSIHostPlugin._hardware_events_cleanupcs |�|�rtt|��||�dSr)rrrr!)rZeventrrrrr!<s
z(SCSIHostPlugin._hardware_events_callbackcstt|��||�dSr)rr�_added_device_apply_tuning�r�instanceZdevice_namerrrr$@sz)SCSIHostPlugin._added_device_apply_tuningcstt|��||�dSr)rr�_removed_device_unapply_tuningr%rrrr'Csz-SCSIHostPlugin._removed_device_unapply_tuningcCsddiS)N�alpmr)r rrr�_get_config_optionsFs�z"SCSIHostPlugin._get_config_optionscCsd|_d|_dS)NTF)Z_has_static_tuningZ_has_dynamic_tuning�rr&rrr�_instance_initLszSCSIHostPlugin._instance_initcCsdSrrr*rrr�_instance_cleanupPsz SCSIHostPlugin._instance_cleanupcCstj�dt|�d�S)Nz/sys/class/scsi_host/Zlink_power_management_policy)�os�path�join�strrrrr�_get_alpm_policy_fileSsz$SCSIHostPlugin._get_alpm_policy_filer(T)Z
per_devicecCsd|durdS|�|�}|s`tj�|�rF|jj|||r<tjgndd�nt�	d|t
|�f�dS|S)NF�Zno_errorzBALPM control file ('%s') not found, skipping ALPM setting for '%s')r1r-r.�existsr
Z
write_to_file�errno�ENOENT�log�infor0)r�policyrr&Zsim�remove�policy_filerrr�	_set_alpmVs

�zSCSIHostPlugin._set_alpmFcCs.|�|�}|jj|dd���}|dkr*|SdS)NTr2�)r1r
Z	read_file�strip)rrr&Zignore_missingr:r8rrr�	_get_alpmds
zSCSIHostPlugin._get_alpm)F)�__name__�
__module__�__qualname__�__doc__r	rr�classmethodrr"r#r!r$r'r)r+r,r1Zcommand_setr;Zcommand_getr>�
__classcell__rrrrrs(





r)r4r<rZ
decoratorsZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsrr-�reZlogs�getr6ZPluginrrrrr�<module>s