Commit Graph

4 Commits

Author SHA1 Message Date
Ihar Hrachyshka 88e99f6f28 Clean up deprecated sqla model import paths
Those were moved under neutron.db.models start of Ocata. We should be
able to clean them up now.

NeutronLibImpact

Change-Id: Iadbf44d52ee8e30712807384152a29ce1a8b8f72
2017-02-25 03:42:34 +00:00
Henry Gessau 99cfd671be debtcollector for globals
The deprecation shim created by Doug turns out to be rather useful.
It emits a warning when an global (attribute of a module) is
referenced but that global has been moved to another module.

This update makes the following changes to the shim:

 - Rename it to _MovedGlobals to better describe what it is a
   debtcollector for.

 - Use inspect to get the original reference and to check that
   _MovedGlobals is called from the last line of a module.

 - Save the old reference automatically in the instance to prevent it
   from getting garbage collected.

 - Beef up the _moved_global() method for moving/renaming individual
   globals, allowing it to move and rename or rename in place.

Change-Id: I868aa4a3129dd05467a103364088efbb86bc5d0f
2016-08-30 10:18:19 -04:00
Ihar Hrachyshka 7c0f189309 models: move AllowedAddressPair model under neutron/db/models
This patch moves the module into the canonical place. It does it in
backwards compatible way, by leaving the model available under the old
location, only emitting a deprecation warning on access from there. In
the future, the old module will be completely cleaned up.

This patch also makes head.py file that is used to import and register
all models in the tree to import everything from under neutron.db.models
without explicitly naming each module. In that way, we can avoid the
need to import each new module with models as long as it's located in
the designated place. The file is a well known abuser in terms of git
conflicts, and it's better to avoid manual work.

Change-Id: I084031e6b3c8d9113cc6ee6e3967f0e1edaee0b5
Partial-Bug: #1597913
2016-08-12 12:27:06 +00:00
Martin Hickey 8ecb28dd09 Integrate the port allowed address pairs VersionedObject in Neutron
This patch is dependent on commit I8d03528f8f45f5f50fa467b39245a513a37c5d89.
It integrates the VersionedObject with the existing code.

Integration revealed that using IPAddress is not correct for allowed
address pairs, because the address can also represent a subnet.

Another issue revealed by the integration is that we must retain the
original string format passed by users through API for MAC addresses.

Neither we can use IPNetworkField from oslo.versionedobjects for
ip_address field because it will then always append prefix length to
base network address, even if prefix length is maximum for the type of
IP network (meaning, the address actually represents a single host),
which is contradictory to how API currently behaves (returning mask-less
addresses for /32 - for ipv4 - and /128 - for ipv6 - prefix lengths).

To solve those issues, 'authentic' flavors for netaddr.EUI and
netaddr.IPNetwork types are introduced. Those 'authentic' flavors
attempt to retain the original string representation, as passed by the
caller.

Since base IPNetworkField recreates network object on coerce(), and
hence looses information about the original string representation, we
introduce our custom flavor of the field type that reuses the network
object passed by the caller.

The change for the type of ip_address field triggers hash change.
Anyway, we are safe to change it without considering backwards
compatibility, because the object is not used anywhere yet.

Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Change-Id: I3c937267ce789ed510373616713b3fa9517c18ac
Partial-Bug: #1541928
2016-05-20 15:18:22 +02:00