It is possible to create new session for each select outside to the current session/transaction.
(IMHO the VNI allocation should not be given up unless the select does not founds any VNI, I would suggest to do more than 10 try, otherwise allocation issues could be triggered with higher load and worker number.)
https:/ /github. com/openstack/ neutron/ blob/3f44c9e278 74511f05e2338c1 0e836361776ed88 /neutron/ plugins/ ml2/drivers/ helpers. py#L113 issued on the same database snapshot therefore it will select the same value (Repeatable Read) .
It is possible to create new session for each select outside to the current session/ transaction.
(IMHO the VNI allocation should not be given up unless the select does not founds any VNI, I would suggest to do more than 10 try, otherwise allocation issues could be triggered with higher load and worker number.)