]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove allow_overlap from subnetpools API
authorRyan Tidwell <ryan.tidwell@hp.com>
Fri, 20 Mar 2015 22:09:38 +0000 (15:09 -0700)
committerRyan Tidwell <ryan.tidwell@hp.com>
Thu, 26 Mar 2015 04:15:53 +0000 (21:15 -0700)
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

neutron/api/v2/attributes.py
neutron/db/db_base_plugin_v2.py
neutron/db/migration/alembic_migrations/versions/034883111f_remove_subnetpool_allow_overlap.py [new file with mode: 0644]
neutron/db/migration/alembic_migrations/versions/HEAD
neutron/db/models_v2.py
neutron/ipam/subnet_alloc.py

index 4f927ea7c7d524d7fec410e6b7eb99d470b053f2..146b5013e458a83ae67c95415758401842d17240 100644 (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},
index 5866326414c4a29e16248a49841b00b87e86dec6..73d7f45cb78bc08791d6a3dd3b1261acbad3da24 100644 (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
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 (file)
index 0000000..ab59122
--- /dev/null
@@ -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')
index 0dd06323d96ab259614dd97d91af2bbef9486cd8..1761684630713717614672cd7992d6c9fea4b9db 100644 (file)
@@ -1 +1 @@
-20b99fd19d4f
+034883111f
index 48e8296960d57e43e40010c6961ba2499157d57b..9218587bf2911e702519c2426d2854633797421c 100644 (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',
index 72c9af091ce5ad6866a1a1b761160b65b93fe625..876727dd4342fd8dc2e8c4d4841b46481f2d8c53 100644 (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):