Files
neutron/neutron/common/experimental.py
T
Miguel Lavalle 7f0413c84c Implement experimental features framework
During the Zed PTG it was decided to handle unsupported features in
Neutron as experimental. See section titled "When we say something is
not supported?", day 2 in [1]. The agreement was:

"We keep existing jobs for linuxbridge driver for example, but when the
tests start to fail we skip them and finally we stop the job also.
To make it clear for operators we add warning logs highlighting that the
given feature/driver is experimental, and introduce cfg option to enable
such features explicitly."

This commit implements this agreement, initially with Linuxbridge

Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/845646

[1] https://lists.openstack.org/pipermail/openstack-discuss/2022-April/028164.html

Change-Id: Ib18efa3f472736b58c8967847b1061da0e3897d7
2022-06-30 17:59:49 -05:00

40 lines
1.3 KiB
Python

# 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 oslo_config import cfg
from oslo_log import log
from neutron.conf import experimental
LOG = log.getLogger(__name__)
CONF = cfg.CONF
experimental.register_experimental_opts()
def validate_experimental_enabled(feature):
try:
is_enabled = cfg.CONF.experimental[feature]
except cfg.NoSuchOptError:
LOG.error("Experimental feature '%s' doesn't exist", feature)
raise SystemExit(1)
if is_enabled:
LOG.warning("Feature '%s' is unsupported and is treated as "
"experimental. Use at your own risk.", feature)
else:
LOG.error("Feature '%s' is experimental and has to be explicitly "
"enabled in 'cfg.CONF.experimental'", feature)
raise SystemExit(1)