Avoid dhcp agent race condition on subnet and network delete
Ensure that ports that are about to be deleted are 'selected
for update'. By doing so, we avoid a race condition between
subnet and network delete operations carried out by two
separate server instances.
A race caused by the dhcp agent deleting the DHCP port
(caused by a subnet-delete event notification) can
still occur and will be addressed in a subsequent patch.
delete_subnet's way to delete ports has been tweaked to
ensure that postgres db can handle the SELECT FOR UPDATE
correctly.
Partial-Bug:
1197627
Change-Id: I5bd75a758395a2faeff9db35a03c42dfa8ae0eab