コード例 #1
0
ファイル: utils.py プロジェクト: 2Exception/patron
def perform_unit_remove_for_s390(device_number, target_wwn, lun):
    """Write the LUN to the port's unit_remove attribute."""
    # If LUN scanning is turned off on systems following the s390, or s390x
    # architecture LUNs need to be removed from the configuration using the
    # unit_remove call. The unit_remove call may fail if the LUN is not
    # part of the configuration anymore. This may be an expected situation.
    # For exmple, if LUN scanning is turned on.
    # This method will thus only log a warning message in case the
    # unit_remove call fails.
    LOG.debug(
        "perform unit_remove for s390: device_number=(%(device_num)s) "
        "target_wwn=(%(target_wwn)s) target_lun=(%(target_lun)s)", {
            'device_num': device_number,
            'target_wwn': target_wwn,
            'target_lun': lun
        })
    zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_remove" %
                           (device_number, target_wwn))
    try:
        linuxscsi.echo_scsi_command(zfcp_device_command, lun)
    except processutils.ProcessExecutionError as exc:
        LOG.warn(
            _LW("unit_remove call failed; exit code (%(code)s), "
                "stderr (%(stderr)s)"), {
                    'code': exc.exit_code,
                    'stderr': exc.stderr
                })
コード例 #2
0
ファイル: utils.py プロジェクト: 2Exception/patron
def perform_unit_add_for_s390(device_number, target_wwn, lun):
    """Write the LUN to the port's unit_add attribute."""
    # NOTE If LUN scanning is turned off on systems following the s390,
    # or s390x architecture LUNs need to be added to the configuration
    # using the unit_add call. The unit_add call may fail if a target_wwn
    # is not accessible for the HBA specified by the device_number.
    # This can be an expected situation in multipath configurations.
    # This method will thus only log a warning message in case the
    # unit_add call fails.
    LOG.debug(
        "perform unit_add for s390: device_number=(%(device_num)s) "
        "target_wwn=(%(target_wwn)s) target_lun=(%(target_lun)s)", {
            'device_num': device_number,
            'target_wwn': target_wwn,
            'target_lun': lun
        })
    zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" %
                           (device_number, target_wwn))
    try:
        linuxscsi.echo_scsi_command(zfcp_device_command, lun)
    except processutils.ProcessExecutionError as exc:
        LOG.warn(
            _LW("unit_add call failed; exit code (%(code)s), "
                "stderr (%(stderr)s)"), {
                    'code': exc.exit_code,
                    'stderr': exc.stderr
                })
コード例 #3
0
ファイル: utils.py プロジェクト: hsluoyz/patron
def perform_unit_remove_for_s390(device_number, target_wwn, lun):
    """Write the LUN to the port's unit_remove attribute."""
    # If LUN scanning is turned off on systems following the s390, or s390x
    # architecture LUNs need to be removed from the configuration using the
    # unit_remove call. The unit_remove call may fail if the LUN is not
    # part of the configuration anymore. This may be an expected situation.
    # For exmple, if LUN scanning is turned on.
    # This method will thus only log a warning message in case the
    # unit_remove call fails.
    LOG.debug("perform unit_remove for s390: device_number=(%(device_num)s) "
              "target_wwn=(%(target_wwn)s) target_lun=(%(target_lun)s)",
                {'device_num': device_number,
                 'target_wwn': target_wwn,
                 'target_lun': lun})
    zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_remove" %
                           (device_number, target_wwn))
    try:
        linuxscsi.echo_scsi_command(zfcp_device_command, lun)
    except processutils.ProcessExecutionError as exc:
            LOG.warn(_LW("unit_remove call failed; exit code (%(code)s), "
                         "stderr (%(stderr)s)"),
                         {'code': exc.exit_code, 'stderr': exc.stderr})
コード例 #4
0
ファイル: utils.py プロジェクト: hsluoyz/patron
def perform_unit_add_for_s390(device_number, target_wwn, lun):
    """Write the LUN to the port's unit_add attribute."""
    # NOTE If LUN scanning is turned off on systems following the s390,
    # or s390x architecture LUNs need to be added to the configuration
    # using the unit_add call. The unit_add call may fail if a target_wwn
    # is not accessible for the HBA specified by the device_number.
    # This can be an expected situation in multipath configurations.
    # This method will thus only log a warning message in case the
    # unit_add call fails.
    LOG.debug("perform unit_add for s390: device_number=(%(device_num)s) "
              "target_wwn=(%(target_wwn)s) target_lun=(%(target_lun)s)",
                {'device_num': device_number,
                 'target_wwn': target_wwn,
                 'target_lun': lun})
    zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" %
                           (device_number, target_wwn))
    try:
        linuxscsi.echo_scsi_command(zfcp_device_command, lun)
    except processutils.ProcessExecutionError as exc:
            LOG.warn(_LW("unit_add call failed; exit code (%(code)s), "
                         "stderr (%(stderr)s)"),
                         {'code': exc.exit_code, 'stderr': exc.stderr})