Commit Graph

36 Commits

Author SHA1 Message Date
Slawek Kaplonski a22d6d6a95 Use ovs constants from neutron-lib
Ovs constants were moved from neutron to neutron_lib some time ago.
This patch switches to use them from neutron-lib already.

That decision was agreed during the Neutron team meeting. See [1] for
details.

[1] https://meetings.opendev.org/meetings/networking/2021/networking.2021-11-09-14.00.log.html#l-83

Requires: https://review.opendev.org/c/openstack/neutron-lib/+/834908

Change-Id: I2fd1954bec6a52856195190441d77ac8b7d97055
2022-06-17 10:36:44 +05:30
Rodolfo Alonso Hernandez a1d7d7a485 [QoS] Unify agent "qos_network_policy_id" constant
Use the same string for the network QoS policy ID in the agents and
the server.

Trivial-Fix

Change-Id: Idf90582d5dd25945ca6c0dcb21320cb356802f15
2022-04-27 16:51:34 +00:00
Brian Haley 7594bb0627 Remove the dependency on the "mock" package
Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Fixed an inconsistency in the OVSBridge.deferred() definition
as it needs to also have an *args argument.

Fixed an issue where an l3-agent test was mocking
functools.partial, causing a python3.8 failure.

Unit tests only, removing from tests/base.py affects
functional tests which need additional work.

Change-Id: I40e8a8410840c3774c72ae1a8054574445d66ece
2020-04-28 18:05:37 -04:00
Brian Haley b79842f289 Start enforcing E125 flake8 directive
Removed E125 (continuation line does not distinguish itself
from next logical line) from the ignore list and fixed all
the indentation issues.  Didn't think it was going to be
close to 100 files when I started.

Change-Id: I0a6f5efec4b7d8d3632dd9dbb43e0ab58af9dff3
2019-07-19 23:39:41 -04:00
Ihar Hrachyshka 4aeec20001 Drop of_interface option
Default value for "of_interface" config option was switched
to "native" in Pike release.
In the same release this option was deprecated to removal.
Now it's time to remove it and force use of "native" driver to
manage openflows.

Change-Id: Ic900209868acfbe3bbb56fabbbf5c4472857e412
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>
2019-05-24 10:33:48 +02:00
Rodolfo Alonso Hernandez cc8808d539 Add QoS minimum egress bandwidth rule into ovs-agent
Add minimum egress bandwidth support for Open vSwitch.

The scope of this implementation is reduced to N/S traffic.
There is no QoS applied on traffic between VMs.

The QoS rules are aplied to exit ports in bridges other than
br-int; that means all physical bridges. No tunneled traffic
will be shaped. This feature will be implemented in a following
patch.

Partial-Bug: #1560963
Change-Id: I0a2ef52b13151a39e678e9a3e6f75babb47298d0
2019-02-26 11:05:04 +00:00
liuchengqian90 6f927cc119 Clear old rules that have been applied before applying new rules.
To prevent data from being out of sync in the following situations:
1. Create a policy with two rules bound to the virtual machine
2. Stop l2-agent
3. Delete/change/clear policy rule
4. Start l2-agent (the rule is still there, out-of-sync)

Change-Id: I194c918d859172c31ae5ce1af925fdbb388f9cfb
Closes-Bug: #1812576
2019-02-08 02:57:27 +00:00
liuchengqian90 58de79a58b Clear residual qos rules after l2-agent restarts.
During the l2-agent stop, if the policy rule is cleared,
after the l2-agent is started, the qos rule that has been applied should be cleared.

Change-Id: Iaaff10dfa8ac6ab8c9dead3124e2bb3caa03a665
Closes-Bug: #1810025
2019-01-18 02:24:56 +00:00
Chengqian Liu 7a27e24447 Reduce qos rpc times on the ovs-agent side
When multiple ports are bound to qos-policy with the same id,
ovs-agent should check whether the cache has policy information
instead of directly reading rpc when processing the port.

Change-Id: I88f9f5af95439f1536799169390764c89109f467
Closes-Bug: #1783559
2018-08-16 15:59:32 +03:00
Boden R 1b8664f8e1 use qos constants from neutron-lib
neutron-lib contains the QoS constants. This patch removes them from
neutron and replaces all such uses to lib's QoS constants.

NeutronLibImpact

Change-Id: I6ed379b178a2b79fd14385a1d1e87d87eb04bfb9
2017-10-26 19:57:19 +00:00
Boden R 864f8072b2 consume load_class_by_alias_or_classname from neutron-lib
neutron-lib now contains the load_class_by_alias_or_classname function.
This patch removes the function from neutron and uses it from lib.

NeutronLibImpact

Change-Id: I47ef642fcb3c8ded5eb7ed0a637033c7bcb3632b
2017-10-21 06:01:15 -06:00
Boden R 0822b0aef4 consume common constants from lib
The neutron-lib commit I360545b6ee4291547e0c5c8e668ad03d3efa4725 moved
the externally consumed globals from neutron.common.constants into lib.
With the exception of PROVISIONAL_IPV6_PD_PREFIX all other constants
in neutron.common.constants should only be used in neutron, and will
hopefully remain that way. External consumers needing access to other
common constants should move them into lib first.

NeutronLibImpact

Change-Id: Ie4bcffccf626a6e1de84af01f3487feb825f8b65
2017-10-13 11:45:18 -06:00
Sławek Kapłoński 30fc4c4690 Extend QoS L2 drivers interface to handle ingress rule types
There is a need to extend QoS L2 drivers interface to allow
remove of ingress rules.

For that kind of rule types which have direction attribute
L2 drivers should provide handler method called
delete_<rule_type>_ingress

Partially-Implements: blueprint instance-ingress-bw-limit

Change-Id: I9ba309a0889f9b8fb4902203e9689218974eb463
2017-06-05 16:58:00 +00:00
Terry Wilson 1eec265ad0 Update to support the ovdsbapp 0.4.0 API
idl_factory was removed in favor of just passing in an Idl instance
as an Idl doesn't start a connection until its .run() is called.

The try/excepts will be removed when the ovsdbapp 0.4.0 constraint
changes are merged.

Change-Id: Id22faa1f6179c2fdf8a136972d65f10749c9fc2e
2017-05-17 19:58:34 +00:00
David Shaughnessy 21359e29ae Clear QoS rules from ports without a qos policy.
This patch addresses a bug where ports that had their QoS policy
removed did not have the rules deleted as the agent was restarting
and cleared the internal port info. This results in the policy still
being in effect while it has been cleared from the port qos-policy field.

Change-Id: I2e8e4aa96d2fd15b344220c4bf8a4713197fae4e
Closes-Bug: 1663908
2017-03-27 13:50:27 +00:00
Armando Migliaccio ca751a1486 Spin off context module
NeutronLibImpact

Partially-implements: blueprint neutron-lib

Change-Id: I48cf45dc1b07035d952152eac2548a3bd9fc2832
2017-03-06 16:25:29 +00:00
Denis Buliga 7fc79f43dc Refactors QosAgentDriver
QosAgentDriver has a method which uses linux specific module, which
is trying to import pyroute2.

Module pyroute2 tries to import a module from socket which does not
exists on windows (socket.inet_pton[1]). This can cause neutron
services to fail to start on windows[2].

[1]: https://docs.python.org/2/library/socket.html#socket.inet_pton
[2]: http://paste.openstack.org/show/593272/

Change-Id: I706368bfcaece380e1357e0c504fd3b9553ba49c
Related-Bug: #1492714
2017-01-03 04:34:44 -08:00
Kevin Benton cf6ffb78f6 Pass context and resource_type in RPC callback
Maintaining the context is important for keeping the request ID
and subsequently operator/developer sanity while debugging.
The resource_type is also helpful to have since a function could be
subscribed for multiple resources.

This maintains and deprecates the existing 'subscribe' method for
backwards compatibility with callbacks that don't support receiving
the context and resource type. A new 'register' method is added
for callbacks to use that are compatible with receiving the context.

Change-Id: I06c8302951c99039b532acd9f2a68d5b989fdab5
2016-12-08 06:03:59 -08:00
Miguel Angel Ajo 7f617e6a21 Introduce bulk push to rpc callback mechanism
There are usage patterns which would benefit from having
the capability to send a list of resources in bulk instead
of using individual fanout messages.

From now on, the rpc callback subscriber receives a list of
resources (single or multiple), and the pushers must always
push a list.

Backwards compatibility for QoSPolicy consumers in mitaka
is provided by calling push with "resource" parameter for
single item lists during one release cycle. That will be
dropped when Ocata opens.

Partially-implements: blueprint vlan-aware-vms

Change-Id: I1117925360a29ecbd1902fa527b2f24f94ce81ec
2016-08-01 14:22:56 -07:00
Nate Johnston 01a6c9c426 Generalize agent extension mechanism
This change generalizes agent extension code so that all agents can take
advantage of a common mechanism.

Co-Authored-By: Margaret Frances <margaret_frances@cable.comcast.com>

Partially-Implements: blueprint l3-agent-extensions

Change-Id: I9380343c09d28eec67077c9e6d77c33a195e516b
2016-07-19 13:45:22 +00:00
Inessa Vasilevskaya bdeb7bcc2b enable OVSDB native interface by default
- unit tests were fixed mainly by mocking
  Connection class of native implementation.

- some ovs-lib tests rely on direct ovs-vsctl
  output. Temporarily decorated with @vsctl_only.

UpgradeImpact

Change-Id: I2632b0e21edd61536867a9fc830a45d9899091e4
2016-06-25 10:43:12 +03:00
Sławek Kapłoński f766fc71be Add setting default max_burst value if not given by user
If user will not provide burst value for bandwidth limit rule there is
need to set such value on appropriate to ensure that bandwith limit
will work fine.
To ensure at least proper limitation of TCP traffic we decided to set
burst as 80% of bw_limit value.
LinuxBridge agent already sets is like that. This patch add same
behaviour for QoS extension driver in openvswitch L2 agent.

DocImpact: Add setting default max_burst value in LB and OvS drivers

Change-Id: Ib12a7cbf88cdffd10c8f6f8442582bf7377ca27d
Closes-Bug: #1572670
2016-05-12 10:06:54 +00:00
Henry Gessau ae5bad49cc Use exceptions from neutron-lib
Related-Blueprint: neutron-lib

Change-Id: Ia014468bd621c4ee6aea95bf19328c61070174c4
2016-04-21 21:29:44 -04:00
Cedric Brandily edc342be42 Remove unnecessary executable permissions
This removes executable permissions on python modules not requiring it.

Change-Id: I844afa45f9e3d634ad1bcb90c9999d4237dc7f36
2016-03-25 01:49:26 +00:00
David Shaughnessy a9a1943fde DSCP QoS rule implementation
This patch adds the front end and back end implementation of QoS DSCP.

Associated patches that are dependent on this one:

* python-neutronclient: https://review.openstack.org/#/c/254280
* openstack-manuals: https://review.openstack.org/#/c/273638
* API Guide: https://review.openstack.org/#/c/275253
* Heat:
  * Spec: https://review.openstack.org/#/c/272173
  * QoSDscpMarkingRule resource: https://review.openstack.org/#/c/277567
* Fullstack tests: https://review.openstack.org/#/c/288392/

APIImpact - The API now supports marking traffic egressing from a VM's
            dscp field with a valid dscp value.

Co-Authored-By: Nate Johnston <nate_johnston@cable.comcast.com>
Co-Authored-By: Victor Howard <victor.r.howard@gmail.com>
Co-Authored-By: Margaret Frances <margaret_frances@cable.comcast.com>
Co-Authored-By: James Reeves <james.reeves5546@gmail.com>
Co-Authored-By: John Schwarz <jschwarz@redhat.com>
Needed-By: I25ad60c1b9a66e568276a772b8c496987d9f8299
Needed-By: I881b8f5bc9024c20275bc56062de72a1c70c8321
Needed-By: I48ead4b459183db795337ab729830a1b3c0022da
Needed-By: Ib92b172dce48276b90ec75ee5880ddd69040d7c8
Needed-By: I4eb21495e84feea46880caf3360759263e1e8f95
Needed-By: I0ab6a1a0d1430c5791fea1d5b54106c6cc93b937
Partial-Bug: #1468353

Change-Id: Ic3baefe176df05f049a2e06529c58fd65fe6b419
2016-03-18 10:07:24 +01:00
Gary Kotton 217a2adee0 QOS: get rid of warnings for unit tests
The QOS tests would have tons of warnings that real UUID's need to
be used. This patch fixes that.

We will not see any more:

    .../oslo_versionedobjects/fields.py:325: FutureWarning:
    fake_rule_id is an invalid UUID. Using UUIDFields with
    invalid UUIDs is no longer supported, and will be removed
    in a future release. Please update your code to input valid
    UUIDs or accept ValueErrors for invalid UUIDs.
    See http://docs.openstack.org/developer/oslo.versionedobjects/api/fields.html#oslo_versionedobjects.fields.UUIDField
    for further details "for further details" % value, FutureWarning)

TrivialFix

Change-Id: Iee36c7d1cd11b6a38ab67883f91dcb3bdb4d4344
2016-02-16 01:26:54 -08:00
Irena Berezovsky aee20b968a Ignore non rules related qos_policy changes
QoSAgentExtension should invoke QoSAgentDriver
to reflush qos policy rules only if there is any rules related change.
QoS policy changes, such as description change, should not cause
reconfiguration of the qos policy rules.

Closes-Bug: #1509232
Change-Id: I036b0449c7b5521adeb32602a0c0e6cf2d27510a
2015-12-23 16:06:26 +00:00
Brandon Palm 2503dfb239 Fixed a bunch of typos throughout Neutron
Went through all of the docstrings in Neutron and did
some cleanup.  I'm sure there are bunch more that I have missed.

Change-Id: Ib29d2de1c580880c89ed4fd069e1515d0977a3e7
2015-10-30 08:54:41 -05:00
Miguel Angel Ajo fe236bdaad No network devices on network attached qos policies
Network devices, like internal router legs, or dhcp ports
should not be affected by bandwidth limiting rules.

This patch disables application of network attached policies
to network/neutron owned ports.

Closes-bug: #1486039
DocImpact

Change-Id: I75d80227f1e6c4b3f5fa7762b8dc3b0c0f1abd46
2015-09-16 15:11:04 +02:00
Moshe Levi cc698b2ba5 QoS agent extension and driver refactoring
Moved some code common to all drivers into base
qos driver abstract class, so related bugfixes go all in one
place and we simplify the logic for every qos drivers.

Port/Policy mapping moved out to a separate class.

Support delete per rule_type or delete all rules.

Related-bug: #1486039

Co-Authored-By: Miguel Angel Ajo <mangelajo@redhat.com>
Partially-Implements: blueprint ml2-qos
Change-Id: Ia9d8638b9268b5aa8512cbb9d001413751f82649
2015-09-15 16:29:25 +02:00
Jenkins 6c92821b98 Merge "Removed configuration option for qos agent driver selection" into feature/qos 2015-08-11 01:04:55 +00:00
Ihar Hrachyshka ca0d7bce21 Removed configuration option for qos agent driver selection
There is no (general) use case to allow users to configure qos driver to
load by qos l2 agent extension. So instead of getting the driver name
from the configuration file, hardcode it and potentially reuse for other
extensions that may also be interested in splitting extension into
agent agnostic and agent specific pieces.

Added driver_type parameter to AgentCoreResourceExtension.initialize().
Also updated the method signature to reflect that we expect l2
extensions to receive connection.

Finally, removed #noqa import for openvswitch.common.config from qos
extension unit test since it seems unneeded.

Change-Id: Iae4dcc20c967d1da216772a3a3660e0421263527
Partially-Implements: quantum-qos-api
2015-08-10 18:08:16 +02:00
Moshe Levi 991bcd6711 Add delete_port api to agent extension manager
This commit add delete_port api to the agent
extension manager, the agent extension and the qos
etension, and it update the ovs agent to call it upon
delete port.

Change-Id: Ia4e96c7c734cf4abe9a35c813bd8330b15b68f4c
Partially-Implements: bluerint ml2-qos
2015-08-10 18:20:29 +03:00
Jakub Libosvar 088289acd2 Propagate notifications to agent consumers callbacks
The update policy works. We still need to track down the deletes which
don't work currently.

Change-Id: I48e04b42c07c34cf1daa17e7a29a6950453946ff
Partially-Implements: blueprint quantum-qos-api
2015-08-08 10:41:32 +02:00
Miguel Angel Ajo 11e22a435a neutron.api.rpc.callbacks interface rework
Split rpc.callbacks interface into consumer and producer parts.

Better terms are chosen for two RPC APIs we have:
- pull when a component actively requests a new object state;
- push when a component updates anyone interested about an object
  change.

Also, for callback registration, the following terms are used:
- subscribe when a component is registered in consumer registry;
- provide when a component is registered in provider registry.

Covered the registries with some unit tests.

Lots of existing tests utilize the registries now, and need to be
isolated from other tests that mess with the managers (that are
singletons), so introduced a common qos base test class to mock the
manager with per-test instance of it).

Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Partially-Implements: blueprint quantum-qos-api
Change-Id: I130cfbc8b78da6df4405b90ea1ab47899491ba41
2015-08-08 10:24:20 +02:00
Ihar Hrachyshka 4dd9841186 Moved extensions/qos_agent.py into extensions/qos.py
This file does not contain any separate QoS agent but just an extension
for existing l2 agents to reuse.

Change-Id: I0587d89b0e841e5fd19b91157602efb5aa97513e
Partially-Implements: blueprint quantum-qos-api
2015-08-07 19:38:13 +00:00