Merge "Re-home exceptions to common/exceptions.py"

This commit is contained in:
Zuul 2020-04-28 16:52:51 +00:00 committed by Gerrit Code Review
commit eff9150ed9
2 changed files with 11 additions and 9 deletions

View File

@ -14,6 +14,7 @@
# under the License.
from neutron_lib import exceptions as n_exc
from octavia_lib.api.drivers import exceptions as driver_exceptions
from ovn_octavia_provider.i18n import _
@ -22,3 +23,10 @@ class RevisionConflict(n_exc.NeutronException):
message = _('OVN revision number for %(resource_id)s (type: '
'%(resource_type)s) is equal or higher than the given '
'resource. Skipping update')
class IPVersionsMixingNotSupportedError(
driver_exceptions.UnsupportedOptionError):
user_fault_string = _('OVN provider does not support mixing IPv4/IPv6 '
'configuration within the same Load Balancer.')
operator_fault_string = user_fault_string

View File

@ -39,6 +39,7 @@ from ovn_octavia_provider.common import config as ovn_conf
# TODO(mjozefcz): Start consuming const and utils
# from neutron-lib once released.
from ovn_octavia_provider.common import constants as ovn_const
from ovn_octavia_provider.common import exceptions as ovn_exc
from ovn_octavia_provider.common import utils
from ovn_octavia_provider.i18n import _
from ovn_octavia_provider.ovsdb import impl_idl_ovn
@ -81,13 +82,6 @@ OVN_NATIVE_LB_ALGORITHMS = [constants.LB_ALGORITHM_SOURCE_IP_PORT, ]
EXCEPTION_MSG = "Exception occurred during %s"
class IPVersionsMixingNotSupportedError(
driver_exceptions.UnsupportedOptionError):
user_fault_string = _('OVN provider does not support mixing IPv4/IPv6 '
'configuration within the same Load Balancer.')
operator_fault_string = user_fault_string
def get_neutron_client():
try:
return clients.NeutronAuth(
@ -2077,7 +2071,7 @@ class OvnProviderDriver(driver_base.ProviderDriver):
user_fault_string=msg,
operator_fault_string=msg)
if self._ip_version_differs(member):
raise IPVersionsMixingNotSupportedError()
raise ovn_exc.IPVersionsMixingNotSupportedError()
admin_state_up = member.admin_state_up
if (isinstance(member.subnet_id, o_datamodels.UnsetType) or
not member.subnet_id):
@ -2139,7 +2133,7 @@ class OvnProviderDriver(driver_base.ProviderDriver):
user_fault_string=msg,
operator_fault_string=msg)
if new_member.address and self._ip_version_differs(new_member):
raise IPVersionsMixingNotSupportedError()
raise ovn_exc.IPVersionsMixingNotSupportedError()
request_info = {'id': new_member.member_id,
'address': old_member.address,
'protocol_port': old_member.protocol_port,