Remove configuration options max_fixed_ips_per_port
This was marked as deprecated in Newton. Related-bug: #1502356 Change-Id: Iafaa340a9291e1ee84e776ddfffc5f870f7e67e2
This commit is contained in:
parent
90feab379a
commit
49a0555129
@ -65,11 +65,6 @@ core_opts = [
|
||||
help=_("Maximum number of DNS nameservers per subnet")),
|
||||
cfg.IntOpt('max_subnet_host_routes', default=20,
|
||||
help=_("Maximum number of host routes per subnet")),
|
||||
cfg.IntOpt('max_fixed_ips_per_port', default=5,
|
||||
deprecated_for_removal=True,
|
||||
help=_("Maximum number of fixed ips per port. This option "
|
||||
"is deprecated and will be removed in the Ocata "
|
||||
"release.")),
|
||||
cfg.BoolOpt('ipv6_pd_enabled', default=False,
|
||||
help=_("Enables IPv6 Prefix Delegation for automatic subnet "
|
||||
"CIDR allocation. "
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions as exc
|
||||
from neutron_lib.utils import net
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -318,14 +317,6 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
||||
pool_2=r_range,
|
||||
subnet_cidr=subnet_cidr)
|
||||
|
||||
def _validate_max_ips_per_port(self, fixed_ip_list, device_owner):
|
||||
if net.is_port_trusted({'device_owner': device_owner}):
|
||||
return
|
||||
|
||||
if len(fixed_ip_list) > cfg.CONF.max_fixed_ips_per_port:
|
||||
msg = _('Exceeded maximum amount of fixed ips per port')
|
||||
raise exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _validate_segment(self, context, network_id, segment_id):
|
||||
query = context.session.query(models_v2.Subnet.segment_id)
|
||||
query = query.filter(models_v2.Subnet.network_id == network_id)
|
||||
@ -422,8 +413,6 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
||||
if ip.get('delete_subnet'))
|
||||
ips = [ip for ip in new_ips
|
||||
if ip.get('subnet_id') not in delete_subnet_ids]
|
||||
# the new_ips contain all of the fixed_ips that are to be updated
|
||||
self._validate_max_ips_per_port(ips, device_owner)
|
||||
|
||||
add_ips, prev_ips, remove_candidates = [], [], []
|
||||
|
||||
|
@ -280,7 +280,6 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
not is_auto_addr_subnet):
|
||||
fixed_ip_list.append({'subnet_id': subnet['id']})
|
||||
|
||||
self._validate_max_ips_per_port(fixed_ip_list, device_owner)
|
||||
return fixed_ip_list
|
||||
|
||||
def _update_ips_for_port(self, context, port, host,
|
||||
|
@ -1033,23 +1033,6 @@ class TestPortsV2(NeutronDbPluginV2TestCase):
|
||||
self.assertEqual(expected_error, data['NeutronError']['type'])
|
||||
self.assertEqual(msg, data['NeutronError']['message'])
|
||||
|
||||
def test_create_port_with_too_many_fixed_ips(self):
|
||||
with self.network() as network:
|
||||
with self.subnet(network=network, cidr='10.0.0.0/24') as subnet:
|
||||
fixed_ips = [{'subnet_id': subnet['subnet']['id'],
|
||||
'ip_address': '10.0.0.%s' % id}
|
||||
for id in range(3,
|
||||
cfg.CONF.max_fixed_ips_per_port + 4)]
|
||||
res = self._create_port(self.fmt,
|
||||
network['network']['id'],
|
||||
webob.exc.HTTPBadRequest.code,
|
||||
fixed_ips=fixed_ips,
|
||||
set_context=True)
|
||||
data = self.deserialize(self.fmt, res)
|
||||
expected_error = 'InvalidInput'
|
||||
self.assertEqual(expected_error,
|
||||
data['NeutronError']['type'])
|
||||
|
||||
def test_create_ports_bulk_native(self):
|
||||
if self._skip_native_bulk:
|
||||
self.skipTest("Plugin does not support native bulk port create")
|
||||
@ -1430,32 +1413,6 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
|
||||
# sub-classes for plugins/drivers that support mac address update
|
||||
# override this method
|
||||
|
||||
def test_update_dhcp_port_with_exceeding_fixed_ips(self):
|
||||
"""
|
||||
Max fixed ips per port is configured in configuration file
|
||||
by max_fixed_ips_per_port parameter.
|
||||
|
||||
DHCP port is not restricted by this parameter.
|
||||
"""
|
||||
with self.subnet() as subnet:
|
||||
updated_fixed_ips = [{'subnet_id': subnet['subnet']['id'],
|
||||
'ip_address': '10.0.0.%s' % id}
|
||||
for id in range(3,
|
||||
cfg.CONF.max_fixed_ips_per_port + 4)]
|
||||
host_arg = None or {}
|
||||
arg_list = None or []
|
||||
with self.port(device_owner=constants.DEVICE_OWNER_DHCP,
|
||||
subnet=subnet, arg_list=arg_list,
|
||||
**host_arg) as port:
|
||||
data = {'port': {'fixed_ips': updated_fixed_ips}}
|
||||
req = self.new_update_request('ports',
|
||||
data, port['port']['id'])
|
||||
res = req.get_response(self.api)
|
||||
self.assertEqual(webob.exc.HTTPOk.code, res.status_int)
|
||||
result = self.deserialize(self.fmt, res)
|
||||
for fixed_ip in updated_fixed_ips:
|
||||
self.assertIn(fixed_ip, result['port']['fixed_ips'])
|
||||
|
||||
def test_dhcp_port_ips_prefer_next_available_ip(self):
|
||||
# test to check that DHCP ports get the first available IP in the
|
||||
# allocation range
|
||||
@ -2531,40 +2488,6 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
|
||||
res = port_req.get_response(self.api)
|
||||
self.assertEqual(webob.exc.HTTPClientError.code, res.status_int)
|
||||
|
||||
def test_max_fixed_ips_exceeded(self):
|
||||
with self.subnet(gateway_ip='10.0.0.3',
|
||||
cidr='10.0.0.0/24') as subnet:
|
||||
kwargs = {"fixed_ips":
|
||||
[{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']}]}
|
||||
net_id = subnet['subnet']['network_id']
|
||||
res = self._create_port(self.fmt, net_id=net_id, **kwargs)
|
||||
self.assertEqual(webob.exc.HTTPClientError.code,
|
||||
res.status_int)
|
||||
|
||||
def test_update_max_fixed_ips_exceeded(self):
|
||||
with self.subnet(gateway_ip='10.0.0.3',
|
||||
cidr='10.0.0.0/24') as subnet:
|
||||
with self.port(subnet) as port:
|
||||
data = {'port': {'fixed_ips':
|
||||
[{'subnet_id': subnet['subnet']['id'],
|
||||
'ip_address': '10.0.0.2'},
|
||||
{'subnet_id': subnet['subnet']['id'],
|
||||
'ip_address': '10.0.0.4'},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']},
|
||||
{'subnet_id': subnet['subnet']['id']}]}}
|
||||
req = self.new_update_request('ports', data,
|
||||
port['port']['id'])
|
||||
res = req.get_response(self.api)
|
||||
self.assertEqual(webob.exc.HTTPClientError.code,
|
||||
res.status_int)
|
||||
|
||||
def test_delete_ports_by_device_id(self):
|
||||
plugin = directory.get_plugin()
|
||||
ctx = context.get_admin_context()
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
upgrade:
|
||||
- The ``max_fixed_ips_per_port`` configuration option was deprecated
|
||||
in the Newton cycle and removed in Pike.
|
Loading…
Reference in New Issue
Block a user