add-router-interface can not recover when failing create_port_post_commit
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Undecided
|
Yushiro FURUKAWA |
Bug Description
When the following situation, a port created that no one can delete it:
1. Configure ML2 plugin.
2. Execute router-
After that, undeletable port is created.
Even if the admin tries to delete the port, he cannot delete it.
case1: delete-port with port_id
=> Port {port_id} cannot be deleted directly via the port API: has device owner network:
case2: router-
=> Router {router_id} has no interface on subnet {subnet_id}
=> Router {router_id} does not have an interface with id {port_id}
[How to fix]
create_
delete_port. However, in this case, 'device_owner' and 'device_id' have already
registered at port's DB. Therefore, delete_port fails due to device_owner check.
Hence, I'll add 'l3_port_
[Environment]
trunk(devstack all-in-one with ML2 plugin(
[How to reproduce]
* You have to arrange create_
source devstack/openrc admin admin
export TOKEN=`openstack token issue | grep ' id ' | get_field 2`
curl -s -X GET -H "x-auth-
{
"ports": []
}
curl -i -X PUT -d '{"subnet_
HTTP/1.1 409 Conflict
Content-Type: application/json; charset=UTF-8
Content-Length: 204
X-Openstack-
Date: Fri, 11 Dec 2015 10:11:11 GMT
{"NeutronError": {"message": "Port 570a4166-
$ curl -s -X GET -H "x-auth-
{
"port": {
"mac_address": "fa:16:
"tenant_id": "4c0b8881d3e24a
"binding:
"binding:
"binding:
"binding:
"port_
"device_owner": "network:
"dns_
{
"fqdn": "host-172-
"hostname": "host-172-16-1-1"
}
],
"extra_
"allowed_
"binding:
"status": "DOWN",
"fixed_ips": [
{
}
],
"id": "570a4166-
"security_
"device_id": "7d1561d1-
"name": "",
"admin_
"network_id": "11515598-
"dns_name": ""
}
}
Changed in neutron: | |
assignee: | nobody → Yushiro FURUKAWA (y-furukawa-2) |
Changed in neutron: | |
assignee: | Isaku Yamahata (yamahata) → Yushiro FURUKAWA (y-furukawa-2) |
Changed in neutron: | |
status: | In Progress → Fix Released |
Here is the stack trace when postcommit failed.
2016-01-06 11:26:59.812 ERROR oslo_db.api [req-285516b2- 87b3-46a8- 9898-162d0796a5 2b tempest- RoutersTest- 602986699 46cbce09c21b4d8 195477acd8fe8e7 1b] DB error. lib/python2. 7/dist- packages/ oslo_db/ api.py" , line 137, in wrapper yamahata/ openstack/ odl/neutron/ neutron/ api/v2/ base.py" , line 217, in _handle_action self._plugin, name)(*arg_list, **kwargs) yamahata/ openstack/ odl/networking- odl/networking_ odl/l3/ l3_odl. py", line 135, in add_router_ interface yamahata/ openstack/ odl/neutron/ neutron/ db/l3_dvr_ db.py", line 264, in add_router_ interface info['subnet_ id'], device_owner) yamahata/ openstack/ odl/neutron/ neutron/ db/l3_db. py", line 628, in _add_interface_ by_subnet yamahata/ openstack/ odl/neutron/ neutron/ plugins/ common/ utils.py" , line 149, in create_port create_ port(context, {'port': port_data}) yamahata/ openstack/ odl/neutron/ neutron/ plugins/ ml2/plugin. py", line 1061, in create_port port(context, result['id']) yamahata/ openstack/ odl/neutron/ neutron/ plugins/ ml2/plugin. py", line 1334, in delete_port delete_ port(context, id, l3_port_check) yamahata/ openstack/ odl/neutron/ neutron/ plugins/ ml2/plugin. py", line 1330, in _pre_delete_port 796b-456b- a19a-b6b58425f4 3b cannot be deleted directly via the port API: has device owner network: router_ interface.
2016-01-06 11:26:59.812 TRACE oslo_db.api Traceback (most recent call last):
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/usr/local/
2016-01-06 11:26:59.812 TRACE oslo_db.api return f(*args, **kwargs)
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api ret_value = getattr(
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api context, router_id, interface_info)
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api context, router, interface_
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api {'port': port_data}), [subnet], True
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api return core_plugin.
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api self.delete_
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api self._pre_
2016-01-06 11:26:59.812 TRACE oslo_db.api File "/home/
2016-01-06 11:26:59.812 TRACE oslo_db.api raise e.errors[0].error
2016-01-06 11:26:59.812 TRACE oslo_db.api ServicePortInUse: Port c1de21c0-
2016-01-06 11:26:59.812 TRACE oslo_db.api