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: //lib64/python3.9/site-packages/lsm/__pycache__/_local_disk.cpython-39.pyc
a

B�:fvb�@s�ddlZddlmZmZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZdd�ZGdd�de�ZdS)�N)�LsmError�ErrorNumber)�_local_disk_vpd83_search�_local_disk_vpd83_get�_local_disk_health_status_get�_local_disk_rpm_get�_local_disk_list�_local_disk_link_type_get�_local_disk_ident_led_on�_local_disk_ident_led_off�_local_disk_fault_led_on�_local_disk_fault_led_off�_local_disk_serial_num_get�_local_disk_led_status_get�_local_disk_link_speed_get�_local_led_slot_handle_get�_local_led_slot_handle_free�_local_led_slot_iterator_get�_local_led_slot_iterator_free�_local_led_slot_iterator_next�_local_led_slot_status_get�_local_led_slot_status_set�_local_led_slot_id�_local_led_slot_device�_local_led_slot_iterator_resetcCs&||�\}}}|tjkr"t||��|S)N)r�OKr)Zfunc_ref�arg�data�err_no�err_msg�r �5/usr/lib64/python3.9/site-packages/lsm/_local_disk.py�_use_c_lib_functions

r"c@s�eZdZedd��Zedd��Zedd��Zedd��Zed	d
��Zedd��Z	ed
d��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zedd��ZGdd�de�ZGdd�de�Zedd ��Zd!S)"�	LocalDiskcCs
tt|�S)a
        lsm.LocalDisk.vpd83_search(vpd83)

        Version:
            1.3
        Usage:
            Find out the disk paths for given SCSI VPD page 0x83 NAA type
            ID. Considering multi-path, some VPD83 may have multiple disks
            associated.
        Parameters:
            vpd83 (string)
                The VPD83 NAA type ID.
        Returns:
            [disk_path]
                List of string. Empty list if not disk found.
                The disk_path string format is '/dev/sd[a-z]+' for SCSI and
                ATA disks.
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"r)Zvpd83r r r!�vpd83_search#szLocalDisk.vpd83_searchcCs
tt|�S)ak
        lsm.LocalDisk.serial_num_get(disk_path)

        Version:
            1.4
        Usage:
            Query the SCSI VPD80 serial number of given disk path.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            serial_num (string)
                String of VPD80 serial number. Empty string if not supported.
                The string format regex is:
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"r�Z	disk_pathr r r!�serial_num_get@szLocalDisk.serial_num_getcCs
tt|�S)a�
        lsm.LocalDisk.vpd83_get(disk_path)

        Version:
            1.3
        Usage:
            Query the SCSI VPD83 NAA ID of given disk path.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            vpd83 (string)
                String of VPD83 NAA ID. Empty string if not supported.
                The string format regex is:
                    (?:^6[0-9a-f]{31})|(?:^[235][0-9a-f]{15})$
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�	vpd83_get^szLocalDisk.vpd83_getcCs
tt|�S)a
        lsm.LocalDisk.health_status_get(disk_path)

        Version:
            1.5
        Usage:
            Retrieve the health status of given disk path.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            health_status (integer)
                Disk health status:
                    -1 (lsm.Disk.HEALTH_STATUS_UNKNOWN):
                        Unknown health status
                     0 (lsm.Disk.HEALTH_STATUS_FAIL):
                        health status indicates failure
                     1 (lsm.Disk.HEALTH_STATUS_WARN):
                        health status warns of near failure
                     2 (lsm.Disk.HEALTH_STATUS_GOOD):
                        health status indicates good health
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Not supported.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�health_status_get}s%zLocalDisk.health_status_getcCs
tt|�S)ax
        Version:
            1.3
        Usage:
            Query the disk rotation speed - revolutions per minute (RPM) of
            given disk path.
            Require permission to open disk path as read-only and non-block,
            normally it's root or disk group privilege.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb', '/dev/nvme0n1'.
        Returns:
            rpm (integer)
                Disk rotation speed:
                    -1 (lsm.Disk.RPM_UNKNOWN):
                        Unknown RPM
                     0 (lsm.Disk.RPM_NON_ROTATING_MEDIUM):
                        Non-rotating medium (e.g., SSD)
                     1 (lsm.Disk.RPM_ROTATING_UNKNOWN_SPEED):
                        Rotational disk with unknown speed
                    >1:
                        Normal rotational disk (e.g., HDD)

        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Not supported.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�rpm_get�s'zLocalDisk.rpm_getcCs$t�\}}}|tjkr t||��|S)am
        Version:
            1.3
        Usage:
            Query local disk paths. Currently, only SCSI, ATA and NVMe disks
            will be included.
        Parameters:
            N/A
        Returns:
            [disk_path]
                List of string. Empty list if not disk found.
                The disk_path string format is '/dev/sd[a-z]+' for SCSI and
                ATA disks, '/dev/nvme[0-9]+n[0-9]+' for NVMe disks.
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
        Capability:
            N/A
                No capability required as this is a library level method.
        )rrrr)Z
disk_pathsrrr r r!�list�s

zLocalDisk.listcCs
tt|�S)a	
        Version:
            1.3
        Usage:
            Query the disk link type of given disk path.
            For SATA disks connected to SAS enclosure, will return
            lsm.Disk.LINK_TYPE_ATA.
            Require permission to open disk_path(root user or disk group).
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            link_type (integer)
                Link type, possible values are:
                    lsm.Disk.LINK_TYPE_UNKNOWN
                        Failed to detect link type
                    lsm.Disk.LINK_TYPE_FC
                        Fibre Channel
                    lsm.Disk.LINK_TYPE_SSA
                        Serial Storage Architecture, Old IBM tech.
                    lsm.Disk.LINK_TYPE_SBP
                        Serial Bus Protocol, used by IEEE 1394.
                    lsm.Disk.LINK_TYPE_SRP
                        SCSI RDMA Protocol
                    lsm.Disk.LINK_TYPE_ISCSI
                        Internet Small Computer System Interface
                    lsm.Disk.LINK_TYPE_SAS
                        Serial Attached SCSI
                    lsm.Disk.LINK_TYPE_ADT
                        Automation/Drive Interface Transport
                        Protocol, often used by Tape.
                    lsm.Disk.LINK_TYPE_ATA
                        PATA/IDE or SATA.
                    lsm.Disk.LINK_TYPE_USB
                        USB disk.
                    lsm.Disk.LINK_TYPE_SOP
                        SCSI over PCI-E
                    lsm.Disk.LINK_TYPE_PCIE
                        PCI-E, e.g. NVMe
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    Insufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"r	r%r r r!�
link_type_get�s9zLocalDisk.link_type_getcCs
tt|�S)a
        Version:
            1.3
        Usage:
            Turn on the identification LED for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            None
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"r
r%r r r!�ident_led_on(szLocalDisk.ident_led_oncCs
tt|�S)a
        Version:
            1.3
        Usage:
            Turn off the identification LED for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            None
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�
ident_led_offDszLocalDisk.ident_led_offcCs
tt|�S)a
        Version:
            1.3
        Usage:
            Turn on the fault LED for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            None
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�fault_led_on`szLocalDisk.fault_led_oncCs
tt|�S)a�
        Version:
            1.3
        Usage:
            Turn off the fault LED for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            None
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"r
r%r r r!�
fault_led_off|szLocalDisk.fault_led_offcCs
tt|�S)a
        Version:
            1.3
        Usage:
            Get LED status for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            led_status (integer, bit map)
                Could be combination of these values:
                    lsm.Disk.LED_STATUS_UNKNOWN
                    lsm.Disk.LED_STATUS_IDENT_ON
                    lsm.Disk.LED_STATUS_IDENT_OFF
                    lsm.Disk.LED_STATUS_IDENT_UNKNOWN
                        Has identification LED, but status is unknown.
                        If certain disk has no identification LED,
                        'led_status' should not contain
                        'lsm.Disk.LED_STATUS_IDENT_ON' or
                        'lsm.Disk.LED_STATUS_IDENT_OFF' or
                        'lsm.Disk.LED_STATUS_IDENT_UNKNOWN'
                    lsm.Disk.LED_STATUS_FAULT_ON
                    lsm.Disk.LED_STATUS_FAULT_OFF
                    lsm.Disk.LED_STATUS_FAULT_UNKNOWN
                        Has fault LED, but status is unknown.
                        If certain disk has no fault LED,
                        'led_status' should not contain
                        'lsm.Disk.LED_STATUS_FAULT_ON' or
                        'lsm.Disk.LED_STATUS_FAULT_OFF' or
                        'lsm.Disk.LED_STATUS_FAULT_UNKNOWN'
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk does not support SCSI SPC.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�led_status_get�s0zLocalDisk.led_status_getcCs
tt|�S)a�
        Version:
            1.4
        Usage:
            Get current negotiated logical link speed for specified disk.
        Parameters:
            disk_path (string)
                The disk path, example '/dev/sdb'.
        Returns:
            link_speed
                Integer for link speed in Mbps. For example, '3.0 Gbps' will
                get 3000.
        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.INVALID_ARGUMENT
                    Invalid disk_path. Should be like '/dev/sdb'.
                ErrorNumber.NOT_FOUND_DISK
                    Provided disk is not found.
                ErrorNumber.NO_SUPPORT
                    Provided disk is not supported yet.
                ErrorNumber.PERMISSION_DENIED
                    No sufficient permission to access provided disk path.
        Capability:
            N/A
                No capability required as this is a library level method.
        )r"rr%r r r!�link_speed_get�szLocalDisk.link_speed_getc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
zLocalDisk.LedSlotzm
        Class that represents a "slot" which has data and behavior relating to turning LEDs off/on.
        cCs||_||_dS)z�
            Version:
                1.10
            Usage:
                Object initializer for LedSlot
            Parameters:
                handle (unsigned long long)
                slot (unsigned long long)
            N)�h�s)�self�handle�slotr r r!�__init__�s
zLocalDisk.LedSlot.__init__cCs
t|j�S)zu
            Version:
                1.10

            Returns the string identifier for the given slot
            )rr3�r4r r r!�id�szLocalDisk.LedSlot.idcCs
t|j�S)z�
            Version:
                1.10

            Returns the slot device node for the given slot, can be "None" as a slot may not have
            a device node.
            )rr3r8r r r!�deviceszLocalDisk.LedSlot.devicecCs
t|j�S)a�
            Version:
                1.10

            led_status (integer, bit map)
                Could be combination of these values:
                    lsm.Disk.LED_STATUS_UNKNOWN
                    lsm.Disk.LED_STATUS_IDENT_ON
                    lsm.Disk.LED_STATUS_IDENT_OFF
                    lsm.Disk.LED_STATUS_IDENT_UNKNOWN
                        Has identification LED, but status is unknown.
                        If certain disk has no identification LED,
                        'led_status' should not contain
                        'lsm.Disk.LED_STATUS_IDENT_ON' or
                        'lsm.Disk.LED_STATUS_IDENT_OFF' or
                        'lsm.Disk.LED_STATUS_IDENT_UNKNOWN'
                    lsm.Disk.LED_STATUS_FAULT_ON
                    lsm.Disk.LED_STATUS_FAULT_OFF
                    lsm.Disk.LED_STATUS_FAULT_UNKNOWN
                        Has fault LED, but status is unknown.
                        If disk has no fault LED,
                        'led_status' should not contain
                        'lsm.Disk.LED_STATUS_FAULT_ON' or
                        'lsm.Disk.LED_STATUS_FAULT_OFF' or
                        'lsm.Disk.LED_STATUS_FAULT_UNKNOWN'
            )rr3r8r r r!�stateszLocalDisk.LedSlot.statecCs.t|j|j|�\}}}|tjkr*t||��dS)a7
            Version:
                1.10

            Sets the state for the given slot. Please note that not all LED hardware supports both
            identification and fault LEDs.  Using this API, please specify what you would like regardless
            of support and the hardware will adhere to your request as best it can.

            Parameters:
                led_state: (bitmap) with one of the following combinations
                LSM_DISK_LED_STATUS_IDENT_ON => Implies fault off,
                LSM_DISK_LED_STATUS_FAULT_ON => Implies ident and fault on
                LSM_DISK_LED_STATUS_IDENT_OFF => Implies both ident and fault are off,
                LSM_DISK_LED_STATUS_FAULT_OFF => Implies both ident and fault are off,
                (LSM_DISK_LED_STATUS_IDENT_OFF | LSM_DISK_LED_STATUS_FAULT_OFF)
                (LSM_DISK_LED_STATUS_IDENT_ON | LSM_DISK_LED_STATUS_FAULT_OFF)
                (LSM_DISK_LED_STATUS_FAULT_ON | LSM_DISK_LED_STATUS_IDENT_OFF)
                (LSM_DISK_LED_STATUS_IDENT_ON | LSM_DISK_LED_STATUS_FAULT_ON)

            SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.PERMISSION_DENIED
                    Insufficient permissions.

            Returns:
                None
            N)rr2r3rrr)r4Z	led_state�_rrr r r!�	state_set.s�

zLocalDisk.LedSlot.state_setN)	�__name__�
__module__�__qualname__�__doc__r7r9r:r;r=r r r r!�LedSlot�s
	
rBc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)zLocalDisk.LEDSlotsItrzr
            Version:
                1.10

            Class the provides for the iterator functionality
        cCs||_d|_d|_dS)z^
            Version:
                1.10

            Initializes the iterator.
            NF)r2�i�done)r4r5r r r!r7ZszLocalDisk.LEDSlotsItr.__init__cCsN|jdur6t|j�\}}}|tjkr.t||��||_nt|j|j�d|_|S)�v
            Version:
                1.10

            Provides needed method of normal python iteration
            NF)rCrr2rrrrrD)r4�itrrrr r r!�__iter__fs


zLocalDisk.LEDSlotsItr.__iter__cCsP|jdurL|jdurL|jdkrLt|j|j�}|dkrBt�|j|�Sd|_t�dS)rENFrT)r2rCrDrr#rB�
StopIteration)r4r6r r r!�__next__yszLocalDisk.LEDSlotsItr.__next__cCs|S)�v
            Version:
                1.10

            Provides needed method for using "with" statement
            r r8r r r!�	__enter__�szLocalDisk.LEDSlotsItr.__enter__cCs|��dS)rJN)�close)r4Z_e_tZ_e_vZ_e_tbr r r!�__exit__�szLocalDisk.LEDSlotsItr.__exit__cCs<|jdurt|j|j�d|_|jdur8t|j�d|_dS)z�
            Version:
                1.10

            Releases resources for iterator.  This needs to be called to prevent resource leaks.
            Alternatively, you can use the with statement to ensure this gets called.
            N)rCrr2rr8r r r!rL�s


zLocalDisk.LEDSlotsItr.closeN)
r>r?r@rAr7rGrIrKrMrLr r r r!�LEDSlotsItrRs		rNcCs*t�\}}}|tjkr t||��t�|�S)ai
        Version 1.10

        Obtains a slots iterator.

        Parameters:
            None

        Returns LEDSlotsItr

        Note: You must call `close()` on returned object to free resources.  'with' statement
        is supported for returned iterator object.

        SpecialExceptions:
            LsmError
                ErrorNumber.LIB_BUG
                    Internal bug.
                ErrorNumber.PERMISSION_DENIED
                    Insufficient permissions to use slots API.

        Capability:
            N/A
                No capability required as this is a library level method.
        )rrrrr#rN)r5rrr r r!�led_slots_open�s

zLocalDisk.led_slots_openN)r>r?r@�staticmethodr$r&r'r(r)r*r+r,r-r.r/r0r1�objectrBrNrOr r r r!r#!s<



&
(

:




1
fXr#)ZsixZlsmrrZ	lsm._clibrrrrrr	r
rrr
rrrrrrrrrrrrrr"rQr#r r r r!�<module>sd