Delete floating IPs on network turned internal

The neutron-lib part of this change: https://review.openstack.org/624751

This change introduces a new shim extension
(floatingip-autodelete-internal) to signal a change in API behavior
introduced by the fix of a bug referred below. That is now we autodelete
unused floating IPs when changing a network to router:external=False.

It also documents the API change.

Change-Id: I247106e95abb5d6822aa35ae793531a1d79edbd4
Needed-By: https://review.openstack.org/624751
Partial-Bug: #1806032
This commit is contained in:
Bence Romsics 2019-01-17 15:30:02 +01:00
parent 194f775c9c
commit 461be56076
7 changed files with 67 additions and 1 deletions

View File

@ -40,6 +40,13 @@ The ``external-net`` extension adds the ``router:external`` attribute to
networks. This boolean attribute indicates the network has an external
routing facility that's not managed by the networking service.
FloatingIP autodelete internal
==============================
The ``floatingip-autodelete-internal`` shim extension signals that the
update of a network's ``router:external`` attribute from ``true`` to
``false`` autodeletes the unused Floating IPs of that network.
L2 adjacency extension
======================

View File

@ -5437,7 +5437,9 @@ router-subnet_ids:
router:external:
description: |
Indicates whether the network has an external routing facility that's not
managed by the networking service.
managed by the networking service. If the network is updated from external
to internal the unused floating IPs of this network are automatically
deleted when extension ``floatingip-autodelete-internal`` is present.
in: body
required: true
type: boolean

View File

@ -43,6 +43,7 @@ from neutron_lib.api.definitions import firewall_v2
from neutron_lib.api.definitions import firewallrouterinsertion
from neutron_lib.api.definitions import flavors
from neutron_lib.api.definitions import floating_ip_port_forwarding
from neutron_lib.api.definitions import floatingip_autodelete_internal
from neutron_lib.api.definitions import floatingip_pools
from neutron_lib.api.definitions import flowclassifier
from neutron_lib.api.definitions import ip_allocation
@ -140,6 +141,7 @@ _ALL_API_DEFINITIONS = {
fip_port_details,
flavors,
floating_ip_port_forwarding,
floatingip_autodelete_internal,
floatingip_pools,
ip_allocation,
ip_substring_port_filtering,

View File

@ -99,6 +99,7 @@ KNOWN_EXTENSIONS = (
'fip-port-details',
'flavors',
'floating-ip-port-forwarding',
'floatingip-autodelete-internal',
'floatingip-pools',
'ip-substring-filtering',
'l3-ha',

View File

@ -0,0 +1,30 @@
# Copyright 2019 Ericsson
#
# 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.
from neutron_lib.api.definitions import l3
ALIAS = 'floatingip-autodelete-internal'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Autodelete floating IPs of internal networks'
DESCRIPTION = 'Autodelete unused floating IPs' \
' of networks being turned to router:external=False'
UPDATED_TIMESTAMP = '2019-01-24T00:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [l3.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,20 @@
# Copyright 2019 Ericsson
#
# 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.
from neutron_lib.api.definitions import floatingip_autodelete_internal
from neutron_lib.tests.unit.api.definitions import base
class FloatingIPAutodeleteInternalTestCase(base.DefinitionBaseTestCase):
extension_module = floatingip_autodelete_internal

View File

@ -0,0 +1,4 @@
---
features:
- |
New shim API extension: ``floatingip-autodelete-internal``.