From: Stephen Gran Date: Wed, 6 Feb 2013 14:57:57 +0000 (+0000) Subject: Persist updated expiration time X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=bfa9d88f432f20cf4a4d85a4050e4f94dc874457;p=openstack-build%2Fneutron-build.git Persist updated expiration time Without creating a subtransaction, the database query wasn't actually being run and the data was being lost. This resulted in the case that on termination of long running VMs, the VM IP address was immediately available for reuse instead of being held as it should have been. Fixes: bug #1116500 Change-Id: I7774273b8e799d945c27329e9da2dba34e39fdb8 Signed-off-by: Stephen Gran --- diff --git a/quantum/db/db_base_plugin_v2.py b/quantum/db/db_base_plugin_v2.py index 80db8cff2..8960629ee 100644 --- a/quantum/db/db_base_plugin_v2.py +++ b/quantum/db/db_base_plugin_v2.py @@ -394,8 +394,9 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2): query = query.filter_by(network_id=network_id, ip_address=ip_address) try: - fixed_ip = query.one() - fixed_ip.expiration = expiration + with context.session.begin(subtransactions=True): + fixed_ip = query.one() + fixed_ip.expiration = expiration except exc.NoResultFound: LOG.debug(_("No fixed IP found that matches the network " "%(network_id)s and ip address %(ip_address)s."),