Fix gate for neutron-lib v2.14

A patch [1] that updates upper-constraints.txt for neutron-lib 2.14 fails
to pass check pipeline.

Due to development sequence it's necessary to append a new rule type
to VALID_RULE_TYPES in Neutron first, and then move it to neutron-lib.
Because of this process, there's a risk that the new rule type is
present in both Neutron and in neutron-lib.

This is why check pipeline keeps failing with neutron-lib v2.14, as it
contains 'packet_rate_limit' and in Neutron we append it to the list
anyways, ending up with duplicates.

This patch ensures that there are no duplicates in VALID_RULE_TYPES.

[1] https://review.opendev.org/c/openstack/requirements/+/805352

Change-Id: Ib6963f402c9fec8169afcf467d613bba4e06130d
This commit is contained in:
Przemyslaw Szczerbik 2021-08-23 14:17:00 +02:00
parent 84d9bb1e0e
commit 0bb9c99d50
1 changed files with 9 additions and 1 deletions

View File

@ -19,4 +19,12 @@ from neutron_lib.services.qos import constants as qos_consts
# to neutron-lib after neutron has the new rule.
# Add qos rule packet rate limit
RULE_TYPE_PACKET_RATE_LIMIT = 'packet_rate_limit'
VALID_RULE_TYPES = qos_consts.VALID_RULE_TYPES + [RULE_TYPE_PACKET_RATE_LIMIT]
# NOTE(przszc): Ensure that there are no duplicates in the list. Order of the
# items in the list must be stable, as QosRuleType OVO hash value depends on
# it.
# TODO(przszc): When a rule type is moved to neutron-lib, it can be removed
# from the list below.
VALID_RULE_TYPES = (qos_consts.VALID_RULE_TYPES +
([RULE_TYPE_PACKET_RATE_LIMIT] if RULE_TYPE_PACKET_RATE_LIMIT not in
qos_consts.VALID_RULE_TYPES else [])
)