yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51352
[Bug 1584510] [NEW] internal server error when using a boolean instead of router port id
Public bug reported:
When calling the neutron-server api directly with '{"port_id": false}' like:
curl -X PUT http://127.0.0.1:9696/v2.0/routers/${ROUTER_ID}/add_router_interface.json -d '{"port_id": false}'
The neutron.api.v2.resource fails with this exception:
Traceback (most recent call last):
File "neutron/db/l3_dvr_db.py", line 252, in add_router_interface
context, router, interface_info['port_id'], device_owner)
File "neutron/db/l3_db.py", line 600, in _add_interface_by_port
self._check_router_port(context, port_id, '')
File "neutron/db/l3_db.py", line 586, in _check_router_port
port = self._core_plugin.get_port(context, port_id)
File "neutron/db/db_base_plugin_v2.py", line 1344, in get_port
port = self._get_port(context, id)
File "neutron/db/db_base_plugin_common.py", line 224, in _get_port
port = self._get_by_id(context, models_v2.Port, id)
File "neutron/db/common_db_mixin.py", line 212, in _get_by_id
return query.filter(model.id == id).one()
File "sqlalchemy/orm/query.py", line 2702, in one
"Multiple rows were found for one()")
MultipleResultsFound: Multiple rows were found for one()
It seems like the _get_by_id method expects a uuid str and it is fooled
by a boolean that get used in the sqlalchemy filter. The error is miss-
leading and could be prevented if the port_id type was forced to be a
string.
While this doesn't affect the service availability, it gets quickly
overly verbose when port_id is an empty list (e.g.: '{"port_id": []}'),
then the server.log grow by 13k per request, see attached log file.
** Affects: neutron
Importance: Undecided
Status: New
** Attachment added: "dberror_traceback.txt"
https://bugs.launchpad.net/bugs/1584510/+attachment/4668187/+files/dberror_traceback.txt
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1584510
Title:
internal server error when using a boolean instead of router port id
Status in neutron:
New
Bug description:
When calling the neutron-server api directly with '{"port_id": false}' like:
curl -X PUT http://127.0.0.1:9696/v2.0/routers/${ROUTER_ID}/add_router_interface.json -d '{"port_id": false}'
The neutron.api.v2.resource fails with this exception:
Traceback (most recent call last):
File "neutron/db/l3_dvr_db.py", line 252, in add_router_interface
context, router, interface_info['port_id'], device_owner)
File "neutron/db/l3_db.py", line 600, in _add_interface_by_port
self._check_router_port(context, port_id, '')
File "neutron/db/l3_db.py", line 586, in _check_router_port
port = self._core_plugin.get_port(context, port_id)
File "neutron/db/db_base_plugin_v2.py", line 1344, in get_port
port = self._get_port(context, id)
File "neutron/db/db_base_plugin_common.py", line 224, in _get_port
port = self._get_by_id(context, models_v2.Port, id)
File "neutron/db/common_db_mixin.py", line 212, in _get_by_id
return query.filter(model.id == id).one()
File "sqlalchemy/orm/query.py", line 2702, in one
"Multiple rows were found for one()")
MultipleResultsFound: Multiple rows were found for one()
It seems like the _get_by_id method expects a uuid str and it is
fooled by a boolean that get used in the sqlalchemy filter. The error
is miss-leading and could be prevented if the port_id type was forced
to be a string.
While this doesn't affect the service availability, it gets quickly
overly verbose when port_id is an empty list (e.g.: '{"port_id":
[]}'), then the server.log grow by 13k per request, see attached log
file.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1584510/+subscriptions
Follow ups