delete_subnet made calls to both get_subnet and _get_subnet,
get_subnet uses _get_subnet so multiple database requests were being
made, this patch removes the call to get_subnet and directly calls
_make_subnet_dict using the result of _get_subnet
Change-Id: I9982821dbb9447e35a4b6e50bc5ad31cec417ca5
Closes-Bug:
1366056
# wait timeout' errors.
with contextlib.nested(lockutils.lock('db-access'),
session.begin(subtransactions=True)):
- subnet = self.get_subnet(context, id)
+ record = self._get_subnet(context, id)
+ subnet = self._make_subnet_dict(record, None)
# Get ports to auto-deallocate
allocated = (session.query(models_v2.IPAllocation).
filter_by(subnet_id=id).
mech_context)
LOG.debug(_("Deleting subnet record"))
- record = self._get_subnet(context, id)
session.delete(record)
LOG.debug(_("Committing transaction"))