From: Ryan Tidwell Date: Fri, 20 Mar 2015 22:09:38 +0000 (-0700) Subject: Remove allow_overlap from subnetpools API X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4cfc52dfea23580711eefcbcd1737fd651576be7;p=openstack-build%2Fneutron-build.git Remove allow_overlap from subnetpools API Removes the allow_overlap attribute from subnetpools in favor making all subnets unique within a pool. ApiImpact Partially-Implements: blueprint subnet-allocation Change-Id: I0484ac60923376e59ceb8aa288bf582f1e713b82 --- diff --git a/neutron/api/v2/attributes.py b/neutron/api/v2/attributes.py index 4f927ea7c..146b5013e 100644 --- a/neutron/api/v2/attributes.py +++ b/neutron/api/v2/attributes.py @@ -837,11 +837,6 @@ RESOURCE_ATTRIBUTE_MAP = { 'ip_version': {'allow_post': False, 'allow_put': False, 'is_visible': True}, - 'allow_overlap': {'allow_post': True, - 'allow_put': False, - 'default': False, - 'convert_to': convert_to_boolean, - 'is_visible': True}, 'default_prefixlen': {'allow_post': True, 'allow_put': True, 'validate': {'type:non_negative': None}, diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 586632641..73d7f45cb 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -868,7 +868,6 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, 'min_prefixlen': min_prefixlen, 'max_prefixlen': max_prefixlen, 'shared': subnetpool['shared'], - 'allow_overlap': subnetpool['allow_overlap'], 'prefixes': [prefix['cidr'] for prefix in subnetpool['prefixes']], 'ip_version': subnetpool['ip_version']} @@ -1373,8 +1372,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, sp_reader.default_prefixlen, 'min_prefixlen': sp_reader.min_prefixlen, 'max_prefixlen': sp_reader.max_prefixlen, - 'shared': sp_reader.shared, - 'allow_overlap': sp_reader.allow_overlap} + 'shared': sp_reader.shared} subnetpool = models_v2.SubnetPool(**pool_args) context.session.add(subnetpool) for prefix in sp_reader.prefixes: @@ -1410,8 +1408,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, updated['prefixes'] = orig_prefixes for key in ['id', 'name', 'ip_version', 'min_prefixlen', - 'max_prefixlen', 'default_prefixlen', 'allow_overlap', - 'shared']: + 'max_prefixlen', 'default_prefixlen', 'shared']: self._write_key(key, updated, model, new_pool) return updated diff --git a/neutron/db/migration/alembic_migrations/versions/034883111f_remove_subnetpool_allow_overlap.py b/neutron/db/migration/alembic_migrations/versions/034883111f_remove_subnetpool_allow_overlap.py new file mode 100644 index 000000000..ab59122e7 --- /dev/null +++ b/neutron/db/migration/alembic_migrations/versions/034883111f_remove_subnetpool_allow_overlap.py @@ -0,0 +1,28 @@ +# Copyright 2014 OpenStack Foundation +# +# 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. +# + +"""Remove allow_overlap from subnetpools +""" + +# revision identifiers, used by Alembic. +revision = '034883111f' +down_revision = '20b99fd19d4f' + + +from alembic import op + + +def upgrade(): + op.drop_column('subnetpools', 'allow_overlap') diff --git a/neutron/db/migration/alembic_migrations/versions/HEAD b/neutron/db/migration/alembic_migrations/versions/HEAD index 0dd06323d..176168463 100644 --- a/neutron/db/migration/alembic_migrations/versions/HEAD +++ b/neutron/db/migration/alembic_migrations/versions/HEAD @@ -1 +1 @@ -20b99fd19d4f +034883111f diff --git a/neutron/db/models_v2.py b/neutron/db/models_v2.py index 48e829696..9218587bf 100644 --- a/neutron/db/models_v2.py +++ b/neutron/db/models_v2.py @@ -232,7 +232,6 @@ class SubnetPool(model_base.BASEV2, HasId, HasTenant): min_prefixlen = sa.Column(sa.Integer, nullable=False) max_prefixlen = sa.Column(sa.Integer, nullable=False) shared = sa.Column(sa.Boolean, nullable=False) - allow_overlap = sa.Column(sa.Boolean, nullable=False) prefixes = orm.relationship(SubnetPoolPrefix, backref='subnetpools', cascade='all, delete, delete-orphan', diff --git a/neutron/ipam/subnet_alloc.py b/neutron/ipam/subnet_alloc.py index 72c9af091..876727dd4 100644 --- a/neutron/ipam/subnet_alloc.py +++ b/neutron/ipam/subnet_alloc.py @@ -37,7 +37,7 @@ class SubnetPoolReader(object): self._read_id(subnetpool) self._read_prefix_bounds(subnetpool) self._read_attrs(subnetpool, - ['tenant_id', 'name', 'allow_overlap', 'shared']) + ['tenant_id', 'name', 'shared']) self.subnetpool = {'id': self.id, 'name': self.name, 'tenant_id': self.tenant_id, @@ -48,7 +48,6 @@ class SubnetPoolReader(object): 'max_prefixlen': self.max_prefixlen, 'default_prefix': self.default_prefix, 'default_prefixlen': self.default_prefixlen, - 'allow_overlap': self.allow_overlap, 'shared': self.shared} def _read_attrs(self, subnetpool, keys):