ML2: remove method get_locked_port_and_binding

The method was marked deprecated in commit
ffa7695038. This is not used
anywhere in the neutron code base.

The only place that this method was used is in the GBP code
base and they have patched the method.

TrivialFix

Change-Id: I709c701a0904c0e42266345d339f286a8a89b24d
This commit is contained in:
Gary Kotton 2017-09-25 02:10:12 -07:00 committed by garyk
parent 9b8a1339de
commit a380f60b52
2 changed files with 0 additions and 51 deletions

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from debtcollector import removals
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
@ -50,34 +49,6 @@ def add_port_binding(context, port_id):
return record
@removals.remove(
message="Use get_port from inside of a transaction. The revision plugin "
"provides protection against concurrent updates to the same "
"resource with compare and swap updates of the revision_number.",
removal_version='Queens')
def get_locked_port_and_binding(context, port_id):
"""Get port and port binding records for update within transaction."""
try:
# REVISIT(rkukura): We need the Port and PortBinding records
# to both be added to the session and locked for update. A
# single joined query should work, but the combination of left
# outer joins and postgresql doesn't seem to work.
port = (context.session.query(models_v2.Port).
enable_eagerloads(False).
filter_by(id=port_id).
with_lockmode('update').
one())
binding = (context.session.query(models.PortBinding).
enable_eagerloads(False).
filter_by(port_id=port_id).
with_lockmode('update').
one())
return port, binding
except exc.NoResultFound:
return None, None
@db_api.context_manager.writer
def set_binding_levels(context, levels):
if levels:

View File

@ -283,28 +283,6 @@ class Ml2DBTestCase(testlib_api.SqlTestCase):
port['mac_address'])
self.assertEqual(port_id, observed_port.id)
def test_get_locked_port_and_binding(self):
network_id = uuidutils.generate_uuid()
port_id = uuidutils.generate_uuid()
host = 'fake_host'
vif_type = portbindings.VIF_TYPE_UNBOUND
self._setup_neutron_network(network_id)
self._setup_neutron_port(network_id, port_id)
self._setup_neutron_portbinding(port_id, vif_type, host)
port, binding = ml2_db.get_locked_port_and_binding(self.ctx,
port_id)
self.assertEqual(port_id, port.id)
self.assertEqual(port_id, binding.port_id)
def test_get_locked_port_and_binding_result_not_found(self):
port_id = uuidutils.generate_uuid()
port, binding = ml2_db.get_locked_port_and_binding(self.ctx,
port_id)
self.assertIsNone(port)
self.assertIsNone(binding)
class Ml2DvrDBTestCase(testlib_api.SqlTestCase):