neutron/neutron/objects
Matthew Booth c3ffac8200 Fix invalid JSON generated by quota details
The value fetched by Quotasv2_detail.get_resources() is ultimately
returned by Reservation.get_total_reservations_map. The total_reserved
value is returned by a sqlalchemy sum(), and is of a type defined by
the database driver in use. PyMySQL returns a Decimal here, which
the api layer serialises to JSON as a string.

Note that if a resource has no reservations then its value will be
defaulted in DbQuotaDriver.get_detailed_tenant_quotas to the integer
value 0. This means that the value is an integer if zero, or a string
otherwise. This causes parsing difficulties for client libraries which
do strict type checking.

Testing note:
This method is already covered by the unit test
TestQuotaDbApi.test_get_reservations_for_resource, which also already
tests the return value and, implicitly, its type. However, it does not
currently fail because the unit tests run with SQLite rather than MySQL.
SQLite returns an int where MySQL returns a Decimal, which does not
trigger the bug.

TestQuotaDbApi.test_get_reservations_for_resource is sufficient to
demonstrate that the patch doesn't regress SQLite. We were not able to
think of a deterministic way to write a Tempest test for this, which
would cover MySQL. Ideally we would have the ability to run the DB test
suites under MySQL and PostreSQL in addition to SQLite using oslo.db's
OpportunisticDbFixture, but the scope of that is larger than this
change.

Closes-Bug: #1918565
Change-Id: Icda0d63f2f5ea72bde423296c76aa46646fa98a8
(cherry picked from commit 9ed17cec2d)
2021-03-19 15:03:07 +00:00
..
db remove the neutron.db._model_query module 2019-01-25 08:55:25 -07:00
extensions use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
logapi use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
plugins Fix queries to retrieve allocations with network_segment_range 2020-02-28 12:34:13 +00:00
port Change "propagate_uplink_status" default value to True 2020-09-07 15:52:52 +00:00
qos Bump pylint version to support python 3.8 2020-08-06 16:00:30 +02:00
README.rst Objects: Add README for neutron/objects directory tree 2016-10-07 15:12:20 +00:00
__init__.py Bump pylint version to support python 3.8 2020-08-06 16:00:30 +02:00
address_group.py Support Address Group CRUD as extensions 2020-08-12 13:59:31 -05:00
address_scope.py Allow sharing of subnet pools via RBAC mechanism 2020-04-09 19:02:47 +03:00
agent.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
auto_allocate.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
base.py Remove "six" library 2020-07-28 16:55:52 +00:00
conntrack_helper.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
flavor.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
floatingip.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
ipam.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
l3_hamode.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
l3agent.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
metering.py Add source_ip_prefix and destination_ip_prefix to metering label rules 2020-09-30 12:26:01 +00:00
network.py Remove redundant implementation of "get_projects" in NetworkRBAC 2020-04-17 08:48:15 +00:00
network_segment_range.py Bump pylint version to support python 3.8 2020-08-06 16:00:30 +02:00
port_forwarding.py Add description field to portforwarding NAT rules 2020-01-22 11:19:55 -03:00
ports.py Remove timecost profiling for port get_objects 2020-07-17 11:54:40 -04:00
provisioning_blocks.py [OVO] Switch to use own registry 2017-11-22 17:44:22 +01:00
quota.py Fix invalid JSON generated by quota details 2021-03-19 15:03:07 +00:00
rbac.py Remove usage of six.add_metaclass 2020-05-21 14:41:18 -04:00
rbac_db.py Remove "six" library 2020-07-28 16:55:52 +00:00
router.py Bump pylint version to support python 3.8 2020-08-06 16:00:30 +02:00
securitygroup.py Merge "Support for stateless security groups" 2020-03-04 14:16:34 +00:00
servicetype.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
stdattrs.py use object standardattributes from neutron-lib 2019-06-12 13:57:00 -06:00
subnet.py [OVN] Allow IP allocation with different segments for OVN service ports 2020-07-22 07:38:49 +00:00
subnetpool.py Allow sharing of subnet pools via RBAC mechanism 2020-04-09 19:02:47 +03:00
tag.py Fix pep8 E128 warnings in non-test code 2019-03-12 21:22:33 +00:00
trunk.py Remove OVO unneeded compatibility conversions 2020-06-03 17:15:31 +00:00

README.rst

Neutron Objects

Directory

This directory is designed to contain all modules which have objects definitions shipped with core Neutron. The files and directories located inside of this directory should follow the guidelines below.

Structure

The Neutron objects tree should have the following structure:

  • The expected directory structure is flat, except for the ML2 plugins. All ML2 plugin objects should fall under the plugins subdirectory (i.e. plugins/ml2/gre_allocation).
  • Module names should use singular forms for nouns (network.py, not networks.py).