add joined query to the interface network associations
There is currently no explicit eager join between the interface resource
and the interface-network resource in the data model. The API uses the
DB data outside of the scope of the active DB session therefore if it
attempts to reach across a foreign key relationship, and if the DB
session has expired (or has been re-used), then the access results in an
exception which results in an empty network list for an interface.
Having incorrect data in the network list can lead subsequent API code
to take an unexpected path and cause the original user request to fail.
Since we know that whenever an interface is queried that we will be
querying the related interface-network resources then it is better to
add an explicit load operation on the model backref so that the DB
session does not need to be accessed a second time outside of its valid
scope.
Reviewed: https:/ /review. opendev. org/657645 /git.openstack. org/cgit/ starlingx/ config/ commit/ ?id=8e0278f5253 2aa019ac76ebc45 03d4359e11c7a4
Committed: https:/
Submitter: Zuul
Branch: master
commit 8e0278f52532aa0 19ac76ebc4503d4 359e11c7a4
Author: Allain Legacy <email address hidden>
Date: Tue May 7 07:39:30 2019 -0500
add joined query to the interface network associations
There is currently no explicit eager join between the interface resource
and the interface-network resource in the data model. The API uses the
DB data outside of the scope of the active DB session therefore if it
attempts to reach across a foreign key relationship, and if the DB
session has expired (or has been re-used), then the access results in an
exception which results in an empty network list for an interface.
Having incorrect data in the network list can lead subsequent API code
to take an unexpected path and cause the original user request to fail.
Since we know that whenever an interface is queried that we will be
querying the related interface-network resources then it is better to
add an explicit load operation on the model backref so that the DB
session does not need to be accessed a second time outside of its valid
scope.
Change-Id: I56d880659ec241 2b391d5bb8700a7 4fa7f288cbb
Closes-Bug: 1827882
Signed-off-by: Allain Legacy <email address hidden>