All of these exceptions and constants have been in
neutron-lib for a while, start using them.
While looking for other things to consume found an old
neutron-lib TODO that did not apply anymore, so removed.
TrivialFix
Change-Id: I9431075a50ba05be872db422125e6af6266ccb99
It seems that _validate_create_network_callback notified without
network_id in payload, to avoid issues in such case return.
Change-Id: I15d22e0e2b4bf3e4f882b521bcd6a13f84e4feed
Closes-Bug: #2008912
In ``QoSPlugin._get_ports_with_policy``, if the network IDs list is
empty, the SQLAlchemy throws the following warning:
SELECT statement has a cartesian product between FROM element(s)
"subports_1", "ports", "portnumaaffinitypolicies_1",
"testportextensions_1", "portuplinkstatuspropagation_1",
"portdataplanestatuses_1", "standardattributes_2",
"portdeviceprofiles_1", "ml2_port_bindings_1",
"portsecuritybindings_1", "portdnses_1",
"securitygroupportbindings_1", "qos_network_policy_bindings_1",
"qos_port_policy_bindings_1", "trunks_1",
"standardattributes_1" and FROM element "networks". Apply
join condition(s) between each element to resolve.
This patch avoids this query by checking the network IDs list. If the
list is empty, the expected port list will be too. This is also a
small optimization because we are skipping the port query.
This patch is also applying the same logic to the second query in this
method.
Closes-Bug: #2018000
Change-Id: Ia5380bc78cc1d0136e11cc4692069279419e285e
This patch adds support for QoS minimum bandwidth rules in tunnelled
networks. Now the ML2/OVS and ML2/OVN mechanism drivers can represent
in the Placement API the available bandwidth of the tunnelled networks
in each compute host.
Both mechanism drivers represent the compute VTEP (VXLAN) or TEP
(Geneve) interface as an IP address. This new resource provider
(by default called "rp_tunnelled") represents the available bandwidth
of this interface. Any new port created in a compute node that belongs
to a tunnelled network, will request to the Placement API the
corresponding bandwidth from the resource provider inventory.
This patch does not provide backend enforcement support for minimum
bandwidth rules.
RFE spec: https://review.opendev.org/c/openstack/neutron-specs/+/860859
What is missing and will be added in next patches:
* Tempest tests, that will be pushed to the corresponding repository.
Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/863880
Partial-Bug: #1991965
Related-Bug: #1578989
Change-Id: I3bfc2c0f9566bcc6861ca91339e32257ea92c7e9
Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/services.
Trivialfix
Change-Id: Ie9779b257981bc80e69639cdaa4d7dfd0ffa5809
Add packet rate limit rule to the openvswitch QoS
driver SUPPORTED_RULES list. This patch adds the
ability to limit neutron port packet I/O rate. We
will leverage the ovs meter to achieve the limitation.
The meter action is only supoorted when datapath is
in user mode (with ovs >= 2.7) or ovs kernel datapath with
kernel version >= 4.15 (and ovs >= 2.10).
[1] https://docs.openvswitch.org/en/latest/faq/releases/
Partially-Implements: bp/packet-rate-limit
Related-Bug: #1938966
Related-Bug: #1912460
Change-Id: Ib6341ad539afc9f94f1783a721cf5f793ccdc7d8
Added support for filtering the QoS rule type list command.
Two new filter flags are added:
- all_supported: if True, the listing call will print all QoS rule
types supported by at least one loaded mechanism driver.
- all_rules: if True, the listing call will print all QoS rule types
supported by the Neutron server.
Both filter flags are exclusive and not required.
Depends-On: https://review.opendev.org/c/openstack/neutron-lib/+/827533
Closes-Bug: #1959749
Change-Id: I41eaab177e121316c3daec34b309c266e2f81979
Introduce a new API extension to enable GET, PUT and DELETE
operations on QoS minimum packet rate rule without specifying
policy ID.
Partial-Bug: #1922237
See-Also: https://review.opendev.org/785236
Change-Id: Ia083b5ac98c9e18ddbcdd2e0fc46f2f8432a628c
If port has no QoS policy on its own, fallback to the network
QoS policy and use it to check if Placement allocation needs
to be updated.
Closes-Bug: #1915849
Change-Id: Iffc87e4021391bcb98375621739a59064540a6a7
Today the sriov qos service plugin blindly blocks creating ports
with minimum bandwidth qos and with direct_physical vnic_type. This was
originally added when only dataplane enforcement was the scope of the
qos service plugin. However in the last many releases we created
placement enforcement for this qos rule regardless of the vnic_type.
So now blindly blocking the port creation is now preventing using the
placement enforcement for this rule for direct_physical ports.
This patch removes this limitation by marking minimum bandwidth as
supported rule for the sriov qos service plugin. The limitation that
data plane enforcement is not supported for this rule remains. The agent
will not even try to apply any kind of rules to these ports as port
binding is not forwarded for the sriov agent at all.
The documentation is extended to explain that placement enforcement now
works while data plane enforcement still not supported.
This is somewhat similar to the case when the support for egress
direction is added to the minimum bandwidth rule, while the sriov data
plane enforcement was not (could not) been implemented for this
direction in the sriov agent. Today the sriov agent simply ignores the
egress direction rules in the minimum bandwidth qos rule during applying
the data plane enforcement.
Closes-Bug: #1949877
Change-Id: I20ad32eac414ff90b551bff940d92cbcfa848101
When QoS policy is changed on a network, placement allocation of bound
ports in that network has to be updated. This applies only to ports
that do not overwrite network QoS policy.
To detect network resource change, a new callback is registered for
AFTER_UPDATE event.
Closes-Bug: #1915898
Change-Id: Ibc71d26cbb0dce99ea6dad9e5ccd0966e72f3f20
Remove the QoS constants from Neutron code. QoS constants are now
located in ``neutron_lib.services.qos.constants``.
This patch also reverts [1]. This patch was merged in order to
allow a newer neutron-lib release in "requirements". This test
was failing because the element order of the "VALID_RULE_TYPES"
list was different between Neutron and neutron-lib. That was
modifying the "QosRuleType" OVO hash.
[1]https://review.opendev.org/c/openstack/neutron/+/817940
Closes-Bug: #1950977
Related-Bug: #1922237
Change-Id: I31edea3cc0f4a284a773a35302997ca6069efc95
In order to be able to schedule a port bound to OVN backend and a
minimum bandwidth rule, this type of QoS rule should be supported
in the mechanism QoS driver ``OVNQosDriver``.
This new QoS rule has no driver enforcement; it is used only for
Placement scheduling.
Partial-Bug: #1578989
Change-Id: Ia10aae1820f13bb28956d9ef45eced2dba71be98
This patch does *not* implement dataplane enforcement.
QoS minimum packet rate rule is enabled in OVS backend driver and
create/delete/update empty methods are added to enable placement
enforcement.
Partial-Bug: #1922237
See-Also: https://review.opendev.org/785236
Change-Id: Ie283ad3a4ec433c88ac23f798908cd143159394b
This patch implements support for CRUD operations for QoS minimum
packet rate, for example:
DELETE /qos/policies/$POLICY_ID/minimum_packet_rate_rules/$RULE_ID
Placement or dataplane enforcement is not implemented yet.
Partial-Bug: #1922237
See-Also: https://review.opendev.org/785236
Change-Id: Ie994bdab62bab33737f25287e568519c782dea9a
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 patch adds new API extension to QoS service plugin
to allow CURD actions for packet rate limit (packet per
second) rule in Neutron server side.
NOTE: This patch will NOT implement the real functionality
in L2/L3 backend to limit the pps.
Co-Authored-By: NANALI <lin203@chinaunicom.cn>
Closes-bug: #1912460
Change-Id: Icc88accb88d9cec40c960c56f032c3c27317b42e
The os-resource-classes lib is the official source of the standard
placement resource classes. Currently, the neutron-lib contains a copy
of those constants. However, they are already marked as deprecated and
are going to be removed with next major release.
Related-Bug: #1934256
Change-Id: I33ecd6f32410f9b7ab1e87a6640201ea157bc383
This reverts commit 062336e59b.
Now, we have proper fix for the system_scope='all' in elevated context
in the neutron-lib so we can revert temporary fix made at the end of the
Wallaby cycle.
Related-Bug: #1920001
Conflicts:
neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py
neutron/common/utils.py
neutron/db/address_group_db.py
neutron/services/segments/db.py
Change-Id: Ife9b647b403bdd76a8a99984ea8858bf95c96bc3
This patch switches the code over to the payload style of callbacks
for PORT BEFORE_CREATE and PRECOMMIT_CREATE events
Change-Id: Ia6903be1af4de575ab9d82c9cb0c88290d07abb3
This patch switches over to the payload style of callbacks for
NETWORK based events. As part of this change a few shims are needed
to handle cases where some callbacks don't yet use payloads and others
do. Once we move over to payloads for all callbacks the shims can be
removed.
NeutronLibImpact
Change-Id: I889364b5d184d47a79fe6ed604ce13a4b334acfa
In case when enforce_new_defaults is set to True and new policy rules
are used, context.is_admin flag isn't really working as it was with old
rules.
But in case when elevated context is needed, it means that we need
context which has full rights to the system. So we should also set
"system_scope" parameter to "all" to be sure that system scope queries
can be done with such elevated context always.
It is needed e.g. when elevated context is used to get some data from
db. In such case we need to have db query which will not be scoped to
the single project_id and with new defaults to achieve that system_scope
has to be set to "all".
Proper fix for that should be done in neutron-lib and it is proposed
in [1] already but as we are have frozen neutron-lib version for
stable/wallaby already this patch for neutron is temporary fix for that
issue.
We can revert that patch as soon as we will be in Xena development cycle
and [1] will be merged and released.
[1] https://review.opendev.org/c/openstack/neutron-lib/+/781625
Related-Bug: #1920001
Change-Id: I0068c1de09f5c6fae5bb5cd0d6f26f451e701939
Minimum bandwidth QoS rule is only applicable for the network which is
backed by physical networks.
It will raise exception when you want to set Minimum bandwidth QoS rule
or update rule on network without ports.
Closes-Bug: #1913180
Change-Id: I6ab945086b13730ad60957760bbc2eb5c321aca2
Apply qos resource extend func for a full list of ports,
not for each port individually, thus avoiding DB queries for each
individual port.
This should drastically improve port list time in case of many
ports/network with QoS policies assigned.
Change-Id: I1d0b3975ae6e92e34e9da20a0e26ce024422d332
Closes-Bug: #1905726
Only min bw rules are required hence no need to fetch
all rules of QoS policy.
Also no need to get qos policy from DB
Partial-Bug: #1905726
Change-Id: Iad29cb34825adaa8c766d01b192a6bbe9992148b
This patch implements the last code bits pending to
conclude the new DB engine facade migration.
Due to the resultant interactions in the modified code, is
not possible to submit smaller patches; this code must be
migrated at once.
Partially-Implements blueprint: enginefacade-switch
Signed-off-by: Slawek Kaplonski <skaplons@redhat.com>
Co-Authored-By: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Change-Id: Id3f09b78c8d0a8daa7ec4fa6f5bf79f7d5ab8f8b
As spotted in Focal testing patch [0], pep8 test fails with many
C0321 false-positives, reported in pylint as current version does not
support python 3.8 [1]
Use a newer version of pylint and astroid, fixing or disabling some of
the new checks: no-else-*, unnecessary-comprehension, import-outside-toplevel
[0] https://review.opendev.org/#/c/738163/
[1] https://github.com/PyCQA/pylint/issues/2737
Change-Id: Ie646b7093aa8634fd950c136a0eba9adcf56591c
The QoS OVN client extension is moved to the ML2 driver. This
extension is called from the OVN driver in the events of:
- create port
- update port
- delete port
- update network
The QoS OVN client extension now can accept several rules per policy
as documented in the SUPPORTED_RULES. The QoS OVN client extension
can write one OVN QoS rule per flow direction and each OVN QoS rule
register can hold both a bandwidth limit rule and a DSCP marking rule.
The "update_policy" method is called from the OVN QoS driver, when
a QoS policy or its rules are updated.
The QoS OVN client extension updates the QoS OVN registers
exclusively, based on the related events.
Closes-Bug: #1863852
Change-Id: I4833ed0c9a2741bdd007d4ebb3e8c1cb4c30d4c7
The ovs qos driver only supports the min-bw rule on physnet ports.
However other (future) qos drivers may support the min-bw rule on
non-physnet ports too, therefore implementing the rejection of the
unsupported combination in the qos plugin was a bug.
This change moves the rejection from the qos plugin to the ovs qos
driver.
Change-Id: I02d77a03c411dc8ab303a7d7b53d7ea93cc9f4c6
Closes-Bug: #1861442
Depends-On: https://review.opendev.org/705694
Related-Bug: #1819029
If QoS rule is QosBandwidthLimitRule, then the generated options in
the QoS OVN driver of the QoS service should contain those two
parameters: "qos_max_rate" and "qos_burst".
According to [1], the units used are:
- qos_max_rate: kbps, the one used in Neutron
- qos_burst: kilobits, the one used in Neutron
A "rule.max_kbps" value should be always present in the rule, but not
"rule.max_burst_kbps". This value can be None in
OvnNbApiIdlImpl.QoSAddCommand.
[1]http://www.openvswitch.org/support/dist-docs/ovn-nbctl.8.html
Change-Id: Ie1598be7d21f33df6b1a66fa71ba6783d2433dca
Closes-Bug: #1861680
Make use of the OVO Port new field "qos_network_policy_id" to avoid
a DB call.
Change-Id: I3724acfbe88ab3db1641c3edb5dd4c76bc84bc00
Related-Bug: #1834484