Example #1
0
    def get_list(self, _type=None):
        """
        :param _type: supported types are dasd-eckd, zfcp.
        Based on this devices will be retrieved
        :return: device data list.
        """
        device_paths = []
        if _type is None:
            device_paths.extend(utils.get_directories(syspath_eckd))
            device_paths.extend(utils.get_directories(syspath_zfcp))
        elif _type == DEV_TYPES[0]:
            device_paths = utils.get_directories(syspath_eckd)
        elif _type == DEV_TYPES[1]:
            device_paths = utils.get_directories(syspath_zfcp)
        else:
            wok_log.error("Invalid _type given. _type: %s" % _type)
            raise InvalidParameter("GS390XINVTYPE",
                                   {'supported_type': DEV_TYPES})
        if not device_paths:
            return []
        command = [lscss]
        msg = 'The command executed is "%s" ' % command
        wok_log.debug(msg)
        out, err, rc = run_command(command)
        if rc:
            err = err.strip().replace("lscss:", '').strip()
            wok_log.error(err)
            raise OperationFailed("GS390XCMD0001E", {
                'command': command,
                'rc': rc,
                'reason': err
            })

        device_pattern = r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
                         r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
                         r'(\w+\/\w+)\s+' \
                         r'(\w+\/\w+)\s' \
                         r'(\s{3}|yes)\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'(\w+\s\w+)'

        devices = utils.get_rows_info(out,
                                      HEADER_PATTERN,
                                      device_pattern,
                                      unique_col='device',
                                      format_data=_format_lscss)
        device_data_list = _list_devicesinfo(devices, device_paths)
        return device_data_list
    def get_list(self, _type=None):
        """
        :param _type: supported types are dasd-eckd, zfcp.
        Based on this devices will be retrieved
        :return: device data list.
        """
        device_paths = []
        if _type is None:
            device_paths.extend(utils.get_directories(syspath_eckd))
            device_paths.extend(utils.get_directories(syspath_zfcp))
        elif _type == DEV_TYPES[0]:
            device_paths = utils.get_directories(syspath_eckd)
        elif _type == DEV_TYPES[1]:
            device_paths = utils.get_directories(syspath_zfcp)
        else:
            wok_log.error("Invalid _type given. _type: %s"
                          % _type)
            raise InvalidParameter("GS390XINVTYPE",
                                   {'supported_type': DEV_TYPES})
        if not device_paths:
            return []
        command = [lscss]
        msg = 'The command executed is "%s" ' % command
        wok_log.debug(msg)
        out, err, rc = run_command(command)
        if rc:
            err = err.strip().replace("lscss:", '').strip()
            wok_log.error(err)
            raise OperationFailed("GS390XCMD0001E",
                                  {'command': command,
                                   'rc': rc, 'reason': err})

        device_pattern = r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
                         r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
                         r'(\w+\/\w+)\s+' \
                         r'(\w+\/\w+)\s' \
                         r'(\s{3}|yes)\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'([0-9a-fA-F]{2})\s+' \
                         r'(\w+\s\w+)'

        devices = utils.get_rows_info(out, HEADER_PATTERN, device_pattern,
                                      unique_col='device',
                                      format_data=_format_lscss)
        device_data_list = _list_devicesinfo(devices, device_paths)
        return device_data_list
def _get_zfcp_devices():
    """
    Return list of zfcp devices
    """
    device_paths = utils.get_directories(syspath_zfcp)
    zfcp_devices = []
    for path in device_paths:
        device = utils.get_dirname(path)
        if device:
            zfcp_devices.append(device)
    return zfcp_devices
def _get_dasdeckd_devices():
    """
    Return list of dasd-eckd devices
    """
    device_paths = utils.get_directories(syspath_eckd)
    dasdeckd_devices = []
    for path in device_paths:
        device = utils.get_dirname(path)
        if device:
            dasdeckd_devices.append(device)
    return dasdeckd_devices
Example #5
0
def _get_zfcp_devices():
    """
    Return list of zfcp devices
    """
    device_paths = utils.get_directories(syspath_zfcp)
    zfcp_devices = []
    for path in device_paths:
        device = utils.get_dirname(path)
        if device:
            zfcp_devices.append(device)
    return zfcp_devices
Example #6
0
def _get_dasdeckd_devices():
    """
    Return list of dasd-eckd devices
    """
    device_paths = utils.get_directories(syspath_eckd)
    dasdeckd_devices = []
    for path in device_paths:
        device = utils.get_dirname(path)
        if device:
            dasdeckd_devices.append(device)
    return dasdeckd_devices