Multiple gateway ports are created if multiple API requests update same router's gateway at the same time

Bug #1535225 reported by Lujin Luo
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Kevin Benton

Bug Description

I have three controller nodes and the Neutron servers on these controllers are set behind Pacemaker and HAProxy to realize active/active HA using DevStack. MariaDB Galera cluster is used as my database backend.I am using the latest codes.

I have one external network and one router. If I run $neutron router-gateway-set at three controllers at the same time, I will end up with three ports created on the external network. Although, only the latest created port would be updated as the router's default gateway IP, the former two ports would remain in both routerports and ports database.

Besides, the former two ports could not be deleted from $ neutron router-gateway-clear command. They can only be deleted from database by hand.

How to reproduce:

Step 1: Create an external network
$ neutron net-create ext-net --router:external True

Step 2: Create a subnet on the external network
$ neutron subnet-create --name ext-subnet ext-net 192.168.122.0/24

Step 3: Create a router
$ neutron router-create router-gateway-test

Step 4: Set gateway to the router on three controllers at the same time
On controller1:
$ neutron router-gateway-set router-gateway-test ext-net

On controller2:
$ neutron router-gateway-set router-gateway-test ext-net

On controller3:
$ neutron router-gateway-set router-gateway-test ext-net

The port list on the router after the above commands could be seen here http://paste.openstack.org/show/484091/

Step 5: Clear the gateway on the router
$ neutron router-gateway-clear router-gateway-test ext-net

The port list on the router after Step 5 could be seen here http://paste.openstack.org/show/484092/

As we can see, the two ports created earlier were not able to be cleared through CLI.

Step 6: Try to deletes the rest two router ports
$ neutron port-delete 3095887a-cb2d-46eb-bf56-be6305596868
$ neutron port-delete 76a42eda-33ce-4048-882a-6f8cb4d7137c
where '3095887a-cb2d-46eb-bf56-be6305596868' and '76a42eda-33ce-4048-882a-6f8cb4d7137c' are the two remaining gateway ports on the router
The result is shown here http://paste.openstack.org/show/484094/

The routerports and ports database info could be seen here http://paste.openstack.org/show/484095/ , where '9a261e95-1f3b-4c8f-91a6-098b9fab7c25' is the id of the router we created in Step 3.

=========================================================================
Update on 1/27
I have tested this bug again on all-in-one DevStack setup with one neutron-server and api_workers > 0, which is the default DevStack setup.
Replace Step 4 as
$ neutron router-gateway-set router-gateway-test ext-net & neutron router-gateway-set router-gateway-test ext-net
and you will receive the same result as what I received in multi-controller setup.

Tags: l3-ipam-dhcp
Lujin Luo (luo-lujin)
Changed in neutron:
assignee: nobody → Lujin Luo (luo-lujin)
description: updated
tags: added: l3-ipam-dhcp
Changed in neutron:
importance: Undecided → Medium
Lujin Luo (luo-lujin)
description: updated
Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

Marked as low because I just don't see this being much of a a problem in practice. I can't think of why 3 different people/processes will be interested in updating a router's gateway all at the same time.

Changed in neutron:
importance: Medium → Low
Nam (namnh)
Changed in neutron:
assignee: Lujin Luo (luo-lujin) → Nam (namnh)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/287564

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/323807

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/287564
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Needs a new owner

Changed in neutron:
status: In Progress → Incomplete
assignee: Nam (namnh) → nobody
Changed in neutron:
assignee: nobody → Kevin Benton (kevinbenton)
status: Incomplete → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/333809
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=fbd3578d6494fa3f08d75686783f31454b1b42e5
Submitter: Jenkins
Branch: master

commit fbd3578d6494fa3f08d75686783f31454b1b42e5
Author: Kevin Benton <email address hidden>
Date: Wed Jun 22 18:23:19 2016 -0700

    Delete gw port on exceptions

    Clean up related core plugin ports on routers when there is a failure
    creating the record for the router port.

    The two partial bugs will be fixed after
    I476d3e03c8ee763cc4be6d679fe9f501eb3a19b5 has merged.

    Closes-Bug: #1600344
    Partial-Bug: #1535225
    Partial-Bug: #1535226
    Change-Id: I8dd832f35e20d1ee090ebab921f0deea533b6fc8

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Nam Nguyen Hoai (<email address hidden>) on branch: master
Review: https://review.openstack.org/323807

tags: added: neutron-proactive-backport-potential
tags: removed: neutron-proactive-backport-potential
Revision history for this message
Nam (namnh) wrote :

This bug was already fixed by patch set: https://review.openstack.org/#/c/333809/

Changed in neutron:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.