Router without active ports fails to be deleted, are reports wrong error message

Bug #1236372 reported by Rami Vaknin
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
vaibhav_kale

Bug Description

Version
=======
Havana, RHEL, neutron+ovs, python-neutron-2013.2-0.3.3.b3.el6ost

Description
===========
It's impossible to delete a router while it still has inactive ports.
The error message states that the router still has active ports.

# neutron router-port-list router1
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| 052a48e4-0868-4675-bef7-8f763dd697b4 | | fa:16:3e:60:73:8d | {"subnet_id": "c5d63940-71e8-4338-865e-f5364fbe4e78", "ip_address": "10.35.214.1"} |
| 065cef02-a949-45c9-b3df-e005dbf96c9a | | fa:16:3e:a6:6d:d8 | {"subnet_id": "044bcc05-f37b-4d1d-a700-c91c4381fbc8", "ip_address": "10.35.211.1"} |
| 7a020243-90e5-439d-90fb-ec96b07843e7 | | fa:16:3e:04:0c:1f | {"subnet_id": "4081fbca-3e59-4be5-a98e-3c9e0d13d3a6", "ip_address": "10.35.212.1"} |
| 7af56958-674e-472b-8dbe-09b60501a6e6 | | fa:16:3e:1a:07:a4 | {"subnet_id": "ef8e7c03-f17f-4c3c-9afe-252aca1283fd", "ip_address": "10.35.170.102"} |
| f034cb8a-2a09-4d41-b46c-a08fe208461e | | fa:16:3e:de:9d:32 | {"subnet_id": "cca4edc7-2872-4c1e-a270-3b0beb60f421", "ip_address": "10.35.213.1"} |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+

# for i in `neutron router-port-list router1 | grep subnet_id | cut -d" " -f 2` ; do neutron port-show $i ; done | grep status
| status | ACTIVE |
| status | ACTIVE |
| status | ACTIVE |
| status | ACTIVE |
| status | ACTIVE |

# neutron router-delete router1
Router 727edf71-f637-402e-9fd9-767c372922ee still has active ports

# for i in `neutron router-port-list router1 | grep subnet_id | cut -d" " -f 2` ; do neutron port-update $i --admin_state_up False ; done | grep status

# for i in `neutron router-port-list router1 | grep subnet_id | cut -d" " -f 2` ; do neutron port-show $i ; done | grep status
| status | DOWN |
| status | DOWN |
| status | DOWN |
| status | DOWN |
| status | DOWN |

# neutron router-delete router1
Router 727edf71-f637-402e-9fd9-767c372922ee still has active ports

From /var/log/neutron/server.log
================================
2013-10-07 16:39:40.429 2341 ERROR neutron.api.v2.resource [-] delete failed
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource Traceback (most recent call last):
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/resource.py", line 84, in resource
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource result = method(request=request, **args)
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/base.py", line 432, in delete
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource obj_deleter(request.context, id, **kwargs)
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/db/l3_db.py", line 266, in delete_router
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource raise l3.RouterInUse(router_id=id)
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource RouterInUse: Router 727edf71-f637-402e-9fd9-767c372922ee still has active ports
2013-10-07 16:39:40.429 2341 TRACE neutron.api.v2.resource
2013-10-07 16:40:34.870 2341 ERROR neutron.api.v2.resource [-] delete failed
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource Traceback (most recent call last):
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/resource.py", line 84, in resource
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource result = method(request=request, **args)
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/base.py", line 432, in delete
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource obj_deleter(request.context, id, **kwargs)
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/db/l3_db.py", line 266, in delete_router
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource raise l3.RouterInUse(router_id=id)
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource RouterInUse: Router 727edf71-f637-402e-9fd9-767c372922ee still has active ports
2013-10-07 16:40:34.870 2341 TRACE neutron.api.v2.resource

Jeremy Stanley (fungi)
Changed in openstack-ci:
status: New → Invalid
no longer affects: openstack-ci
ZhiQiang Fan (aji-zqfan)
Changed in neutron:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
ZhiQiang Fan (aji-zqfan)
Changed in neutron:
assignee: ZhiQiang Fan (aji-zqfan) → nobody
Revision history for this message
Mark McClain (markmcclain) wrote :

The behavior is correct, so we clarify the error message.

Changed in neutron:
status: New → Triaged
tags: added: l3-ipam-dhcp low-hanging-fruit
Changed in neutron:
importance: Undecided → Low
Changed in neutron:
assignee: nobody → Brandon Logan (brandon-logan)
Revision history for this message
vaibhav_kale (vaibhav-kale) wrote :

I think behavior of router is correct, because if we allow to delete the router with inactive ports then router will be deleted but you will lost the pointers to delete the inactive ports and it will brings the subnet in inconsistent state. So if you want to delete the router then first delete all interfaces on it then delete the router, that is what the behavior followed here. Or Instead of sending of message that "Router still has active ports", modify the code such that it should delete first all inactive ports/interfaces on router then it should delete the router automatically.

Changed in neutron:
assignee: Brandon Logan (brandon-logan) → nobody
Changed in neutron:
assignee: nobody → vaibhav_kale (vaibhav-kale)
Revision history for this message
vaibhav_kale (vaibhav-kale) wrote :

I have pushed the code changes, this is the link - https://review.openstack.org/#/c/83374/

Changed in neutron:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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

commit 238689570145fdafe8e61967bb56133f167d39ab
Author: sushma_korati <email address hidden>
Date: Thu Mar 27 15:03:45 2014 +0530

    Changed the message line of RouterInUse class

    Implements: Changed the message line of RouterInUse class,
    so user will not get confused with active or inactive ports
    while deleting the router.

    Closes-Bug: #1236372
    Change-Id: I7a82550e2c6051f9e4940a8f1dd4401059e0a8d8

Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
milestone: none → juno-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/85497

Changed in neutron:
milestone: juno-1 → icehouse-rc2
no longer affects: neutron/icehouse
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (milestone-proposed)

Reviewed: https://review.openstack.org/85497
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e1fcdb25a3365c14d564d7a04ed09adda3ad1265
Submitter: Jenkins
Branch: milestone-proposed

commit e1fcdb25a3365c14d564d7a04ed09adda3ad1265
Author: sushma_korati <email address hidden>
Date: Thu Mar 27 15:03:45 2014 +0530

    Changed the message line of RouterInUse class

    Implements: Changed the message line of RouterInUse class,
    so user will not get confused with active or inactive ports
    while deleting the router.

    Closes-Bug: #1236372
    Change-Id: I7a82550e2c6051f9e4940a8f1dd4401059e0a8d8
    (cherry picked from commit 238689570145fdafe8e61967bb56133f167d39ab)

Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-rc2 → 2014.1
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.