neutron-lib/neutron_lib/exceptions/qos.py
Boden R a37d43018b rehome rpc and related plumbing
As shown in the history of this patch, along with the work in [1], we've
discussed rehoming neutron.common.rpc into lib a number of times before.
One of the main reasons we've decided not to rehome in the past is that
we'd hoped the neutron.common.rcp.BackingOffClient and related plumbing
could be put into oslo.messaging. However, it's 2 years later and that
still hasn't happened [2][3].

This patch proposes we just move forward with the rehome so that we can
begin to untangle the consumers [4]. There's no reason we can't
reiterate on this code in lib; it's no more difficult than in neutron.

This patch includes rehoming of:
- neutron.common.rpc, the only difference in the lib version is that
we dynamically add all neutron_lib.exceptions by default (_DFT_EXMODS).
- neutron.common.exceptions, but exceptions are broken out into their
respective exception modules rather than lumping all together in a
generic single module.
- The fake notifier and RPC fixture, without any real changes.
- A new runtime util method to dynamically load all modules for a
package.

For a sample neutron consumption patch see [5] that was tested with
PS10 herein.

[1] https://review.openstack.org/#/q/project:openstack/neutron-lib+message:rpc
[2] https://review.openstack.org/#/c/407722/
[3] https://bugs.launchpad.net/oslo.messaging/+bug/1667445
[4] http://codesearch.openstack.org/?q=from%20neutron.common%20import%20rpc
[5] https://review.openstack.org/#/c/579989/

Change-Id: I0052ba65973a993e088943056879bc6e982bd0b5
2018-07-12 13:13:21 -06:00

88 lines
3.0 KiB
Python

# Copyright 2011 VMware, Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib._i18n import _
from neutron_lib import exceptions as e
class QosPolicyNotFound(e.NotFound):
message = _("QoS policy %(policy_id)s could not be found.")
class QosRuleNotFound(e.NotFound):
message = _("QoS rule %(rule_id)s for policy %(policy_id)s "
"could not be found.")
class QoSPolicyDefaultAlreadyExists(e.Conflict):
message = _("A default QoS policy exists for project %(project_id)s.")
class PortQosBindingNotFound(e.NotFound):
message = _("QoS binding for port %(port_id)s and policy %(policy_id)s "
"could not be found.")
class PortQosBindingError(e.NeutronException):
message = _("QoS binding for port %(port_id)s and policy %(policy_id)s "
"could not be created: %(db_error)s.")
class NetworkQosBindingNotFound(e.NotFound):
message = _("QoS binding for network %(net_id)s and policy %(policy_id)s "
"could not be found.")
class FloatingIPQosBindingNotFound(e.NotFound):
message = _("QoS binding for floating IP %(fip_id)s and policy "
"%(policy_id)s could not be found.")
class QosPolicyInUse(e.InUse):
message = _("QoS Policy %(policy_id)s is used by "
"%(object_type)s %(object_id)s.")
class FloatingIPQosBindingError(e.NeutronException):
message = _("QoS binding for floating IP %(fip_id)s and policy "
"%(policy_id)s could not be created: %(db_error)s.")
class NetworkQosBindingError(e.NeutronException):
message = _("QoS binding for network %(net_id)s and policy %(policy_id)s "
"could not be created: %(db_error)s.")
class QosRuleNotSupported(e.Conflict):
message = _("Rule %(rule_type)s is not supported by port %(port_id)s")
class QoSRuleParameterConflict(e.Conflict):
message = _("Unable to add the rule with value %(rule_value)s to the "
"policy %(policy_id)s as the existing rule of type "
"%(existing_rule)s restricts the bandwidth to "
"%(existing_value)s.")
class QoSRulesConflict(e.Conflict):
message = _("Rule %(new_rule_type)s conflicts with "
"rule %(rule_id)s which already exists in "
"QoS Policy %(policy_id)s.")
class PolicyRemoveAuthorizationError(e.NotAuthorized):
message = _("Failed to remove provided policy %(policy_id)s "
"because you are not authorized.")