Browse Source

Merge "Adopt rehomed QoS FIP extension from neutron-lib 2.18.0"

changes/08/821208/6
Zuul 4 months ago committed by Gerrit Code Review
parent
commit
8a19380b34
  1. 4
      neutron/db/l3_db.py
  2. 44
      neutron/extensions/qos_fip.py
  3. 6
      neutron/services/ovn_l3/plugin.py
  4. 6
      neutron/tests/unit/extensions/test_qos_fip.py

4
neutron/db/l3_db.py

@ -17,6 +17,7 @@ import random
import netaddr
from neutron_lib.api.definitions import l3 as l3_apidef
from neutron_lib.api.definitions import qos_fip as qos_fip_apidef
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib.callbacks import events
@ -51,7 +52,6 @@ from neutron.db.models import l3_attrs as l3_attrs_models
from neutron.db import models_v2
from neutron.db import standardattrdescription_db as st_attr
from neutron.extensions import l3
from neutron.extensions import qos_fip
from neutron.extensions import segment as segment_ext
from neutron.objects import base as base_obj
from neutron.objects import port_forwarding
@ -134,7 +134,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
if self._fip_qos is None:
# Check L3 service plugin
self._fip_qos = extensions.is_extension_supported(
self, qos_fip.FIP_QOS_ALIAS)
self, qos_fip_apidef.ALIAS)
return self._fip_qos
@property

44
neutron/extensions/qos_fip.py

@ -11,49 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api.definitions import l3
from neutron_lib.api.definitions import qos
from neutron_lib.api.definitions import qos_fip as apidef
from neutron_lib.api import extensions
from neutron_lib.services.qos import constants as qos_consts
FIP_QOS_ALIAS = "qos-fip"
EXTENDED_ATTRIBUTES_2_0 = {
l3.FLOATINGIPS: {
qos_consts.QOS_POLICY_ID: {
'allow_post': True,
'allow_put': True,
'is_visible': True,
'default': None,
'validate': {'type:uuid_or_none': None}}
}
}
REQUIRED_EXTENSIONS = [l3.ALIAS, qos.ALIAS]
class Qos_fip(extensions.ExtensionDescriptor):
class Qos_fip(extensions.APIExtensionDescriptor):
"""Extension class supporting floating IP QoS in all router."""
@classmethod
def get_name(cls):
return "Floating IP QoS"
@classmethod
def get_alias(cls):
return FIP_QOS_ALIAS
@classmethod
def get_description(cls):
return "The floating IP Quality of Service extension"
@classmethod
def get_updated(cls):
return "2017-07-20T00:00:00-00:00"
def get_required_extensions(self):
return REQUIRED_EXTENSIONS
def get_extended_resources(self, version):
if version == "2.0":
return EXTENDED_ATTRIBUTES_2_0
else:
return {}
api_definition = apidef

6
neutron/services/ovn_l3/plugin.py

@ -15,6 +15,7 @@
from neutron_lib.api.definitions import external_net
from neutron_lib.api.definitions import portbindings
from neutron_lib.api.definitions import provider_net as pnet
from neutron_lib.api.definitions import qos_fip as qos_fip_apidef
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
@ -41,7 +42,6 @@ from neutron.db import l3_fip_qos
from neutron.db import l3_gwmode_db
from neutron.db.models import l3 as l3_models
from neutron.db import ovn_revision_numbers_db as db_rev
from neutron.extensions import qos_fip as qos_fip_api
from neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb import ovn_client
from neutron.quota import resource_registry
from neutron.scheduler import l3_ovn_scheduler
@ -97,9 +97,9 @@ class OVNL3RouterPlugin(service_base.ServicePluginBase,
@staticmethod
def disable_qos_fip_extension_by_extension_drivers(aliases):
qos_service_plugin = directory.get_plugin(plugin_constants.QOS)
qos_aliases = qos_fip_api.FIP_QOS_ALIAS in aliases
qos_aliases = qos_fip_apidef.ALIAS in aliases
if not qos_service_plugin and qos_aliases:
aliases.remove(qos_fip_api.FIP_QOS_ALIAS)
aliases.remove(qos_fip_apidef.ALIAS)
@property
def supported_extension_aliases(self):

6
neutron/tests/unit/extensions/test_qos_fip.py

@ -14,6 +14,7 @@
from neutron_lib.api.definitions import external_net as enet_apidef
from neutron_lib.api.definitions import l3 as l3_apidef
from neutron_lib.api.definitions import qos_fip as qos_fip_apidef
from neutron_lib import context
from neutron_lib.exceptions import qos as qos_exc
from neutron_lib.services.qos import constants as qos_consts
@ -23,7 +24,6 @@ from oslo_utils import uuidutils
from neutron.conf.db import extraroute_db
from neutron.db import l3_fip_qos
from neutron.extensions import l3
from neutron.extensions import qos_fip
from neutron.objects.qos import policy
from neutron.services.revisions import revision_plugin
from neutron.tests.unit.extensions import test_l3
@ -45,14 +45,14 @@ class TestFloatingIPQoSIntPlugin(
test_l3.TestL3NatIntPlugin,
l3_fip_qos.FloatingQoSDbMixin):
supported_extension_aliases = [enet_apidef.ALIAS, l3_apidef.ALIAS,
qos_fip.FIP_QOS_ALIAS]
qos_fip_apidef.ALIAS]
class TestFloatingIPQoSL3NatServicePlugin(
test_l3.TestL3NatServicePlugin,
l3_fip_qos.FloatingQoSDbMixin):
supported_extension_aliases = [l3_apidef.ALIAS, 'qos',
qos_fip.FIP_QOS_ALIAS]
qos_fip_apidef.ALIAS]
class FloatingIPQoSDBTestCaseBase(object):

Loading…
Cancel
Save