diff --git a/neutron_lib/exceptions/__init__.py b/neutron_lib/exceptions/__init__.py index 54847de83..9f5b73c54 100644 --- a/neutron_lib/exceptions/__init__.py +++ b/neutron_lib/exceptions/__init__.py @@ -786,3 +786,24 @@ class FailedToAddQdiscToDevice(NeutronException): class PortBindingNotFound(NotFound): message = _("Binding for port %(port_id)s for host %(host)s could not be " "found.") + + +class PortBindingAlreadyActive(Conflict): + message = _("Binding for port %(port_id)s on host %(host)s is already " + "active.") + + +class PortBindingAlreadyExists(Conflict): + message = _("Binding for port %(port_id)s on host %(host)s already " + "exists.") + + +class PortBindingError(NeutronException): + message = _("Binding for port %(port_id)s on host %(host)s could not be " + "created or updated.") + + +class ProcessExecutionError(RuntimeError): + def __init__(self, message, returncode): + super(ProcessExecutionError, self).__init__(message) + self.returncode = returncode diff --git a/neutron_lib/exceptions/qos.py b/neutron_lib/exceptions/qos.py index 9e2acbe3b..847bdd4e0 100644 --- a/neutron_lib/exceptions/qos.py +++ b/neutron_lib/exceptions/qos.py @@ -95,3 +95,13 @@ class TcLibQdiscTypeError(e.NeutronException): class TcLibQdiscNeededArguments(e.NeutronException): message = _("TC Qdisc type %(qdisc_type)s needs following arguments: " "%(needed_arguments)s.") + + +class RouterQosBindingNotFound(e.NotFound): + message = _("QoS binding for router %(router_id)s gateway and policy " + "%(policy_id)s could not be found.") + + +class RouterQosBindingError(e.NeutronException): + message = _("QoS binding for router %(router_id)s gateway and policy " + "%(policy_id)s could not be created: %(db_error)s.") diff --git a/releasenotes/notes/rehome-common-exceptions-eda074ddb02349ab.yaml b/releasenotes/notes/rehome-common-exceptions-eda074ddb02349ab.yaml new file mode 100644 index 000000000..014049819 --- /dev/null +++ b/releasenotes/notes/rehome-common-exceptions-eda074ddb02349ab.yaml @@ -0,0 +1,7 @@ +--- +features: + - The following exceptions from ``neutron.common.exceptions`` have been + rehomed into neutron-lib; ``PortBindingAlreadyActive``, + ``PortBindingAlreadyExists``, ``PortBindingError``, + ``ProcessExecutionError``, ``RouterQosBindingNotFound``, + ``RouterQosBindingError``.