Server returns error 500 when setting a DVR router as a gateway on a network with no subnet, and then adding an interface

Bug #1452458 reported by Assaf Muller on 2015-05-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Low
Stephen Eilert

Bug Description

Steps to reproduce:
1) Create DVR router
2) Set it as a gateway on an external network with no subnet (Note: I have no idea what this means or why would someone do this). The operation succeeds as it does with legacy routers.
3) Add a router interface on an internal subnet. This will return error 500. The internal port and its SNAT port will be created successfully, with DOWN status. (Note: This step would succeed / not return error 500 on legacy routers).

Trace from server log:
2015-05-07 00:16:37.421 25776 ERROR neutron.api.v2.resource [req-de30ab02-3867-4772-9c1b-55c2f0a864bf ] add_router_interface failed
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/v2/resource.py", line 83, in resource
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/v2/base.py", line 207, in _handle_action
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource return getattr(self._plugin, name)(*arg_list, **kwargs)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_dvr_db.py", line 309, in add_router_interface
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource context, router_interface_info, 'add')
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_db.py", line 1304, in notify_router_interface_action
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource {'subnet_id': router_interface_info['subnet_id']})
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_db.py", line 1280, in notify_routers_updated
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource context, router_ids, operation, data)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py", line 144, in router
s_updated
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource operation, shuffle_agents)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py", line 115, in _notif
ication
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource plugin.schedule_routers(adminContext, router_ids)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_agentschedulers_db.py", line 497, in schedule_routers
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource self.schedule_router(context, router, candidates=None)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_agentschedulers_db.py", line 492, in schedule_router
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource self, context, router, candidates=candidates)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/scheduler/l3_agent_scheduler.py", line 359, in schedule
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource plugin, context, router_id, candidates=candidates)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/scheduler/l3_agent_scheduler.py", line 253, in _schedule_router
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource plugin, context, sync_router)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/scheduler/l3_agent_scheduler.py", line 185, in get_candidates
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource active_l3_agents)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_agentschedulers_db.py", line 480, in get_l3_agent_candidat
es
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource context, l3_agent, sync_router['id'])):
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_agentschedulers_db.py", line 377, in check_ports_exist_on_
l3agent
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource subnet_ids = self.get_subnet_ids_on_router(context, router_id)
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/db/l3_dvrscheduler_db.py", line 143, in get_subnet_ids_on_router
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource int_subnet = int_ips[0]['subnet_id']
2015-05-07 00:16:37.421 25776 TRACE neutron.api.v2.resource IndexError: list index out of range

Assaf Muller (amuller) on 2015-05-06
description: updated
Nikhil AP (niks3089) on 2015-05-11
Changed in neutron:
assignee: nobody → Nikhil AP (niks3089)
status: New → In Progress

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

Changed in neutron:
assignee: Nikhil AP (niks3089) → Stephen Eilert (outworlder)

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

commit d198b41def22a188f77948783e90632abb7a588a
Author: Stephen Eilert <email address hidden>
Date: Tue Nov 17 16:49:19 2015 -0800

    Fix get_subnet_ids_on_router in dvr scheduler

    Added a check to verify if we do have any elements in the list of
    fixed_ips, before trying to retrieve the first element of the list, to
    get the subnet id. There were no checks in the original code, so it
    would crash.

    Change-Id: If32db500aa3a0c299a5f19c33c05237e8e407e08
    Closes-Bug: 1452458

Changed in neutron:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/250781
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5469d753f1857a2cd88d24d44338ec956b711bb9
Submitter: Jenkins
Branch: stable/liberty

commit 5469d753f1857a2cd88d24d44338ec956b711bb9
Author: Stephen Eilert <email address hidden>
Date: Tue Nov 17 16:49:19 2015 -0800

    Fix get_subnet_ids_on_router in dvr scheduler

    Added a check to verify if we do have any elements in the list of
    fixed_ips, before trying to retrieve the first element of the list, to
    get the subnet id. There were no checks in the original code, so it
    would crash.

    Change-Id: If32db500aa3a0c299a5f19c33c05237e8e407e08
    Closes-Bug: 1452458
    (cherry picked from commit d198b41def22a188f77948783e90632abb7a588a)

tags: added: in-stable-liberty

This issue was fixed in the openstack/neutron 8.0.0.0b1 development milestone.

Changed in neutron:
status: Fix Committed → Fix Released

This issue was fixed in the openstack/neutron 7.0.1 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers