Fix DB integrity issues when using postgres
The IntegrityError faced on network deletion that
spooks Tempest tests is most likely caused by the
fact that the ml2 plugin does a dirty read. By
adding a 'select for update' we should be able to
address the issue once and for all.
Also, there's a chance that the dhcp port gets
reallocated while we are deleting the network. To
this aim, catch the integrity error and attempt
to recover from it.
This patch also removes the handling of errors
on concurrent reads that can no longer occur when
deleting the network.
(Hopefully) Closes-bug: #
1239637
PS: This fix may be relevant for bugs #
1243726 and #
1246737
Change-Id: Iefae7fc8a903cc35d8bf80fc4cee533b7f64032c