← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1535551] [NEW] One port can be added as multiple routers' interfaces if commands are executed at the same time

 

Public bug reported:

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.

If one port is added as multiple routers' interfaces, the expected result is that only API request is executed successfully and the port is associated to one router. Other API requests would recieve error message like
PortInUseClient: Unable to complete operation on port d2c97788-61d7-489a-8b20-7a6e8e39a217 for network 496de8cf-4284-41d7-ad6b-7dd5f232dc21. Port already has an attached device 1b316d80-f5d8-4477-88df-54b376c4c8cd.

Besides, in routerports database, only one record of port is allowed to
exist. However, if we run two commands to add one port as two different
routers' interfaces at the same time. Both of the commands would show
execution succeed. The truth is two records that the port is associated
to both routers are listed in routerports database.

How to reproduce

Step 1: Create two routers
$ neutron router-create router-1
$ neutron router-create router-2

Step 2: Create an internal network
$ neutron net-create net1

Step 3: Add a subnet to the network
$ neutron subnet-create --name subnet1 net1 192.166.100.0/24

Step 4: Create a port in the network
$ neutron port-create --name port1 net1

Step 5: Add this port as two routers' interfaces at the same time
On controller1:
$ neutron router-interface-add router-1 port=port1
on controller2:
$ neutron router-interface-add router-2 port=port1

Both commands would return success, as shown
http://paste.openstack.org/show/483840/

Step 6: Check port list on both routers
The result is shown http://paste.openstack.org/show/483843/

As we can see, only one router is successfully associated to the port

Step 7: Check routerports database
http://paste.openstack.org/show/483842/

where '99276755-236a-44b7-bf97-b2234d97028b' is the port_id of the port
we created in Step 4.

To sum up, we have two issues here
a) Only one API request is executed successfully, but both commands return success
b) Routerports database is updated twice and we need to delete the older record. 

Related source codes is [1]

[1]
https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L535

** Affects: neutron
     Importance: Undecided
     Assignee: Lujin Luo (luo-lujin)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Lujin Luo (luo-lujin)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1535551

Title:
  One port can be added as multiple routers' interfaces if commands are
  executed at the same time

Status in neutron:
  New

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.

  If one port is added as multiple routers' interfaces, the expected result is that only API request is executed successfully and the port is associated to one router. Other API requests would recieve error message like
  PortInUseClient: Unable to complete operation on port d2c97788-61d7-489a-8b20-7a6e8e39a217 for network 496de8cf-4284-41d7-ad6b-7dd5f232dc21. Port already has an attached device 1b316d80-f5d8-4477-88df-54b376c4c8cd.

  Besides, in routerports database, only one record of port is allowed
  to exist. However, if we run two commands to add one port as two
  different routers' interfaces at the same time. Both of the commands
  would show execution succeed. The truth is two records that the port
  is associated to both routers are listed in routerports database.

  How to reproduce

  Step 1: Create two routers
  $ neutron router-create router-1
  $ neutron router-create router-2

  Step 2: Create an internal network
  $ neutron net-create net1

  Step 3: Add a subnet to the network
  $ neutron subnet-create --name subnet1 net1 192.166.100.0/24

  Step 4: Create a port in the network
  $ neutron port-create --name port1 net1

  Step 5: Add this port as two routers' interfaces at the same time
  On controller1:
  $ neutron router-interface-add router-1 port=port1
  on controller2:
  $ neutron router-interface-add router-2 port=port1

  Both commands would return success, as shown
  http://paste.openstack.org/show/483840/

  Step 6: Check port list on both routers
  The result is shown http://paste.openstack.org/show/483843/

  As we can see, only one router is successfully associated to the port

  Step 7: Check routerports database
  http://paste.openstack.org/show/483842/

  where '99276755-236a-44b7-bf97-b2234d97028b' is the port_id of the
  port we created in Step 4.

  To sum up, we have two issues here
  a) Only one API request is executed successfully, but both commands return success
  b) Routerports database is updated twice and we need to delete the older record. 

  Related source codes is [1]

  [1]
  https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L535

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1535551/+subscriptions


Follow ups