Merge "New ``network-ha`` API definition"

This commit is contained in:
Zuul 2023-05-08 23:45:10 +00:00 committed by Gerrit Code Review
commit ab8a9dd0d9
6 changed files with 75 additions and 0 deletions

View File

@ -47,6 +47,14 @@ 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.
HA extension
============
The ``network-ha`` extension allows to pass a boolean parameter during the
network creation. If ``true`` is passed, a ``ha_router_networks`` database
register will be created along with the ``network`` register. This field is
not visible and, initially, not meant to be supported in the CLI.
L2 adjacency extension
======================

View File

@ -4768,6 +4768,12 @@ network-admin_state_up-request:
in: body
required: false
type: boolean
network-ha:
description: |
The high availability input flag when creating a network.
in: body
required: false
type: boolean
network-id:
description: |
The ID of the network.

View File

@ -82,6 +82,7 @@ from neutron_lib.api.definitions import multiprovidernet
from neutron_lib.api.definitions import network
from neutron_lib.api.definitions import network_availability_zone
from neutron_lib.api.definitions import network_cascade_delete
from neutron_lib.api.definitions import network_ha
from neutron_lib.api.definitions import network_ip_availability
from neutron_lib.api.definitions import network_mtu
from neutron_lib.api.definitions import network_mtu_writable
@ -232,6 +233,7 @@ _ALL_API_DEFINITIONS = {
network,
network_availability_zone,
network_cascade_delete,
network_ha,
network_ip_availability,
network_mtu,
network_mtu_writable,

View File

@ -0,0 +1,43 @@
# 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 import converters
from neutron_lib.api.definitions import l3
from neutron_lib.api.definitions import network
ALIAS = 'network_ha'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Network HA creation flag'
API_PREFIX = ''
DESCRIPTION = 'Network high availability creation flag.'
UPDATED_TIMESTAMP = '2023-04-27T10:00:00-00:00'
RESOURCE_NAME = network.RESOURCE_NAME
COLLECTION_NAME = network.COLLECTION_NAME
HA = 'ha'
RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
HA: {
'allow_post': True,
'allow_put': False,
'is_visible': False,
'default': False,
'convert_to': converters.convert_to_boolean,
},
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [l3.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -62,6 +62,14 @@ class HasProjectPrimaryKey(HasProject):
nullable=False, primary_key=True)
class HasProjectPrimaryUniqueKey(HasProject):
"""Project mixin, add to subclasses that have a user."""
# NOTE: project_id is just a free form string
project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE),
nullable=False, primary_key=True, unique=True)
class HasId(object):
"""id mixin, add to subclasses that have an id."""

View File

@ -0,0 +1,8 @@
---
features:
- |
New API definition: ``network-ha``. This boolean field can be used only
during the network creation. If enabled, the Neutron server will create
a ``ha_router_networks`` register, that binds the project with the network
and represents the only high availability network that can be created per
project.