Reviewed: https://review.openstack.org/319729 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=18280216cb7405856ba52f7eee0b1b214dcebd7b Submitter: Jenkins Branch: master
commit 18280216cb7405856ba52f7eee0b1b214dcebd7b Author: Kevin Benton <[email protected]> Date: Sat May 14 05:39:31 2016 -0700 Enforce UUID of port/subnet ID for router interfaces The add_router_interface/remove_router_interface actions are not subject to the typical attribute map validation so the input values for port_id and subnet_id were not being checked for UUID likeness. This lead to an ugly traceback if a boolean value was present which could fill logs with garbage if a tenant kept doing it. This patch calls the API validator for UUIDs in the _validate_interface_info function where we validate requests to add_router_inferface and remove_router_interface. Change-Id: I0a0d3279a21c815fb78528860fc2a35c1d5a4e2d Closes-Bug: #1584510 ** Changed in: neutron Status: In Progress => Fix Released -- 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: Fix Released 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 -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

