Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/objects.
Trivialfix
Change-Id: I5e885e2b2a09d48197de30d8c6de5d74c10f5987
This patch enables the gateway IP network QoS inheritance in
the OVN backend driver. The OVN QoS extension will use the
router external network (GW network) QoS policy if the gateway
IP port has no QoS policy assigned.
Partial-Bug: #1950454
Change-Id: I5ee51dc124ae464b9e9fd366cf7bf85176376c25
Now when the external gateway of a router is removed, the QoS policy
assigned to this router is removed too. A router can only have a QoS
policy assigned if a gateway port is attached; if the port is removed,
the QoS binding must be removed too.
Closes-Bug: #1968269
Change-Id: Iced254259170972a9699aa35ae8062776e11285d
Floating IP now have information of the QoS policy of the external
network. The OVN QoS extension will use this network QoS policy if
there is no floating IP QoS policy.
Partial-Bug: #1950454
Change-Id: I380a130d97e8bfe54caa5f3a129877507d1ce2a6
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
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
Provide "tag" information to QoS policy, Trunk and Network Segment
Range objects using the tag plugin extension. This is the Neutron
defined way to extend an object dictionary using the standard
attributes.
Change-Id: I7bf4986a4d2628d0fa69e57199d59bd6ca4eafdc
Closes-Bug: #1704137
This patch implements in the OVN backend the existing floating
IP QoS extension.
The OVN client, using the existing QoS extension, will retrieve
the QoS rules attached to each floating IP, the router where the
floating IP lives and the router gateway port. The QoS rules
will be applied on the router gateway port.
The OVN NB QoS rules for floating IP addresses have a "match"
field containing a tuple of parameters:
- The direction of the flow:
'inport == "src"' or
'outport == "dst"'
- The IP address to match:
'ip4.src == 1.2.3.4' or
'ip4.dst == 1.2.3.4'
- The chassis where the port is located:
'is_chassis_resident("chassis")'
Closes-Bug: #1877408
Related-Bug: #1596611
Depends-On: https://review.opendev.org/#/c/727847/
Change-Id: Ib65d8edcb0a415f6d698c952334d3b4bb0d9fff6
Optimize the following methods:
- get_bound_networks
- get_bound_ports
- get_bound_floatingips
- get_bound_routers
Those methods, using the "QosPolicy_XXXX_Binding" OVO interface, were
retrieving all objects with a certain policy ID and then returning
only the ID of the _XXXX_ object. That means to retrieve a full
register list from the DB, then converted them to OVOs and extract
only the _XXXX_ ID.
This patch retrieves only the _XXXX_ object IDs from the DB and
returns the list, without the OVO conversion.
Change-Id: I891eba93b3b4abaec8ada13a032b5440cbb0548d
Closes-Bug: #1877560
This patch consumes the neutron-lib OVO common_types module by
removing it from neutron and switching imports over to use neutron-lib
instead.
NeutronLibImpact
Change-Id: Ic9819a27e3e72038b819ab2fe845c26fc63b26d5
Today the neutron common exceptions already live in neutron-lib and are
shimmed from neutron. This patch removes the neutron.common.exceptions
module and changes neutron's imports over to use their respective
neutron-lib exception module instead.
NeutronLibImpact
Change-Id: I9704f20eb21da85d2cf024d83338b3d94593671e
This patch enables to bind a QoS policy to the router gateway,
then in L3 agent side SNAT traffic for the VMs without floating
IPs can be limited under the policy bandwidth rules. This is
suit for all kinds of L3 routers: DVR, DVR with SNAT HA, L3 HA
and Legacy.
API update router gateway json:
{
router": {
"external_gateway_info": {
...
"qos_policy_id": "policy-uuid"
}
}
}
Depends-On: https://review.openstack.org/#/c/567497/
Partially-Implements blueprint: router-gateway-ip-qos
Closes-Bug: #1757044
Related-Bug: #1596611
Change-Id: I26e22bce7edd1f93b2ac0048b61b14f858938537
This patch moves the implementation of the function
_get_policy_obj to the policy object code scope.
Change-Id: I7057558a5ec32a55a37a6b93dabc997d69abfb98
New facade is enabled by setting new_facade = True for the object of
interest. With new_facade on, all OVO actions will use the new reader /
writer decorator to activate sessions.
There are two new facade decorators added to OVO: db_context_reader and
db_context_write that should be used instead of explicit
autonested_transaction / reader.using / writer.using in OVO context.
All neutron.objects.db.api helpers now receive OVO classes / objects
instead of model classes, since they need to know which type of engine
facade to use for which object. While it means we change signatures for
those helper functions, they are not used anywhere outside neutron tree
except vmware-nsx unit tests, and the latter pass anyway because the
tests completely mock out them disregarding their signatures.
This patch also adds several new OVO objects to be able to continue
using neutron.objects.db.api helpers to persist models that previously
didn't have corresponding OVO classes.
Finally, the patch adds registration for missing options in
neutron/tests/unit/extensions/test_qos_fip.py to be able to debug
failures in those unit tests. Strictly speaking, this change doesn't
belong to the patch, but I include it nevertheless to speed up merge in
time close to release.
There are several non-obvious changes included, specifically:
- in neutron.objects.base, decorator() that refreshes / expunges models
from the active session now opens a subtransaction for the whole span of
call / refresh / expunge, so that we can safely refresh model regardless
of whether caller opened another parent subtransaction (it was not the
case for create_subnetpool in base db plugin code).
- in neutron.db.l3_fip_qos, removed code that updates obj.db_model
relationship directly after corresponding insertions for child policy
binding model. This code is not needed because the only caller to the
_process_extra_fip_qos_update method refetches latest state of floating
ip OVO object anyway, and this code triggers several unit test failures.
- unit tests checking that a single commit happens for get_object and
get_objects are no longer valid for new facade objects that use reader
decorator that doesn't commit but close. This change is as intended, so
unit tests were tweaked to check close for new facade objects.
Change-Id: I15ec238c18a464f977f7d1079605b82965052311
Related-Bug: #1746996
Add qos_policy_id to floating IP, then the user could set/update
the binding QoS policy of a floating IP.
APIImpact: a new parameter qos_policy_id was added to floating IP
related API.
Partial-Bug: #1596611
Partially-Implements blueprint: floating-ip-rate-limit
Change-Id: I4efe9e49d268dffeb3df4de4ea1780152218633b
Neutron will now use own registry for versionedobjects.
It avoids problems with loading wrong OVO objects from
different projects (like os_vif) when names are the same.
Change-Id: I9d4fab591fbe52271c613251321a6d03078976f7
Closes-Bug: #1731948
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
Tag mechanism supports network, subnet, port, subnetpool
router resources only. This patch allow tag mechanism to support
resources with standard attribute.
Two old extenions are kept because of backward compatibility.
They will be removed in Queens release.
APIImpact: Tag is supported by resources with standard attribute
DocImpact: allow users to set tags on resources with standard attribute
Change-Id: Id7bb13b5beb58c313eea94ca03835d3daf5c94bc
Closes-Bug: #1682775
Added QoS policy network binding OVO. Direct access to
'qos_network_policy_bindings' DB table is removed.
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Change-Id: I2a2037dae5a071bd220fa04b0988bc8e7172eb59
Added QoS policy port binding OVO. Direct access to 'qos_port_policy_bindings'
DB table is removed.
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Change-Id: I40268f84bef808dcebd5c123fafc7a50a4d036f4
This patch implements the "default" behaviour for QoS policies.
If this flag is enabled for a QoS policy in a project, all
new networks created will have this QoS policy assigned by default.
If a new QoS policy is created or updated with this flag and another
QoS policy in the same project is set as the default policy, the new
one won't be created or updated. To set another QoS policy as default,
the current one must be unset.
DocImpact: A "default" flag is introduced for QoS policies. If this flag
is enabled in a QoS policy (attached to a project), then all
networks created in this project would have this QoS policy
assigned, unless an explicit policy is specified.
APIImpact
Closes-Bug: #1639220
Change-Id: If5ff2b00fa828f93aa089e275ddbd1ff542b79d4
This patch introduces the new parameter "direction" to
the QoS bandwidth limit rule. It will allow the creation
of bandwidth limit rules for either ingress or egress
traffic. For backwards compatibility the default direction
will be egress.
DocImpact: Ingress bandwidth limit available for QoS
APIImpact: New type of parameter for QoS rule in neutron API
Change-Id: Ia13568879c2b6f80fb190ccafe7e19ca05b0c6a8
Partial-Bug: #1560961
For version 1.2 or higher of QoS policy object it can contain
QoSMinumumBandwidtLimit rules and appending of such rule type
was missing in make_obj_compatible function.
Now such rules are appended to QoS policy.
Change-Id: I40d699db58c34e83272432376d1d59679a680db2
Closes-Bug: #1681440
Objects must use project_id and not tenant_id. The object framework
ensures that tenant_id is added as an extra field for backward
compatibility.
This patch reverts the workaround implemented in change
I4ec9340094bc51cd8aa6e5112bf8114aa26c2982 and implements a proper fix
by explicitly updating the objects.
Co-Authored-By: Artur Korzeniewski <artur.korzeniewski@intel.com>
Co-Authored-By: Darek Smigiel <smigiel.dariusz@gmail.com>
Closes-Bug: #1630748
Change-Id: Iab90bcab41655b2e210aea0e7581eb00b94ce5e5
Instead of using oslo.versionedobjects UUID type, use a custom UUIDField
class located in common_types that will actually validate passed values
for UUID-ness.
Closes-Bug: #1614537
Change-Id: I20b24ee57c521b1c68977c2ff7ae56b56875dd64
In Python3 [1], if we need filter on python3, replace
filter(lambda obj: test(obj), data) with:
[obj for obj in data if test(obj)]. This patch replaces
filter function and introduces a hacking rule to prevent
using filter in future.
[1] https://wiki.openstack.org/wiki/Python3
Change-Id: I83d22108c02f8da007a7233e71a4a7fb833170ec
This fix covers the cases where it's required to be
flexible in the validation of unknown filters.
Change-Id: I1becad77d48556181c5667ad06b2971b8b8517b2
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Closes-Bug: #1622672
Due to the way we applied metaclasses to rbac aware objects, the
__init__ was executed twice: once when the DeclarativeObject metaclass
was applied to NeutronDbObject, and once when rbac metaclass was
applied, when we were calling type() in rbac metaclass' __new__.
To avoid that behaviour, we can introduce a separate base 'class' for
rbac aware objects that would be a result of with_metaclass call using
the rbac metaclass, and NeutronDbOjbect as the actual base. Then we use
the base class in place of NeutronDbObject base class for all objects
that are RBAC aware.
This avoids the duplicate call issue.
Change-Id: Ia12f56f7d40c38e679edc21e13871e27ad1820ee
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
This adds the standard attributes relationship to QoSPolicy.
This has the advantage of providing created_at and updated_at,
however, the primary reason is to ensure it has a revision number
so QoSPolicy objects can be safely used in push notifications.
Partially-Implements: blueprint push-notifications
Change-Id: I8c0c33eef5d53c704b609e5bc503f46f5caad1bb
This patch introduces the front end implementation for QoS
minimum bandwidth rule.
APIImpact: New type of parameter for QoS rule in neutron API
DocImpact
Change-Id: I6b619a96a2bfde164646c71409b671352bc6ce7d
Partial-Bug: #1560963
OVO is going to start enforcing that UUIDFields are UUIDs:
http://docs.openstack.org/developer/oslo.versionedobjects/api/fields.html#oslo_versionedobjects.fields.UUIDField
This is a breaking API change for Neutron since Neutron can be deployed
without Keystone and has historically supported non-UUID tenant IDs. So
we need to use StringField for our tenant_id fields.
The version numbers of the OVO objects are not being bumped because both
UUIDField and StringField are just strings with no validation differences
and they both just serialize to a string. There is no distinguishable
difference between the two until UUIDField starts validating in the future.
Change-Id: I93488701c824a51b5588093b9aba499068ba36e8
These methods were missing in the qos api.
These have been added to provide the ability to read the policy
and network/port binding, and will be accessed through the new
methods in the QosPolicy class.
Closes-bug: #1556812
Change-Id: I34e4851c0fec2cd037206868846644b99dfd7def
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
The implementation was using wrong approach to detect field type, and it
never triggered the actual code. Adopting the base class implementation
for QoS policy object revealed the problem.
Now, we fix the base class to_dict implementation for synthetic fields,
and are able to adopt it for the policy object.
Note that the bug in the base class was never exposed in production
because no objects are currently relying on it.
Change-Id: I3b8727fd3837b51cc1a778dc73d8a1e06f2de5a9
Partial-Bug: #1541928
Moving CRUD DB operation for objects from db/api.py to objects/db/api.py
Renaming object get_by_id(id) to get_object(**kwargs)
Many models in Neutron DB have complex primary keys, concatenated from
a few properties. This patch adds ability to define multiple primary keys
in NeutronDbObject, which are automatically evaluated into DB query
when performing operations.
Partial-Bug: #1541928
Change-Id: I0f63a62418db76415ddd40c30c778ff7541b93dc