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
This commit is contained in:
Ryan Tidwell 2015-03-20 15:09:38 -07:00
parent ecf8c524b9
commit 4cfc52dfea
6 changed files with 32 additions and 14 deletions

View File

@ -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},

View File

@ -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

View File

@ -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')

View File

@ -1 +1 @@
20b99fd19d4f
034883111f

View File

@ -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',

View File

@ -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):