From b7b045ec8e7aa000413820ab5be9cbbbbe390618 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 9 Nov 2015 01:02:10 -0800 Subject: [PATCH] IPAM: make max fixed IP validations DRY Reuse code to make the validations DRY. In addition to this fixed a typo. Change-Id: I69cc904d30aae0e2d189a72c9dddaaab63a923ca --- neutron/db/ipam_backend_mixin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/neutron/db/ipam_backend_mixin.py b/neutron/db/ipam_backend_mixin.py index 13650b1d2..3f69e582b 100644 --- a/neutron/db/ipam_backend_mixin.py +++ b/neutron/db/ipam_backend_mixin.py @@ -299,7 +299,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon): def _validate_max_ips_per_port(self, fixed_ip_list): if len(fixed_ip_list) > cfg.CONF.max_fixed_ips_per_port: - msg = _('Exceeded maximim amount of fixed ips per port') + msg = _('Exceeded maximum amount of fixed ips per port') raise n_exc.InvalidInput(error_message=msg) def _get_subnet_for_fixed_ip(self, context, fixed, network_id): @@ -367,9 +367,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon): new_ips, device_owner): """Calculate changes in IPs for the port.""" # the new_ips contain all of the fixed_ips that are to be updated - if len(new_ips) > cfg.CONF.max_fixed_ips_per_port: - msg = _('Exceeded maximum amount of fixed ips per port') - raise n_exc.InvalidInput(error_message=msg) + self._validate_max_ips_per_port(new_ips) add_ips = [] remove_ips = [] -- 2.45.2