diff --git a/neutron/db/l3_dvr_db.py b/neutron/db/l3_dvr_db.py index f5df0244a82..6f0364ede8b 100644 --- a/neutron/db/l3_dvr_db.py +++ b/neutron/db/l3_dvr_db.py @@ -16,6 +16,7 @@ import collections from neutron_lib.api.definitions import l3 as l3_apidef from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings_extended +from neutron_lib.api.definitions import router_admin_state_down_before_update from neutron_lib.api import validators from neutron_lib.callbacks import events from neutron_lib.callbacks import exceptions @@ -45,7 +46,6 @@ from neutron.db import l3_attrs_db from neutron.db import l3_db from neutron.db.models import allowed_address_pair as aap_models from neutron.db import models_v2 -from neutron.extensions import _admin_state_down_before_update_lib from neutron.ipam import utils as ipam_utils from neutron.objects import agent as ag_obj from neutron.objects import l3agent as rb_obj @@ -61,7 +61,7 @@ def is_admin_state_down_necessary(): global _IS_ADMIN_STATE_DOWN_NECESSARY if _IS_ADMIN_STATE_DOWN_NECESSARY is None: _IS_ADMIN_STATE_DOWN_NECESSARY = \ - _admin_state_down_before_update_lib.ALIAS in (extensions. + router_admin_state_down_before_update.ALIAS in (extensions. PluginAwareExtensionManager.get_instance().extensions) return _IS_ADMIN_STATE_DOWN_NECESSARY diff --git a/neutron/extensions/_admin_state_down_before_update_lib.py b/neutron/extensions/_admin_state_down_before_update_lib.py deleted file mode 100644 index 65e22c091f5..00000000000 --- a/neutron/extensions/_admin_state_down_before_update_lib.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - -""" -TODO(mattw4): This module should be deleted once neutron-lib containing -https://review.openstack.org/#/c/634509/ change is released. -""" -from neutron_lib.api.definitions import l3 as l3_apidef - -ALIAS = 'router-admin-state-down-before-update' -IS_SHIM_EXTENSION = True -IS_STANDARD_ATTR_EXTENSION = False -NAME = "Enforce Router's Admin State Down Before Update Extension" -DESCRIPTION = ('Ensure that the admin state of a router is down ' - '(admin_state_up=False) before updating the distributed ' - 'attribute') -UPDATED_TIMESTAMP = '2019-04-08 13:30:00' -RESOURCE_ATTRIBUTE_MAP = {} -SUB_RESOURCE_ATTRIBUTE_MAP = {} -ACTION_MAP = {} -REQUIRED_EXTENSIONS = [l3_apidef.ALIAS] -OPTIONAL_EXTENSIONS = [] -ACTION_STATUS = {} diff --git a/neutron/extensions/admin_state_down_before_update.py b/neutron/extensions/admin_state_down_before_update.py index 900dbdc2de1..252d0d7aa95 100644 --- a/neutron/extensions/admin_state_down_before_update.py +++ b/neutron/extensions/admin_state_down_before_update.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.extensions import _admin_state_down_before_update_lib as apidef +from neutron_lib.api.definitions import \ + router_admin_state_down_before_update as apidef from neutron_lib.api import extensions diff --git a/neutron/services/l3_router/l3_router_plugin.py b/neutron/services/l3_router/l3_router_plugin.py index 2e8a7627648..463c43b4f4b 100644 --- a/neutron/services/l3_router/l3_router_plugin.py +++ b/neutron/services/l3_router/l3_router_plugin.py @@ -25,6 +25,8 @@ from neutron_lib.api.definitions import l3_ext_ha_mode from neutron_lib.api.definitions import l3_flavors from neutron_lib.api.definitions import l3_port_ip_change_not_allowed from neutron_lib.api.definitions import qos_gateway_ip +from neutron_lib.api.definitions import \ + router_admin_state_down_before_update as r_admin_state_down_before_update from neutron_lib.api.definitions import router_availability_zone from neutron_lib import constants as n_const from neutron_lib.db import resource_extend @@ -49,7 +51,6 @@ from neutron.db import l3_gateway_ip_qos from neutron.db import l3_hamode_db from neutron.db import l3_hascheduler_db from neutron.db.models import l3 as l3_models -from neutron.extensions import _admin_state_down_before_update_lib from neutron.quota import resource_registry from neutron import service from neutron.services.l3_router.service_providers import driver_controller @@ -63,6 +64,8 @@ def disable_dvr_extension_by_config(aliases): LOG.info('Disabled DVR extension.') if 'dvr' in aliases: aliases.remove('dvr') + if r_admin_state_down_before_update.ALIAS in aliases: + aliases.remove(r_admin_state_down_before_update.ALIAS) def disable_l3_qos_extension_by_plugins(ext, aliases): @@ -104,7 +107,7 @@ class L3RouterPlugin(service_base.ServicePluginBase, floatingip_pools.ALIAS, qos_gateway_ip.ALIAS, l3_port_ip_change_not_allowed.ALIAS, - _admin_state_down_before_update_lib.ALIAS] + r_admin_state_down_before_update.ALIAS] __native_pagination_support = True __native_sorting_support = True