← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1525163] [NEW] add-router-interface can not recover when failing create_port_post_commit

 

Public bug reported:

When the following situation, a port created that no one can delete it:

  1. Configure ML2 plugin.
  2. Execute router-interface-add with subnet_id and failed in create_port_post_commit

  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:router_interface.

    case2: router-interface-delete with subnet_id or port_id
      => 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_port_post_commit has a recovery process.  When failed, then calls
  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_check=False' into delete_port's argument.

[Environment]
  trunk(devstack all-in-one with ML2 plugin(openvswitch))

[How to reproduce]
* You have to arrange create_port_post_commit shuld be failed.

source devstack/openrc admin admin
export TOKEN=`openstack token issue | grep ' id ' | get_field 2`

curl -s -X GET -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/ports | jq "."
{
  "ports": []
}

curl -i -X PUT -d '{"subnet_id":"214ebeb5-2d08-4ae5-9d60-3c7a76d56746"}'
-H "x-auth-token:$TOKEN"
192.168.122.253:9696/v2.0/routers/7d1561d1-71f9-4355-9248-5ac313de8ee3/add_router_interface

HTTP/1.1 409 Conflict
Content-Type: application/json; charset=UTF-8
Content-Length: 204
X-Openstack-Request-Id: req-ec3bad1f-84a2-4865-9cac-e63723c0a3bb
Date: Fri, 11 Dec 2015 10:11:11 GMT

{"NeutronError": {"message": "Port 570a4166-d463-4ee6-894b-f8aab6cc63b2
cannot be deleted directly via the port API: has device owner
network:router_interface.", "type": "ServicePortInUse", "detail": ""}}

$ curl -s -X GET -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/ports/570a4166-d463-4ee6-894b-f8aab6cc63b2 | jq "."
{
  "port": {
    "mac_address": "fa:16:3e:c3:1c:8d",
    "tenant_id": "4c0b8881d3e24a1cb1afe9ea6b07d946",
    "binding:vif_type": "unbound",
    "binding:vnic_type": "normal",
    "binding:vif_details": {},
    "binding:profile": {},
    "port_security_enabled": false,
    "device_owner": "network:router_interface",
    "dns_assignment": [
      {
        "fqdn": "host-172-16-1-1.openstacklocal.",
        "ip_address": "172.16.1.1",
        "hostname": "host-172-16-1-1"
      }
    ],
    "extra_dhcp_opts": [],
    "allowed_address_pairs": [],
    "binding:host_id": "",
    "status": "DOWN",
    "fixed_ips": [
      {
        "ip_address": "172.16.1.1",
        "subnet_id": "214ebeb5-2d08-4ae5-9d60-3c7a76d56746"
      }
    ],
    "id": "570a4166-d463-4ee6-894b-f8aab6cc63b2",
    "security_groups": [],
    "device_id": "7d1561d1-71f9-4355-9248-5ac313de8ee3",
    "name": "",
    "admin_state_up": true,
    "network_id": "11515598-c20e-4e8a-94d0-1fef56f4607d",
    "dns_name": ""
  }
}

** Affects: neutron
     Importance: Undecided
     Assignee: Yushiro FURUKAWA (y-furukawa-2)
         Status: New


** Tags: neutron

** Changed in: neutron
     Assignee: (unassigned) => Yushiro FURUKAWA (y-furukawa-2)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1525163

Title:
  add-router-interface can not recover when failing
  create_port_post_commit

Status in neutron:
  New

Bug description:
  When the following situation, a port created that no one can delete
  it:

    1. Configure ML2 plugin.
    2. Execute router-interface-add with subnet_id and failed in create_port_post_commit

    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:router_interface.

      case2: router-interface-delete with subnet_id or port_id
        => 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_port_post_commit has a recovery process.  When failed, then calls
    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_check=False' into delete_port's argument.

  [Environment]
    trunk(devstack all-in-one with ML2 plugin(openvswitch))

  [How to reproduce]
  * You have to arrange create_port_post_commit shuld be failed.

  source devstack/openrc admin admin
  export TOKEN=`openstack token issue | grep ' id ' | get_field 2`

  curl -s -X GET -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/ports | jq "."
  {
    "ports": []
  }

  curl -i -X PUT -d
  '{"subnet_id":"214ebeb5-2d08-4ae5-9d60-3c7a76d56746"}'  -H "x-auth-
  token:$TOKEN"
  192.168.122.253:9696/v2.0/routers/7d1561d1-71f9-4355-9248-5ac313de8ee3/add_router_interface

  HTTP/1.1 409 Conflict
  Content-Type: application/json; charset=UTF-8
  Content-Length: 204
  X-Openstack-Request-Id: req-ec3bad1f-84a2-4865-9cac-e63723c0a3bb
  Date: Fri, 11 Dec 2015 10:11:11 GMT

  {"NeutronError": {"message": "Port 570a4166-d463-4ee6-894b-
  f8aab6cc63b2 cannot be deleted directly via the port API: has device
  owner network:router_interface.", "type": "ServicePortInUse",
  "detail": ""}}

  $ curl -s -X GET -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/ports/570a4166-d463-4ee6-894b-f8aab6cc63b2 | jq "."
  {
    "port": {
      "mac_address": "fa:16:3e:c3:1c:8d",
      "tenant_id": "4c0b8881d3e24a1cb1afe9ea6b07d946",
      "binding:vif_type": "unbound",
      "binding:vnic_type": "normal",
      "binding:vif_details": {},
      "binding:profile": {},
      "port_security_enabled": false,
      "device_owner": "network:router_interface",
      "dns_assignment": [
        {
          "fqdn": "host-172-16-1-1.openstacklocal.",
          "ip_address": "172.16.1.1",
          "hostname": "host-172-16-1-1"
        }
      ],
      "extra_dhcp_opts": [],
      "allowed_address_pairs": [],
      "binding:host_id": "",
      "status": "DOWN",
      "fixed_ips": [
        {
          "ip_address": "172.16.1.1",
          "subnet_id": "214ebeb5-2d08-4ae5-9d60-3c7a76d56746"
        }
      ],
      "id": "570a4166-d463-4ee6-894b-f8aab6cc63b2",
      "security_groups": [],
      "device_id": "7d1561d1-71f9-4355-9248-5ac313de8ee3",
      "name": "",
      "admin_state_up": true,
      "network_id": "11515598-c20e-4e8a-94d0-1fef56f4607d",
      "dns_name": ""
    }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1525163/+subscriptions


Follow ups