Example #1
0
    def _get_system():
        try:
            with SessionCache(driver_info) as conn:
                return conn.get_system(system_id)

        except sushy.exceptions.ResourceNotFoundError as e:
            LOG.error(
                'The Redfish System "%(system)s" was not found for '
                'node %(node)s. Error %(error)s', {
                    'system': system_id or '<default>',
                    'node': node.uuid,
                    'error': e
                })
            raise exception.RedfishError(error=e)
        # TODO(lucasagomes): We should look at other types of
        # ConnectionError such as AuthenticationError or SSLError and stop
        # retrying on them
        except sushy.exceptions.ConnectionError as e:
            LOG.warning(
                'For node %(node)s, got a connection error from '
                'Redfish at address "%(address)s" using auth type '
                '"%(auth_type)s" when fetching System "%(system)s". '
                'Error: %(error)s', {
                    'system': system_id or '<default>',
                    'address': driver_info['address'],
                    'auth_type': driver_info['auth_type'],
                    'node': node.uuid,
                    'error': e
                })
            raise exception.RedfishConnectionError(node=node.uuid, error=e)
Example #2
0
 def _get_system():
     try:
         # TODO(lucasagomes): We should look into a mechanism to
         # cache the connections (and maybe even system's instances)
         # to avoid unnecessary requests to the Redfish controller
         conn = sushy.Sushy(address,
                            username=driver_info['username'],
                            password=driver_info['password'],
                            verify=driver_info['verify_ca'])
         return conn.get_system(system_id)
     except sushy.exceptions.ResourceNotFoundError as e:
         LOG.error(
             'The Redfish System "%(system)s" was not found for '
             'node %(node)s. Error %(error)s', {
                 'system': system_id,
                 'node': node.uuid,
                 'error': e
             })
         raise exception.RedfishError(error=e)
     # TODO(lucasagomes): We should look at other types of
     # ConnectionError such as AuthenticationError or SSLError and stop
     # retrying on them
     except sushy.exceptions.ConnectionError as e:
         LOG.warning(
             'For node %(node)s, got a connection error from '
             'Redfish at address "%(address)s" when fetching '
             'System "%(system)s". Error: %(error)s', {
                 'system': system_id,
                 'address': address,
                 'node': node.uuid,
                 'error': e
             })
         raise exception.RedfishConnectionError(node=node.uuid, error=e)
Example #3
0
    def _get_cached_connection(lambda_fun, *args):
        try:
            with SessionCache(driver_info) as conn:
                return lambda_fun(conn, *args)

        # TODO(lucasagomes): We should look at other types of
        # ConnectionError such as AuthenticationError or SSLError and stop
        # retrying on them
        except sushy.exceptions.ConnectionError as e:
            LOG.warning('For node %(node)s, got a connection error from '
                        'Redfish at address "%(address)s" using auth type '
                        '"%(auth_type)s". Error: %(error)s',
                        {'address': driver_info['address'],
                         'auth_type': driver_info['auth_type'],
                         'node': node.uuid, 'error': e})
            raise exception.RedfishConnectionError(node=node.uuid, error=e)