MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/plugin_scsi_host.cpython-312.pyc
�

�]�i����ddlZddlmZddl�ddlZddlmZddlm	Z	ddl
Z
ddlZejj�ZGd�dej�Zy)�N�)�hotplug)�*)�commandsc����eZdZdZ�fd�Z�fd�Zd�Zed��Zd�Z	d�Z
�fd�Z�fd	�Z�fd
�Z
ed��Zd�Zd
�Zd�Zd�Zd�Zedd��d��Zed�dd��Z�xZS)�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 four values:
	`min_power`, `med_power_with_dipm`, `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=med_power_with_dipm
	----
	====
	c�J��tt|�
|i|��t�|_y�N)�superr�__init__r�_cmd)�self�args�kwargs�	__class__s   ��C/usr/lib/python3.12/site-packages/tuned/plugins/plugin_scsi_host.pyrzSCSIHostPlugin.__init__ s ������&��7��7��j�$�)�c�"��tt|��d|_t	�|_|jjd�D]9}|j|�s�|j
j|j��;t	�|_y)NT�scsi)rr�
_init_devices�_devices_supported�set�
_free_devices�_hardware_inventory�get_devices�_device_is_supported�add�sys_name�_assigned_devices)r�devicers  �rrzSCSIHostPlugin._init_devices%so������+�-� �$���u�$���(�(�4�4�V�<�f�
����'������6�?�?�+�=��5�$�rc�`�|D�cgc]}|jjd|��� c}Scc}w�Nr)r�
get_device)r�devices�xs   r�_get_device_objectsz"SCSIHostPlugin._get_device_objects/s-��BI�	J�'�Q�$�
"�
"�
-�
-�f�a�
8�'�	J�J��	Js�#+c� �|jdk(S)N�	scsi_host)�device_type)�clsr s  rrz#SCSIHostPlugin._device_is_supported2s��
�
�
��
+�+rc�R�|jj|d|j�yr")r�	subscribe�_hardware_events_callback�rs r�_hardware_events_initz$SCSIHostPlugin._hardware_events_init6s �����$�$�T�6�4�3Q�3Q�Rrc�:�|jj|�yr
)r�unsubscriber.s r�_hardware_events_cleanupz'SCSIHostPlugin._hardware_events_cleanup9s�����&�&�t�,rc�R��|j|�rtt|�||�yyr
)rrrr-)r�eventr rs   �rr-z(SCSIHostPlugin._hardware_events_callback<s'���	���v�&����8���G�'rc�.��tt|�||�yr
)rr�_added_device_apply_tuning�r�instance�device_namers   �rr6z)SCSIHostPlugin._added_device_apply_tuning@s������8��;�Orc�.��tt|�||�yr
)rr�_removed_device_unapply_tuningr7s   �rr;z-SCSIHostPlugin._removed_device_unapply_tuningCs������<�X�{�Src�
�ddiS)N�alpm�)r*s r�_get_config_optionsz"SCSIHostPlugin._get_config_optionsFs��
�$�
�rc� �d|_d|_y)NTF)�_has_static_tuning�_has_dynamic_tuning�rr8s  r�_instance_initzSCSIHostPlugin._instance_initLs�� $�(��!&�(�rc��yr
r>rCs  r�_instance_cleanupz SCSIHostPlugin._instance_cleanupPs��rc�V�tjjdt|�d�S)N�/sys/class/scsi_host/�link_power_management_policy��os�path�join�str�rr s  r�_get_alpm_policy_filez$SCSIHostPlugin._get_alpm_policy_fileSs��	�����-�s�6�{�<Z�	[�[rc�V�tjjdt|�d�S)NrH�
ahci_port_cmdrJrOs  r�_get_ahci_port_cmd_filez&SCSIHostPlugin._get_ahci_port_cmd_fileVs��	�����-�s�6�{�O�	L�Lrc��|j|�}tjj|�syt	|j
j
|�d�}|dzdk7S)NF�i$r)rSrKrL�isfile�intr
�	read_file)rr �
port_cmd_file�port_cmds    r�_is_external_sata_portz%SCSIHostPlugin._is_external_sata_portYsS���.�.�v�6�-�	�����
�	&�
�
����$�$�]�3�R�
8�(�
�&�	'�1�	,�,rr=T)�
per_devicec��|�y|j|�r"tjdt|�z�y|j	|�}|sxt
jj|�r3|jj|||rtjgnd��|Stjd|�dt|��d��y|S)NzUDevice '%s' is an external SATA controller, skipping ALPM setting to support hot plugF��no_errorzALPM control file ('z)') not found, skipping ALPM setting for '�')r[�log�inforNrPrKrL�existsr
�
write_to_file�errno�ENOENT)r�policyr r8�sim�remove�policy_files       r�	_set_alpmzSCSIHostPlugin._set_alpmbs����^�
�	� � ��(��8�8�c�fi�jp�fq�q�r�
��*�*�6�2�+�	��g�g�n�n�[�!��I�I���K��"(�����e��5�

�-��H�H�U`�be�fl�bm�
n�o��	�-rc��|j|�}|jj|d��j�}|dk7r|SdS)NTr^�)rPr
rX�strip)rr r8�ignore_missingrjrgs      r�	_get_alpmzSCSIHostPlugin._get_alpmusE���*�*�6�2�+��9�9���{�t��<�B�B�D�&��R�<��)�T�)r)F)�__name__�
__module__�__qualname__�__doc__rrr&�classmethodrr/r2r-r6r;r?rDrFrPrSr[�command_setrk�command_getrp�
__classcell__)rs@rrrs�����&�
!�K��,��,�S�-�H�P�T�����
'��\�M�-��f�4�(��)��$�f��*��*rr)rermr�
decorators�
tuned.logs�tuned�tuned.consts�consts�tuned.utils.commandsrrK�re�logs�getra�Pluginrr>rr�<module>r�s?�������)�	�	��j�j�n�n���m*�W�^�^�m*r