Don't use nested transaction in provisioning blocks
Don't use nested transaction in provisioning blocks

Relying on duplicate entries for existing provisioning
block detection led to lots of log noise whenever we
would encounter a deadlock because the savepoint would
go missing. Additionally, since this would happen inside
of another transaction, we couldn't be guaranteed until
the final commit that this was unique anyway so the whole
transaction could throw a duplicate exception.

Since the outer transaction has to handle duplicate exceptions
anyway, this patch just adjusts the logic to check for the
existing of a record first with a regular query. If there
is a race the outer transaction will still fail with a duplicate
as before, but we at least won't have a bunch of missing savepoint
exception noise.

Closes-Bug: #1613759
Change-Id: I02d30427505591e24d7bdc1ba654d3757ab9a33d

noironetworks/neutron,huntxu/neutron,openstack/neutron,eayunstack/neutron,sebrandon1/neutron,openstack/neutron,mahak/neutron,eayunstack/neutron,mahak/neutron,cloudbase/neutron,igor-toga/local-snat,mahak/neutron,openstack/neutron,cloudbase/neutron,noironetworks/neutron,huntxu/neutron,sebrandon1/neutron,igor-toga/local-snat