logical port for gw on router getting lost when subnet is added
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
networking-ovn |
Fix Released
|
Medium
|
Flavio Fernandes |
Bug Description
When router has a port set as external gateway, a logical port is created on the logical_router
in the nortbound database, as expected.
However, if we attach a subnet to that external network afterwards, the northbound
database loses that logical port, together with the row in the gateway_chassis table.
Steps to reproduce:
PRJ=$(openstack project show demo -f value -c id)
openstack router create --project $PRJ router2 >/dev/null
RTR=$(openstack router show router2 -f value -c id)
openstack network create public --external --default --provider-
EXT_NET_
openstack router set --external-gateway $EXT_NET_ID $RTR ; # this creates the logical port that connect router to gateway_chassis
sudo ovn-nbctl show | grep router2 -A 8 ; # the logical port is present...
# BUG: The simple act of adding a subnet to $EXT_NET_ID will cause router to lose the logical port as part of the update
# This is true if this is the very first or any subsequent subnet attachment to the network
openstack subnet create --ip-version 4 --network $EXT_NET_ID --subnet-range 172.24.4.0/24 --no-dhcp public-subnet >/dev/null
sudo ovn-nbctl show | grep router2 -A 8 ; # sad panda... logical port on the router is GONE
Reference code:
https:/
Flavio Fernandes (ffernand) wrote : | #1 |
Changed in networking-ovn: | |
assignee: | nobody → Flavio Fernandes (ffernand) |
status: | New → In Progress |
Flavio Fernandes (ffernand) wrote : | #2 |
After some further digging, I can see that this is likely related to a
logic located in AddLRouterPortC
Since logical router port deleted has the same name as the logical router port being added,
the code is incorrectly assuming that the port already exists. And because of that the code
flow returns in line 334 instead of hitting the "idlutils.
This also causes the call to _add_gateway_
(Pdb) self.name
u'lrp-195beff8-
So... DelLRouterPortC
The transaction object looks like this:
CheckRevisionNu
'id': u'74ff4a1f-
ps': [{'subnet_id': u'1637c183-
b', 'admin_state_up': True, 'tenant_id': u'01f82375ae454
d3af98613ca0'}, name=neutron-
DeleteLRouterEx
DelLRouterPortC
AddLRouterPortC
4:fc:a1', 'gateway_chassis': [u'84b16b41-
tron:subnet_ids': u'1637c183-
: ['172.24.
SetLRouterPortI
t=True, lsp_address=
AddStaticRouteC
e73-8b2c-
UpdateLRouterCo
ron:revision_
Changed in networking-ovn: | |
importance: | Undecided → Medium |
Daniel Alvarez (dalvarezs) wrote : | #3 |
I reproduced it following your steps using openstack queens.
56 openstack network create public --external --default --provider-
57 openstack router create myrouter
58 EXT_NET_
59 openstack router set --external-gateway $EXT_NET_ID myrouter
()[root@
router e1354b7b-
port lrp-80df6417-
mac: "fa:16:3e:97:fb:0d"
networks: [""]
gateway chassis: [702381bd-
60 openstack subnet create --ip-version 4 --network $EXT_NET_ID --subnet-range 172.24.4.0/24 --no-dhcp mypublicsubnet
()[root@
router e1354b7b-
Thanks Flavio, good catch :) I think that we need to update the LRP instead of deleting and readding it.
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-ovn (master) | #4 |
Fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to networking-ovn (master) | #5 |
Related fix proposed to branch: master
Review: https:/
Flavio Fernandes (ffernand) wrote : | #6 |
After looking a the transaction created (see comment #2 above) and also looking at the
ovsdb command used for deleting the logical router port, we can now see that the bug
is actually caused by DelLRouterPortC
That approach does not work since removal and re-adding of the port with same name were in the
same transaction.
That is, since the router logical port is not a root object [OVN_A] in the ovsdb schema, the actual
removal of it was happening indirectly by removing the reference [OVN_B] to it from the logical router. See line 409 in [1].
All in all, a much less disruptive approach for addressing this will be used in the latest
Gerrit patch-set [2]. It will explicitly do for the port deletion,
which will then allow the code flow in AddLRouterPortC
exception -- as it should -- and proceed to create the replacement logical router port.
[OVN_A]: https:/
[OVN_B]: https:/
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-ovn (master) | #7 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 92142f316580652
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 12 18:32:34 2019 -0400
Do not lose router logical port upon subnet add on the external net
Prior to this patch, logical port used by the router to the external
network was lost if subnet was added to that network. That was
caused by missing explicit delete call in DelLRouterPortC
Also added functional test to exercise this particular code path:
test_
Closes-Bug: #1843485
Co-authored-by: Daniel Alvarez <email address hidden>
Co-authored-by: Terry Wilson <email address hidden>
Signed-off-by: Flavio Fernandes <email address hidden>
Change-Id: I3e9d62ffc5eab3
Changed in networking-ovn: | |
status: | In Progress → Fix Released |
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-ovn (master) | #8 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 5cffa92daa82211
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 19 14:58:05 2019 -0400
test_router: Verify the creation and removal of a lrp
Add test to ensure that logical router port associated
with an external network is created and removed as
needed: test_logical_
the test exercises the code-path where a gateway is
removed before a new one is set. In terms of OpenStack
workflow, that would look like:
openstack router set --external-gateway $EXT_NET_ID $RTR
openstack router unset --external-gateway $RTR
openstack router set --external-gateway $EXT_NET_ID2 $RTR
Also changed test_gateway_
to include docstring and have a lower bound count to the
mocked objects it uses.
Change-Id: Ib3edc101e9ee0f
Signed-off-by: Flavio Fernandes <email address hidden>
Related-Bug: #1843485
Closes-Bug: #1844652
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-ovn (stable/train) | #9 |
Fix proposed to branch: stable/train
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-ovn (stable/stein) | #10 |
Fix proposed to branch: stable/stein
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-ovn (stable/rocky) | #11 |
Fix proposed to branch: stable/rocky
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-ovn (stable/queens) | #12 |
Fix proposed to branch: stable/queens
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-ovn (stable/stein) | #13 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit f7ee5a5e05f4da2
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 12 18:32:34 2019 -0400
Do not lose router logical port upon subnet add on the external net
Prior to this patch, logical port used by the router to the external
network was lost if subnet was added to that network. That was
caused by missing explicit delete call in DelLRouterPortC
Also added functional test to exercise this particular code path:
test_
Closes-Bug: #1843485
Co-authored-by: Daniel Alvarez <email address hidden>
Co-authored-by: Terry Wilson <email address hidden>
Signed-off-by: Flavio Fernandes <email address hidden>
Change-Id: I3e9d62ffc5eab3
(cherry picked from commit 92142f316580652
tags: | added: in-stable-stein |
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-ovn (stable/train) | #14 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/train
commit 92fc4dd62f813ca
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 12 18:32:34 2019 -0400
Do not lose router logical port upon subnet add on the external net
Prior to this patch, logical port used by the router to the external
network was lost if subnet was added to that network. That was
caused by missing explicit delete call in DelLRouterPortC
Also added functional test to exercise this particular code path:
test_
Closes-Bug: #1843485
Co-authored-by: Daniel Alvarez <email address hidden>
Co-authored-by: Terry Wilson <email address hidden>
Signed-off-by: Flavio Fernandes <email address hidden>
Change-Id: I3e9d62ffc5eab3
(cherry picked from commit 92142f316580652
tags: | added: in-stable-train |
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-ovn (stable/rocky) | #15 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit bac75284f4600eb
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 12 18:32:34 2019 -0400
Do not lose router logical port upon subnet add on the external net
Prior to this patch, logical port used by the router to the external
network was lost if subnet was added to that network. That was
caused by missing explicit delete call in DelLRouterPortC
Also added functional test to exercise this particular code path:
test_
Closes-Bug: #1843485
Co-authored-by: Daniel Alvarez <email address hidden>
Co-authored-by: Terry Wilson <email address hidden>
Signed-off-by: Flavio Fernandes <email address hidden>
Change-Id: I3e9d62ffc5eab3
(cherry picked from commit 92142f316580652
tags: | added: in-stable-rocky |
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-ovn (stable/queens) | #16 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 919eaabd5d94ed4
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 12 18:32:34 2019 -0400
Do not lose router logical port upon subnet add on the external net
Prior to this patch, logical port used by the router to the external
network was lost if subnet was added to that network. That was
caused by missing explicit delete call in DelLRouterPortC
Also added functional test to exercise this particular code path:
test_
Closes-Bug: #1843485
Co-authored-by: Daniel Alvarez <email address hidden>
Co-authored-by: Terry Wilson <email address hidden>
Signed-off-by: Flavio Fernandes <email address hidden>
Change-Id: I3e9d62ffc5eab3
(cherry picked from commit 92142f316580652
tags: | added: in-stable-queens |
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/networking-ovn 4.0.4 | #17 |
This issue was fixed in the openstack/
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/networking-ovn 7.1.0 | #18 |
This issue was fixed in the openstack/
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/networking-ovn 6.0.1 | #19 |
This issue was fixed in the openstack/
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/networking-ovn 5.1.0 | #20 |
This issue was fixed in the openstack/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to networking-ovn (stable/train) | #21 |
Related fix proposed to branch: stable/train
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to networking-ovn (stable/stein) | #22 |
Related fix proposed to branch: stable/stein
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to networking-ovn (stable/rocky) | #23 |
Related fix proposed to branch: stable/rocky
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to networking-ovn (stable/queens) | #24 |
Related fix proposed to branch: stable/queens
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-ovn (stable/train) | #25 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/train
commit b9ab95036b3bbaf
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 19 14:58:05 2019 -0400
test_router: Verify the creation and removal of a lrp
Add test to ensure that logical router port associated
with an external network is created and removed as
needed: test_logical_
the test exercises the code-path where a gateway is
removed before a new one is set. In terms of OpenStack
workflow, that would look like:
openstack router set --external-gateway $EXT_NET_ID $RTR
openstack router unset --external-gateway $RTR
openstack router set --external-gateway $EXT_NET_ID2 $RTR
Also changed test_gateway_
to include docstring and have a lower bound count to the
mocked objects it uses.
Change-Id: Ib3edc101e9ee0f
Signed-off-by: Flavio Fernandes <email address hidden>
Related-Bug: #1843485
Closes-Bug: #1844652
(cherry picked from commit 5cffa92daa82211
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-ovn (stable/rocky) | #26 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit f3577c72f154bcc
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 19 14:58:05 2019 -0400
test_router: Verify the creation and removal of a lrp
Add test to ensure that logical router port associated
with an external network is created and removed as
needed: test_logical_
the test exercises the code-path where a gateway is
removed before a new one is set. In terms of OpenStack
workflow, that would look like:
openstack router set --external-gateway $EXT_NET_ID $RTR
openstack router unset --external-gateway $RTR
openstack router set --external-gateway $EXT_NET_ID2 $RTR
Also changed test_gateway_
to include docstring and have a lower bound count to the
mocked objects it uses.
Change-Id: Ib3edc101e9ee0f
Signed-off-by: Flavio Fernandes <email address hidden>
Related-Bug: #1843485
Closes-Bug: #1844652
(cherry picked from commit 5cffa92daa82211
(cherry picked from commit b9ab95036b3bbaf
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-ovn (stable/queens) | #27 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 5d9dacf52265c2d
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 19 14:58:05 2019 -0400
test_router: Verify the creation and removal of a lrp
Add test to ensure that logical router port associated
with an external network is created and removed as
needed: test_logical_
the test exercises the code-path where a gateway is
removed before a new one is set. In terms of OpenStack
workflow, that would look like:
openstack router set --external-gateway $EXT_NET_ID $RTR
openstack router unset --external-gateway $RTR
openstack router set --external-gateway $EXT_NET_ID2 $RTR
Also changed test_gateway_
to include docstring and have a lower bound count to the
mocked objects it uses.
Change-Id: Ib3edc101e9ee0f
Signed-off-by: Flavio Fernandes <email address hidden>
Related-Bug: #1843485
Closes-Bug: #1844652
(cherry picked from commit 5cffa92daa82211
(cherry picked from commit b9ab95036b3bbaf
(cherry picked from commit f3577c72f154bcc
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-ovn (stable/stein) | #28 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 23a0316193be494
Author: Flavio Fernandes <email address hidden>
Date: Thu Sep 19 14:58:05 2019 -0400
test_router: Verify the creation and removal of a lrp
Add test to ensure that logical router port associated
with an external network is created and removed as
needed: test_logical_
the test exercises the code-path where a gateway is
removed before a new one is set. In terms of OpenStack
workflow, that would look like:
openstack router set --external-gateway $EXT_NET_ID $RTR
openstack router unset --external-gateway $RTR
openstack router set --external-gateway $EXT_NET_ID2 $RTR
Also changed test_gateway_
to include docstring and have a lower bound count to the
mocked objects it uses.
Change-Id: Ib3edc101e9ee0f
Signed-off-by: Flavio Fernandes <email address hidden>
Related-Bug: #1843485
Closes-Bug: #1844652
(cherry picked from commit 5cffa92daa82211
(cherry picked from commit b9ab95036b3bbaf
[vagrant@ ovntutorial2 ~]$ PRJ=$(openstack project show demo -f value -c id) ovntutorial2 ~]$ ovntutorial2 ~]$ openstack router create --project $PRJ router2 >/dev/null ovntutorial2 ~]$ RTR=$(openstack router show router2 -f value -c id) ovntutorial2 ~]$ ovntutorial2 ~]$ openstack network create public --external --default --provider- network- type flat --provider- physical- network public >/dev/null ovntutorial2 ~]$ EXT_NET_ ID=$(openstack network show public -f value -c id) ovntutorial2 ~]$ ovntutorial2 ~]$ openstack router set --external-gateway $EXT_NET_ID $RTR ; # this creates the logical port that connect router to gateway_chassis ovntutorial2 ~]$ ovntutorial2 ~]$ sudo ovn-nbctl show | grep router2 -A 8 ; # the logical port is present... d675-478c- b281-072239b5f8 67 (neutron- c64a10fa- a6db-4a46- 8439-a62243360f ce) (aka router2) fbed-4f8f- b5ab-275bf8cf0c 72 3a0d-4830- a1b5-07ab678709 ff] ovntutorial2 ~]$ ovntutorial2 ~]$ CHASSIS=$(ovn-nbctl --bare --columns="_uuid" find Gateway_Chassis) ovntutorial2 ~]$ PORT_NAME= $(ovn-nbctl --bare --columns=name find logical_router_port gateway_ chassis= "${CHASSIS} ") ovntutorial2 ~]$ echo logical port \"${PORT_NAME}\" in chassis \"${CHASSIS}\" fbed-4f8f- b5ab-275bf8cf0c 72" in chassis "b95773d3- 767c-4cef- 8267-2b40ba3e28 f6" ovntutorial2 ~]$ ovntutorial2 ~]$ ovntutorial2 ~]$ openstack subnet create --ip-version 4 --network $EXT_NET_ID --subnet-range 172.24.4.0/24 --no-dhcp public-subnet >/dev/null ovntutorial2 ~]$ ovntutorial2 ~]$ ovntutorial2 ~]$ ovn-nbctl --bare --columns="_uuid" find Gateway_Chassis ovntutorial2 ~]$ ovn-nbctl --bare --columns=name find logical_router_port ovntutorial2 ~]$ ovntutorial2 ~]$ sudo journalctl -u devstack@q-svc > ~vagrant/ neutron_ log.txt
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
router 06374a0c-
port lrp-9a4b6dfb-
mac: "fa:16:3e:0f:ee:ff"
networks: [""]
gateway chassis: [97abb05b-
[vagrant@
[vagrant@
[vagrant@
[vagrant@
logical port "lrp-9a4b6dfb-
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@
[vagrant@