[stable-only] Fix allocation update for min bw rule with different direction
Neutron API supports QoS policy change on a bound port. The new QoS
policy can contain a different set of rules, or different values. In
case of QoS minimum bandwidth rule, it can be min_kbps or direction
attribute. If the new QoS minimum bandwidth rule is different than the
one in previous QoS policy, Placement allocation has to be updated.
An issue arises when QoS minimum bandwidth rule direction is changed.
Ingress and egress directions are represented with separate resource
classes: NET_BW_IGR_KILOBIT_PER_SEC and NET_BW_EGR_KILOBIT_PER_SEC
respectively. During direction change, resource class representing old
direction is freed and a resource class representing the new direction
is requested. update_qos_minbw_allocation() implementation always
expects requested resource class to be present in the allocation that
is being updated, but that assumption is wrong. If current Placement
allocation record doesn't contain particular resource class, we need to
use 0 as a default value.
Similarly, we should defer deletion of RP from request body until all
items from minbw_alloc_diff are processed. Only then we can be certain
that this RR is not going to have any resources.
This commit is based on 47a08e36bf864806ca71ea77ffcf6602d4e5db04.
Reviewed: https:/ /review. opendev. org/c/openstack /neutron- lib/+/817528 /opendev. org/openstack/ neutron- lib/commit/ 997be4d13b183b5 f9bac1462da5aea ec0c44714d
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/xena
commit 997be4d13b183b5 f9bac1462da5aea ec0c44714d
Author: Przemyslaw Szczerbik <email address hidden>
Date: Tue Nov 2 11:24:44 2021 +0100
[stable-only] Fix allocation update for min bw rule with different direction
Neutron API supports QoS policy change on a bound port. The new QoS
policy can contain a different set of rules, or different values. In
case of QoS minimum bandwidth rule, it can be min_kbps or direction
attribute. If the new QoS minimum bandwidth rule is different than the
one in previous QoS policy, Placement allocation has to be updated.
An issue arises when QoS minimum bandwidth rule direction is changed. IGR_KILOBIT_ PER_SEC and NET_BW_ EGR_KILOBIT_ PER_SEC qos_minbw_ allocation( ) implementation always
Ingress and egress directions are represented with separate resource
classes: NET_BW_
respectively. During direction change, resource class representing old
direction is freed and a resource class representing the new direction
is requested. update_
expects requested resource class to be present in the allocation that
is being updated, but that assumption is wrong. If current Placement
allocation record doesn't contain particular resource class, we need to
use 0 as a default value.
Similarly, we should defer deletion of RP from request body until all
items from minbw_alloc_diff are processed. Only then we can be certain
that this RR is not going to have any resources.
This commit is based on 47a08e36bf86480 6ca71ea77ffcf66 02d4e5db04.
Partial-Bug: #1943724 3ba07ca18648f16 a982a2e267b
Change-Id: I9a0df4d461c0e7