def process_session_status(irmc_info, session_timeout, upgrade_type):
    """process session for Bios config backup/restore or RAID config operation

    :param irmc_info: node info
    :param session_timeout: session timeout
    :param upgrade_type: flag to check upgrade with bios or irmc
    :return: a dict with following values:
        {
            'upgrade_message': <Message of firmware upgrade mechanism>,
            'upgrade_status'
        }
    """
    session_expiration = time.time() + session_timeout

    while time.time() < session_expiration:
        try:
            # Get session status to check
            session = get_firmware_upgrade_status(irmc_info, upgrade_type)
        except SCCIClientError:
            # Ignore checking during rebooted server
            time.sleep(10)
            continue

        status = session.find("./Value").text
        severity = session.find("./Severity").text
        message = session.find("./Message").text
        result = {}

        if severity == 'Information' and status != '0':
            if 'FLASH successful' in message:
                result['upgrade_status'] = 'Complete'
                return result
            # Sleep a bit
            time.sleep(5)
        elif severity == 'Error':
            result['upgrade_status'] = 'Error'
            return result
        else:
            # Error occurred, get session log to see what happened
            session_log = message
            raise SCCIClientError('Failed to set firmware upgrade. '
                                  'Session log is %s.' % session_log)

    else:
        raise SCCISessionTimeout('Failed to time out mechanism with %s.'
                                 % session_expiration)
def process_session_status ( irmc_info , session_timeout , upgrade_type ) : session_expiration = time . time ( ) + session_timeout while time . time ( ) < session_expiration : try : session = get_firmware_upgrade_status ( irmc_info , upgrade_type ) except SCCIClientError : time . sleep ( 10 ) continue status = session . find ( "./Value" ) . text severity = session . find ( "./Severity" ) . text message = session . find ( "./Message" ) . text result = { } if severity == 'Information' and status != '0' : if 'FLASH successful' in message : result [ 'upgrade_status' ] = 'Complete' return result time . sleep ( 5 ) elif severity == 'Error' : result [ 'upgrade_status' ] = 'Error' return result else : session_log = message raise SCCIClientError ( 'Failed to set firmware upgrade. ' 'Session log is %s.' % session_log ) else : raise SCCISessionTimeout ( 'Failed to time out mechanism with %s.' % session_expiration )
process session for Bios config backup/restore or RAID config operation

    :param irmc_info: node info
    :param session_timeout: session timeout
    :param upgrade_type: flag to check upgrade with bios or irmc
    :return: a dict with following values:
        {
            'upgrade_message': <Message of firmware upgrade mechanism>,
            'upgrade_status'
        }