Problems with neutron.common.constants import break HA and DVRHA functionality

Bug #1568197 reported by Adolfo Duarte
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Adolfo Duarte

Bug Description

Many files in the neutron project use this import:

from neutron.common import constants as l3_const

or some variation of it.

For some reason this import is not working correctly.
Particularly the following lines from ithe file neturon.common.constants seem to not take effect (or value of constant) gets reverted:

L24 - L 31:
# TODO(anilvenkata) Below constants should be added to neutron-lib

The ROUTER_INTERFACE_OWNER and ROUTER_INTERFACE_OWNER_SNAT constants do not seem to take the new values assigned to them: original-tuple + DEVICE_OWNER_HA_REPLICATED_INT

In files which use the import mentioned above: "from neutron.common import constant" or a variation of it, the values
of ROUTER_INTERFACE_OWNERS and ROUTER_INTERFACE_OWNERS_SNAT do not contain the value "ha_router_replicated_interface"

This is causing problems with HA router and DVRHA routers because the files neutron/db/ and neutron/db/ make use of the constants neutron.common.constants.ROUTER_INTERFACE_OWNERS and neutron.common.constants.ROUTER_INTERFACE_OWNERS_SNAT to figure out what ports belong to a router.

Since the "ha_router_replicated_interface" is not listed in either one of those variables, the neutron server (q-svc) does not include any ports which are owned by ha_router_replicated_interface as part of router updates.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master

Revision history for this message
Adolfo Duarte (adolfo-duarte) wrote :

started a patch with tests which verify the correct values of the constants.
It does not solve the problem but it does provide a unittest to verify a fix.

This seems to be an import problem somewhere.

If you put an "import pdb, pdb.set_trace()" inside of common.neutron.constants, the correct values are assigned to the constants,
however the import is NOT happening a the line "from neutron.common import constant as l3_const" in neutron/db/ L28. It is happening much earlier, but once L28 is reached in, the value of the constant is not correct any more.

As mentioned above, the problem can be seen by simply pulling the patch above (303662)

adding the following on before L28:
import pdb

And then running the tests with:
.../tests/unit/db$ py.test ./

and stepping through the code. You should see something like:
(Pdb) n
> /opt/neutron/neutron/db/<module>()
-> from neutron.common import exceptions as n_exc
(Pdb) l3_const
<neutron.common._deprecate._DeprecateSubset object at 0x7fb28cffe790>
('network:router_interface', 'network:router_interface_distributed')

NO ha_router_replicated_interface

Revision history for this message
Reedip (reedip-banerjee) wrote :

Can you specify the version( Master/Stable releases etc) which you are using ?
Ideally it would be great if you can mention the bug using the following template to allow us to investigate better

Changed in neutron:
status: New → Incomplete
Revision history for this message
Adolfo Duarte (adolfo-duarte) wrote :

using master/mitaka branch.

Changed in neutron:
assignee: nobody → Adolfo Duarte (adolfo-duarte)
status: Incomplete → In Progress
tags: added: l3-dvr-backlog
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Adolfo Duarte (<email address hidden>) on branch: master
Reason: neutron-lib 0.1.0 was release and it solves this problem.

Revision history for this message
Adolfo Duarte (adolfo-duarte) wrote :

the release of neutron-lib 0.1.0 fixed this defect. it can be closed now.

Revision history for this message
Adolfo Duarte (adolfo-duarte) wrote :

Although there should be an effort to clean up neutron.common.constants from constants which are now included in neutron-lib

Revision history for this message
Swaminathan Vasudevan (swaminathan-vasudevan) wrote :

This issue has been fixed in upstream. So we can close this bug.

Revision history for this message
Swaminathan Vasudevan (swaminathan-vasudevan) wrote :

We need to close this bug, since it is fixed in upstream.

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

Other bug subscribers