rtslib/utils.py
def convert_scsi_hctl_to_path(host, controller, target, lun):
    '''
    This function returns a udev path pointing to the block device being
    mapped to the SCSI device that has the provided H:C:T:L.

    >>> import rtslib.utils as utils
    >>> utils.convert_scsi_hctl_to_path(0,0,0,0)
    ''
    >>> utils.convert_scsi_hctl_to_path(2,0,0,0) # doctest: +ELLIPSIS
    '/dev/s...0'
    >>> utils.convert_scsi_hctl_to_path(3,0,2,0)
    '/dev/sdc'

    @param host: The SCSI host id.
    @type host: int
    @param controller: The SCSI controller id.
    @type controller: int
    @param target: The SCSI target id.
    @type target: int
    @param lun: The SCSI Logical Unit Number.
    @type lun: int
    @return: A string for the canonical path to the device, or raise RTSLibError.
    '''
    try:
        host = int(host)
        controller = int(controller)
        target = int(target)
        lun = int(lun)
    except ValueError:
        raise RTSLibError(
            "The host, controller, target and lun parameter must be integers")

    hctl = [str(host), str(controller), str(target), str(lun)]
    try:
        scsi_device = pyudev.Device.from_name(_CONTEXT, 'scsi', ':'.join(hctl))
    except pyudev.DeviceNotFoundError:
        raise RTSLibError("Could not find path for SCSI hctl")

    devices = _CONTEXT.list_devices(
       subsystem='block',
       parent=scsi_device
    )

    path = next((dev.device_node for dev in devices), '')
    if path == None:
        raise RTSLibError("Could not find path for SCSI hctl")
    return path

    This function returns a udev path pointing to the block device being
    mapped to the SCSI device that has the provided H:C:T:L.

    >>> import rtslib.utils as utils
    >>> utils.convert_scsi_hctl_to_path(0,0,0,0)
    ''
    >>> utils.convert_scsi_hctl_to_path(2,0,0,0) # doctest: +ELLIPSIS
    '/dev/s...0'
    >>> utils.convert_scsi_hctl_to_path(3,0,2,0)
    '/dev/sdc'

    @param host: The SCSI host id.
    @type host: int
    @param controller: The SCSI controller id.
    @type controller: int
    @param target: The SCSI target id.
    @type target: int
    @param lun: The SCSI Logical Unit Number.
    @type lun: int
    @return: A string for the canonical path to the device, or raise RTSLibError.
    
This function returns a udev path pointing to the block device being
mapped to the SCSI device that has the provided H:C:T:L.


This function returns a udev path pointing to the block device being mapped to the SCSI device that has the provided H : C : T : L .
def convert_scsi_hctl_to_path(host, controller, target, lun):
    try:
        host = int(host)
        controller = int(controller)
        target = int(target)
        lun = int(lun)
    except ValueError:
        raise RTSLibError(
            "The host, controller, target and lun parameter must be integers")
    hctl = [str(host), str(controller), str(target), str(lun)]
    try:
        scsi_device = pyudev.Device.from_name(_CONTEXT, 'scsi', ':'.join(hctl))
    except pyudev.DeviceNotFoundError:
        raise RTSLibError("Could not find path for SCSI hctl")
    devices = _CONTEXT.list_devices(
       subsystem='block',
       parent=scsi_device
    )
    path = next((dev.device_node for dev in devices), '')
    if path == None:
        raise RTSLibError("Could not find path for SCSI hctl")
    return path
def convert_scsi_hctl_to_path ( host , controller , target , lun ) : try : host = int ( host ) controller = int ( controller ) target = int ( target ) lun = int ( lun ) except ValueError : raise RTSLibError ( "The host, controller, target and lun parameter must be integers" ) hctl = [ str ( host ) , str ( controller ) , str ( target ) , str ( lun ) ] try : scsi_device = pyudev . Device . from_name ( _CONTEXT , 'scsi' , ':' . join ( hctl ) ) except pyudev . DeviceNotFoundError : raise RTSLibError ( "Could not find path for SCSI hctl" ) devices = _CONTEXT . list_devices ( subsystem = 'block' , parent = scsi_device ) path = next ( ( dev . device_node for dev in devices ) , '' ) if path == None : raise RTSLibError ( "Could not find path for SCSI hctl" ) return path
This function returns a udev path pointing to the block device being
mapped to the SCSI device that has the provided H:C:T:L.
This function returns a udev path pointing to the block device being mapped to the SCSI device that has the provided H : C : T : L .
'''
    This function returns a udev path pointing to the block device being
    mapped to the SCSI device that has the provided H:C:T:L.

    >>> import rtslib.utils as utils
    >>> utils.convert_scsi_hctl_to_path(0,0,0,0)
    ''
    >>> utils.convert_scsi_hctl_to_path(2,0,0,0) # doctest: +ELLIPSIS
    '/dev/s...0'
    >>> utils.convert_scsi_hctl_to_path(3,0,2,0)
    '/dev/sdc'

    @param host: The SCSI host id.
    @type host: int
    @param controller: The SCSI controller id.
    @type controller: int
    @param target: The SCSI target id.
    @type target: int
    @param lun: The SCSI Logical Unit Number.
    @type lun: int
    @return: A string for the canonical path to the device, or raise RTSLibError.
    '''
A string for the canonical path to the device, or raise RTSLibError.
A string for the canonical path to the device or raise RTSLibError .
host
The SCSI host id.
The SCSI host id .
controller
The SCSI controller id.
The SCSI controller id .
target
The SCSI target id.
The SCSI target id .
lun
The SCSI Logical Unit Number.
The SCSI Logical Unit Number .