From b2d113a4092ccf3a66380c75d46b3b38b15118e2 Mon Sep 17 00:00:00 2001 From: Boden R Date: Thu, 14 Feb 2019 08:31:45 -0700 Subject: [PATCH] rehome trunk service constants While [1] rehomed trunk callback resource names, this patch rehomes the trunk service constants. These constants are used throughout our consumer base [2]. [1] https://review.openstack.org/#/c/635209/ [2] http://codesearch.openstack.org/?q=from%20neutron.services.trunk%20import%20constants Change-Id: I20ed69ba823d81220650bb8f34514121fe4399d2 --- neutron_lib/services/trunk/__init__.py | 0 neutron_lib/services/trunk/constants.py | 80 +++++++++++++++++++ .../rehome-trunk-consts-407e4590e9386d19.yaml | 5 ++ 3 files changed, 85 insertions(+) create mode 100644 neutron_lib/services/trunk/__init__.py create mode 100644 neutron_lib/services/trunk/constants.py create mode 100644 releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml diff --git a/neutron_lib/services/trunk/__init__.py b/neutron_lib/services/trunk/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron_lib/services/trunk/constants.py b/neutron_lib/services/trunk/constants.py new file mode 100644 index 000000000..2fcfdd996 --- /dev/null +++ b/neutron_lib/services/trunk/constants.py @@ -0,0 +1,80 @@ +# All Rights Reserved. +# +# 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. + + +# Valid trunk statuses + +# The trunk is happy, yay! +# A trunk remains in ACTIVE state when updates like name or admin_status_up +# occur. It goes back to ACTIVE state from other states (e.g. BUILD) when +# logical and physical resource provisioning has completed successfully. The +# attribute ADMIN_STATE_UP is not to be confused with STATUS: the former +# indicates whether a trunk can be managed. If a trunk has admin_state_up +# equal to false, the trunk plugin will reject any user request to manage +# the trunk resources (i.e. adding/removing sub-ports). ACTIVE_STATUS +# reflects the provisioning state of logical and physical resources associated +# with the trunk. +TRUNK_ACTIVE_STATUS = 'ACTIVE' + +# A trunk is in DOWN state any time the logical and physical resources +# associated to a trunk are not in sync. This can happen in the following +# cases: +# a) A user has asked to create a trunk, or add(remove) subports to a +# trunk in ACTIVE state. In this case, the plugin has created/updated the +# logical resource, and the request has been passed along to a backend. The +# physical resources associated to the trunk are in the process of being +# (de)commissioned. While this happens, the logical and physical state are +# mismatching, albeit temporarily during subport operations, or until a user +# spawns a VM after a trunk creation. +# b) A system event, such as instance deletion, has led to the deprovisioning +# of the entire set of physical resources associated to the trunk. In this +# case, the logical resource exists but it has no physical resources +# associated with it, and the logical and physical state of the trunk are +# not matching. +TRUNK_DOWN_STATUS = 'DOWN' + +# A driver/backend has acknowledged the server request: once the server +# notifies the driver/backend, a trunk is in BUILD state while the +# backend provisions the trunk resources. +TRUNK_BUILD_STATUS = 'BUILD' + +# Should any temporary system failure occur during the provisioning process, +# a trunk is in DEGRADED state. This means that the trunk was only +# partially provisioned, and only a subset of the subports were added +# successfully to the trunk. The operation of removing/adding the faulty +# subports may be attempted as a recovery measure. +TRUNK_DEGRADED_STATUS = 'DEGRADED' + +# Due to unforeseen circumstances, the user request has led to a conflict, and +# the trunk cannot be provisioned correctly for a subset of subports. For +# instance, a subport belonging to a network might not be compatible with +# the current trunk configuration, or the binding process leads to a persistent +# failure. Removing the 'offending' resource may be attempted as a recovery +# measure, but readding it to the trunk should lead to the same error +# condition. A trunk in ERROR status should be brought back to a sane status +# (i.e. any state except ERROR state) before attempting to add more subports, +# therefore requests of adding more subports must be rejected to avoid +# cascading errors. +TRUNK_ERROR_STATUS = 'ERROR' + + +# String literals for identifying trunk resources +# also see SUBPORTS, TRUNK and TRUNK_PLUGIN in neutron_lib.callbacks.resources +TRUNK_PARENT_PORT = 'parent_port' +TRUNK_SUBPORT_OWNER = 'trunk:subport' + + +# String literals for segmentation types +SEGMENTATION_TYPE_VLAN = 'vlan' +SEGMENTATION_TYPE_INHERIT = 'inherit' diff --git a/releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml b/releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml new file mode 100644 index 000000000..b71de3d30 --- /dev/null +++ b/releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml @@ -0,0 +1,5 @@ +--- +features: + - The trunk service constants are now available in + ``neutron_lib.services.trunk.constants``, but now have the + constant name prefixed with ``TRUNK_``.