Exemplo n.º 1
0
def validate_policy_accessable(context, policy_id):
    policy_obj = obj_reg.load_class('QosPolicy').get_object(context,
                                                            id=policy_id)
    if not policy_obj:
        # This means that rbac decided the policy cannot be used with this
        # context
        raise qos_exc.QosPolicyNotFound(policy_id=policy_id)
Exemplo n.º 2
0
    def get_policy_obj(cls, context, policy_id):
        """Fetch a QoS policy.

        :param context: neutron api request context
        :type context: neutron.context.Context
        :param policy_id: the id of the QosPolicy to fetch
        :type policy_id: str uuid

        :returns: a QosPolicy object
        :raises: n_exc.QosPolicyNotFound
        """

        obj = cls.get_object(context, id=policy_id)
        if obj is None:
            raise qos_exc.QosPolicyNotFound(policy_id=policy_id)
        return obj
Exemplo n.º 3
0
    def get_policy_obj(cls, context, policy_id):
        LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
                 log_utils.get_fname(2))
        """Fetch a QoS policy.

        :param context: neutron api request context
        :type context: neutron.context.Context
        :param policy_id: the id of the QosPolicy to fetch
        :type policy_id: str uuid

        :returns: a QosPolicy object
        :raises: n_exc.QosPolicyNotFound
        """

        obj = cls.get_object(context, id=policy_id)
        if obj is None:
            raise qos_exc.QosPolicyNotFound(policy_id=policy_id)
        return obj