Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1815590

Summary: When trying to create a stack causes DBDeadlockError and IP address collision during port creating
Product: Red Hat OpenStack Reporter: Ganesh Kadam <gkadam>
Component: openstack-neutronAssignee: Nate Johnston <nate.johnston>
Status: CLOSED ERRATA QA Contact: Alex Katz <akatz>
Severity: high Docs Contact:
Priority: high    
Version: 13.0 (Queens)CC: akaris, amuller, ccamposr, chrisw, jthomas, lpic.lt, nate.johnston, scohen, smykhail, twilson, whayutin
Target Milestone: z12Keywords: Triaged, ZStream
Target Release: 13.0 (Queens)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-neutron-12.1.1-14.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-24 11:53:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Heat template we execute none

Comment 4 Ruslanas Gžibovskis 2020-03-23 08:49:58 UTC
We see that something has been changed from Mitaka/Newton release in Queens, how ports are assigned.
We have a HEAT template that is compatible with Mitaka and later. That is why it does not have the loop on fixed IP assigning to instances.

I will attach this template here also, so everyone could test on other releases, does it work there.
Versions I currently know it is working:
Mitaka (9.0) - with max_fixed_ips = 200 changed in /etc/neuton/neuton.conf
Mitaka (Mirantis Legacy 9.2) - with max_fixed_ips = 200 changed in /etc/neuton/neuton.conf
Newton (RHOSP10) - with max_fixed_ips = 200 changed in /etc/neuton/neuton.conf

Stopped working on:
Queens (RHOSP13) - with error in this bug.

Have not checked on other versions, do not have such.

Comment 5 Ruslanas Gžibovskis 2020-03-23 08:54:43 UTC
Created attachment 1672587 [details]
Heat template we execute

Creates pports with several IP's, some ports are 75, 110, 180 fixed IP addresses. Then creates around 22 instances, with those ports attached.

Comment 6 Nate Johnston 2020-03-26 12:52:17 UTC
I have been looking into this.  Heat does not seem to have the concept of a "bulk port" request, where it sends a single request to neutron that has multiple requests in it, which can then be handled by Neutron in a more efficient manner.  Instead, it is firing off one request per port, and then neutron server is racing for the IP address allocation.  If you do that enough times, and rapidly enough, then this is exactly the kind of error you can get.  

We did improve the port allocation code in the Stein cycle so that it uses random sampling of the available IP addresses so that IPs will be requested from random points in the range of available IP addresses.  I just backported that back to Queens; see upstream change 715188.  That change has the best chance for us to optimize Neutron's allocation method to be resilient against this kind of scenario.  If you are requesting a number of IP addresses that approximates the size of the pool of available IPs on the subnet, however, there is still a chance you could hit this issue.  The only other optimization I can think of at this time we could do would be to get Heat to support bulk port requests, but I believe that would be an RFE on the Heat side that would take some time to accomplish.  So I believe the change linked above is the best chance to address this issue.

Comment 8 Ruslanas Gžibovskis 2020-04-01 12:40:04 UTC
is it already in the repo?

Comment 9 Nate Johnston 2020-04-01 16:59:32 UTC
Ruslanas it is in the upstream repo - see https://review.opendev.org/715188 - and just merged downstream.  But it is not in a released version of either, but it's definitely in the git repo now.

Comment 44 errata-xmlrpc 2020-06-24 11:53:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2724