diff --git a/nova/conf/neutron.py b/nova/conf/neutron.py index a0359c6a3613..46a73ca74fc8 100644 --- a/nova/conf/neutron.py +++ b/nova/conf/neutron.py @@ -52,12 +52,20 @@ region the request is coming from. cfg.StrOpt('ovs_bridge', default='br-int', help=""" +Default name for the Open vSwitch integration bridge. + Specifies the name of an integration bridge interface used by OpenvSwitch. -This option is used only if Neutron does not specify the OVS bridge name. +This option is only used if Neutron does not specify the OVS bridge name in +port binding responses. +"""), + cfg.StrOpt('default_floating_pool', + default='nova', + help=""" +Default name for the floating IP pool. -Possible values: - -* Any string representing OVS bridge name. +Specifies the name of floating IP pool used for allocating floating IPs. This +option is only used if Neutron does not specify the floating IP pool name in +port binding reponses. """), cfg.IntOpt('extension_sync_interval', default=600, diff --git a/nova/network/neutronv2/api.py b/nova/network/neutronv2/api.py index a02fe89f7517..e4203e0bc1a0 100644 --- a/nova/network/neutronv2/api.py +++ b/nova/network/neutronv2/api.py @@ -1914,10 +1914,27 @@ class API(base_api.NetworkAPI): % name_or_id) raise exception.NovaException(message=msg) + def _get_default_floating_ip_pool_name(self): + """Get default pool name from config. + + TODO(stephenfin): Remove this helper function in Queens, opting to + use the [neutron] option only. + """ + if CONF.default_floating_pool != 'nova': + LOG.warning(_LW("Config option 'default_floating_pool' is set to " + "a non-default value. Falling back to this value " + "for now but this behavior will change in a " + "future release. You should unset this value " + "and set the '[neutron] default_floating_pool' " + "option instead.")) + return CONF.default_floating_pool + + return CONF.neutron.default_floating_pool + def allocate_floating_ip(self, context, pool=None): """Add a floating IP to a project from a pool.""" client = get_client(context) - pool = pool or CONF.default_floating_pool + pool = pool or self._get_default_floating_ip_pool_name() pool_id = self._get_floating_ip_pool_id_by_name_or_id(client, pool) param = {'floatingip': {'floating_network_id': pool_id}} diff --git a/releasenotes/notes/add-neutron-floating_pool-option-cba402c2de407b78.yaml b/releasenotes/notes/add-neutron-floating_pool-option-cba402c2de407b78.yaml new file mode 100644 index 000000000000..b95d1ae60e14 --- /dev/null +++ b/releasenotes/notes/add-neutron-floating_pool-option-cba402c2de407b78.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + A ``default_floating_pool`` configuration option has been added in the + ``[neutron]`` group. The existing ``default_floating_pool`` option in the + ``[DEFAULT]`` group is retained and should be used by nova-network users. + Neutron users meanwhile should migrate to the new option.