conf: Add neutron.default_floating_pool

The neutron network driver in nova has subverted the meaning of the
'default_floating_pool' value for its own cruel and unusual purposes.
This cannot be allowed to stand. Give neutron its own config option,
stopping it from stealing others and allowing us to eventually retire
the venerable 'default_floating_pool' option. A warning is included to
alert any unsuspecting operators of the neutron network driver's ghastly
behavior and allow them to mitigate same.

Change-Id: I2ce8ff3d7c33a402b8af50182ec01f512859c388
Implements: blueprint centralize-config-options-pike
This commit is contained in:
Stephen Finucane 2017-02-08 16:03:57 +00:00
parent 9569bc3552
commit babb6f5f28
3 changed files with 37 additions and 5 deletions

View File

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

View File

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

View File

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