** Changed in: quantum/folsom
       Status: Fix Committed => Fix Released

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

Title:
  delete router fails with internal sever error when floatingip
  association remains

Status in OpenStack Quantum (virtual network service):
  Fix Released
Status in quantum folsom series:
  Fix Released

Bug description:
  I think it is better remove_router_interface fails when floatingip
  association remains.

  operation log:
  ---
  $ quantum net-list
  
+--------------------------------------+---------+--------------------------------------+
  | id                                   | name    | subnets                    
          |
  
+--------------------------------------+---------+--------------------------------------+
  | 1446b63c-661d-4427-8921-8bd65fd86b49 | net-ext | 
f80d63dd-5bbd-4b14-bcbd-f1fc8be35b02 |
  | 4d0ef4da-f7d1-45a8-8c22-e284264d9145 | net1    | 
65f1f1a6-a615-48a1-9c4e-cc4e813aacb9 |
  
+--------------------------------------+---------+--------------------------------------+
  $ quantum subnet-list
  
+--------------------------------------+------------+----------------+----------------------------------------------------+
  | id                                   | name       | cidr           | 
allocation_pools                                   |
  
+--------------------------------------+------------+----------------+----------------------------------------------------+
  | 65f1f1a6-a615-48a1-9c4e-cc4e813aacb9 | sub1       | 10.0.0.0/24    | 
{"start": "10.0.0.2", "end": "10.0.0.254"}         |
  | f80d63dd-5bbd-4b14-bcbd-f1fc8be35b02 | subnet-ext | 192.168.0.0/24 | 
{"start": "192.168.0.200", "end": "192.168.0.210"} |
  
+--------------------------------------+------------+----------------+----------------------------------------------------+
  $ quantum router-create routerA
  Created a new router:
  +-----------------------+--------------------------------------+
  | Field                 | Value                                |
  +-----------------------+--------------------------------------+
  | admin_state_up        | True                                 |
  | external_gateway_info |                                      |
  | host_routes           |                                      |
  | id                    | 128283af-6caa-4db8-baab-3aaf16202b14 |
  | name                  | routerA                              |
  | status                | ACTIVE                               |
  | tenant_id             | c34402ac0852467083d496e5d9ed15cc     |
  +-----------------------+--------------------------------------+
  $ quantum router-gateway-set routerA net-ext
  Set gateway for router routerA
  $ quantum router-interface-add routerA sub1
  Added interface to router routerA
  $ quantum port-create net1
  Created a new port:
  
+----------------+---------------------------------------------------------------------------------+
  | Field          | Value                                                      
                     |
  
+----------------+---------------------------------------------------------------------------------+
  | admin_state_up | True                                                       
                     |
  | device_id      |                                                            
                     |
  | device_owner   |                                                            
                     |
  | fixed_ips      | {"subnet_id": "65f1f1a6-a615-48a1-9c4e-cc4e813aacb9", 
"ip_address": "10.0.0.5"} |
  | id             | 26ab2c43-93c8-4add-adb4-2f66ba3f2c80                       
                     |
  | mac_address    | fa:16:3e:b3:ff:5a                                          
                     |
  | name           |                                                            
                     |
  | network_id     | 4d0ef4da-f7d1-45a8-8c22-e284264d9145                       
                     |
  | securitygroups |                                                            
                     |
  | status         | ACTIVE                                                     
                     |
  | tenant_id      | c34402ac0852467083d496e5d9ed15cc                           
                     |
  
+----------------+---------------------------------------------------------------------------------+
  $ quantum floatingip-create net-ext
  Created a new floatingip:
  +---------------------+--------------------------------------+
  | Field               | Value                                |
  +---------------------+--------------------------------------+
  | fixed_ip_address    |                                      |
  | floating_ip_address | 192.168.0.201                        |
  | floating_network_id | 1446b63c-661d-4427-8921-8bd65fd86b49 |
  | id                  | 1cf835e0-c60d-4a61-9192-3089437e5485 |
  | port_id             |                                      |
  | router_id           |                                      |
  | tenant_id           | c34402ac0852467083d496e5d9ed15cc     |
  +---------------------+--------------------------------------+
  $ quantum floatingip-associate 1cf835e0-c60d-4a61-9192-3089437e5485 
26ab2c43-93c8-4add-adb4-2f66ba3f2c80
  Associated floatingip 1cf835e0-c60d-4a61-9192-3089437e5485
  $ quantum floatingip-show 1cf835e0-c60d-4a61-9192-3089437e5485
  +---------------------+--------------------------------------+
  | Field               | Value                                |
  +---------------------+--------------------------------------+
  | fixed_ip_address    | 10.0.0.5                             |
  | floating_ip_address | 192.168.0.201                        |
  | floating_network_id | 1446b63c-661d-4427-8921-8bd65fd86b49 |
  | id                  | 1cf835e0-c60d-4a61-9192-3089437e5485 |
  | port_id             | 26ab2c43-93c8-4add-adb4-2f66ba3f2c80 |
  | router_id           | 128283af-6caa-4db8-baab-3aaf16202b14 |
  | tenant_id           | c34402ac0852467083d496e5d9ed15cc     |
  +---------------------+--------------------------------------+

  ### router-interface-delete success
  ###
  $ quantum -v router-interface-delete routerA sub1
  DEBUG: quantumclient.quantum.v2_0.router.AddInterfaceRouter 
run(Namespace(request_format='json', router_id='routerA', subnet_id='sub1'))
  DEBUG: quantumclient.client REQ: curl -i http://172.17.190.3:5000/v2.0/tokens 
-X POST -H "Content-Type: application/json" -H "Accept: application/json" -H 
"User-Agent: python-quantumclient"

  DEBUG: quantumclient.client REQ BODY: {"auth": {"tenantName": "admin",
  "passwordCredentials": {"username": "admin", "password": "oda"}}}

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:39:35
  GMT', 'vary': 'X-Auth-Token', 'content-length': '2727', 'status':
  '200', 'content-type': 'application/json'}

  DEBUG: quantumclient.client RESP BODY:{"access": {"token": {"expires":
  "2012-11-20T10:39:35Z", "id": "94e12378d5054868aca05c5777d8187d",
  "tenant": {"enabled": true, "description": null, "name": "admin",
  "id": "c34402ac0852467083d496e5d9ed15cc"}}, "serviceCatalog":
  [{"endpoints": [{"adminURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc";,
  "internalURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc"}],
  "endpoints_links": [], "type": "compute", "name": "Compute Service"},
  {"endpoints": [{"adminURL": "http://172.17.190.3:9696/";, "region":
  "RegionOne", "publicURL": "http://172.17.190.3:9696/";, "internalURL":
  "http://172.17.190.3:9696/"}], "endpoints_links": [], "type":
  "network", "name": "Quantum Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:3333";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:3333";, "internalURL":
  "http://172.17.190.3:3333"}], "endpoints_links": [], "type": "s3",
  "name": "S3 Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:9292";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:9292";, "internalURL":
  "http://172.17.190.3:9292"}], "endpoints_links": [], "type": "image",
  "name": "Image Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc";,
  "internalURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc"}],
  "endpoints_links": [], "type": "volume", "name": "Volume Service"},
  {"endpoints": [{"adminURL": "http://172.17.190.3:8773/services/Admin";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8773/services/Cloud";, "internalURL":
  "http://172.17.190.3:8773/services/Cloud"}], "endpoints_links": [],
  "type": "ec2", "name": "EC2 Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:8000/v1";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8000/v1";, "internalURL":
  "http://172.17.190.3:8000/v1"}], "endpoints_links": [], "type":
  "orchestration", "name": "Heat Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:35357/v2.0";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:5000/v2.0";, "internalURL":
  "http://172.17.190.3:5000/v2.0"}], "endpoints_links": [], "type":
  "identity", "name": "Identity Service"}], "user": {"username":
  "admin", "roles_links": [], "id": "5bf27e51aeb746ef8ce9def39ca0156f",
  "roles": [{"name": "admin"}, {"name": "KeystoneAdmin"}, {"name":
  "KeystoneServiceAdmin"}], "name": "admin"}, "metadata": {"is_admin":
  0, "roles": ["fcf5ed5aa2a54c82b99e0d3375335126",
  "4668f624e66b4a2893203b0bd70493b4",
  "f5f2981e7de04aed9b9c41ef53645071"]}}}

  DEBUG: quantumclient.client REQ: curl -i
  http://172.17.190.3:9696/v2.0/routers.json?fields=id&name=routerA -X
  GET -H "User-Agent: python-quantumclient" -H "Content-Type:
  application/json" -H "Accept: application/json" -H "X-Auth-Token:
  94e12378d5054868aca05c5777d8187d"

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:39:35
  GMT', 'status': '200', 'content-length': '61', 'content-type':
  'application/json', 'content-location':
  u'http://172.17.190.3:9696/v2.0/routers.json?fields=id&name=routerA'}

  DEBUG: quantumclient.client RESP BODY:{"routers": [{"id": "128283af-
  6caa-4db8-baab-3aaf16202b14"}]}

  DEBUG: quantumclient.client REQ: curl -i
  http://172.17.190.3:9696/v2.0/subnets.json?fields=id&name=sub1 -X GET
  -H "User-Agent: python-quantumclient" -H "Content-Type:
  application/json" -H "Accept: application/json" -H "X-Auth-Token:
  94e12378d5054868aca05c5777d8187d"

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:39:35
  GMT', 'status': '200', 'content-length': '61', 'content-type':
  'application/json', 'content-location':
  u'http://172.17.190.3:9696/v2.0/subnets.json?fields=id&name=sub1'}

  DEBUG: quantumclient.client RESP BODY:{"subnets": [{"id":
  "65f1f1a6-a615-48a1-9c4e-cc4e813aacb9"}]}

  DEBUG: quantumclient.client REQ: curl -i
  http://172.17.190.3:9696/v2.0/routers/128283af-6caa-4db8-baab-
  3aaf16202b14/remove_router_interface.json PUT -H "User-Agent: python-
  quantumclient" -H "Content-Type: application/json" -H "Accept:
  application/json" -H "X-Auth-Token: 94e12378d5054868aca05c5777d8187d"

  DEBUG: quantumclient.client REQ BODY: {"subnet_id":
  "65f1f1a6-a615-48a1-9c4e-cc4e813aacb9"}

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:39:35
  GMT', 'status': '200', 'content-length': '4', 'content-type':
  'application/json'}

  DEBUG: quantumclient.client RESP BODY:null

  Removed interface from router routerA
  DEBUG: quantumclient.shell clean_up RemoveInterfaceRouter

  
  ### router-delete failed with "internal server error"
  ###
  $ quantum -v router-delete routerA
  DEBUG: quantumclient.quantum.v2_0.router.DeleteRouter 
run(Namespace(id='routerA', request_format='json'))
  DEBUG: quantumclient.client REQ: curl -i http://172.17.190.3:5000/v2.0/tokens 
-X POST -H "Content-Type: application/json" -H "Accept: application/json" -H 
"User-Agent: python-quantumclient"

  DEBUG: quantumclient.client REQ BODY: {"auth": {"tenantName": "admin",
  "passwordCredentials": {"username": "admin", "password": "oda"}}}

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:40:18
  GMT', 'vary': 'X-Auth-Token', 'content-length': '2727', 'status':
  '200', 'content-type': 'application/json'}

  DEBUG: quantumclient.client RESP BODY:{"access": {"token": {"expires":
  "2012-11-20T10:40:18Z", "id": "c688bd71f9834ea28a8cfe5d8927a26b",
  "tenant": {"enabled": true, "description": null, "name": "admin",
  "id": "c34402ac0852467083d496e5d9ed15cc"}}, "serviceCatalog":
  [{"endpoints": [{"adminURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc";,
  "internalURL":
  "http://172.17.190.3:8774/v2/c34402ac0852467083d496e5d9ed15cc"}],
  "endpoints_links": [], "type": "compute", "name": "Compute Service"},
  {"endpoints": [{"adminURL": "http://172.17.190.3:9696/";, "region":
  "RegionOne", "publicURL": "http://172.17.190.3:9696/";, "internalURL":
  "http://172.17.190.3:9696/"}], "endpoints_links": [], "type":
  "network", "name": "Quantum Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:3333";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:3333";, "internalURL":
  "http://172.17.190.3:3333"}], "endpoints_links": [], "type": "s3",
  "name": "S3 Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:9292";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:9292";, "internalURL":
  "http://172.17.190.3:9292"}], "endpoints_links": [], "type": "image",
  "name": "Image Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc";,
  "internalURL":
  "http://172.17.190.3:8776/v1/c34402ac0852467083d496e5d9ed15cc"}],
  "endpoints_links": [], "type": "volume", "name": "Volume Service"},
  {"endpoints": [{"adminURL": "http://172.17.190.3:8773/services/Admin";,
  "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8773/services/Cloud";, "internalURL":
  "http://172.17.190.3:8773/services/Cloud"}], "endpoints_links": [],
  "type": "ec2", "name": "EC2 Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:8000/v1";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:8000/v1";, "internalURL":
  "http://172.17.190.3:8000/v1"}], "endpoints_links": [], "type":
  "orchestration", "name": "Heat Service"}, {"endpoints": [{"adminURL":
  "http://172.17.190.3:35357/v2.0";, "region": "RegionOne", "publicURL":
  "http://172.17.190.3:5000/v2.0";, "internalURL":
  "http://172.17.190.3:5000/v2.0"}], "endpoints_links": [], "type":
  "identity", "name": "Identity Service"}], "user": {"username":
  "admin", "roles_links": [], "id": "5bf27e51aeb746ef8ce9def39ca0156f",
  "roles": [{"name": "admin"}, {"name": "KeystoneAdmin"}, {"name":
  "KeystoneServiceAdmin"}], "name": "admin"}, "metadata": {"is_admin":
  0, "roles": ["fcf5ed5aa2a54c82b99e0d3375335126",
  "4668f624e66b4a2893203b0bd70493b4",
  "f5f2981e7de04aed9b9c41ef53645071"]}}}

  DEBUG: quantumclient.client REQ: curl -i
  http://172.17.190.3:9696/v2.0/routers.json?fields=id&name=routerA -X
  GET -H "User-Agent: python-quantumclient" -H "Content-Type:
  application/json" -H "Accept: application/json" -H "X-Auth-Token:
  c688bd71f9834ea28a8cfe5d8927a26b"

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:40:18
  GMT', 'status': '200', 'content-length': '61', 'content-type':
  'application/json', 'content-location':
  u'http://172.17.190.3:9696/v2.0/routers.json?fields=id&name=routerA'}

  DEBUG: quantumclient.client RESP BODY:{"routers": [{"id": "128283af-
  6caa-4db8-baab-3aaf16202b14"}]}

  DEBUG: quantumclient.client REQ: curl -i
  http://172.17.190.3:9696/v2.0/routers/128283af-6caa-4db8-baab-
  3aaf16202b14.json DELETE -H "User-Agent: python-quantumclient" -H
  "Content-Type: application/json" -H "Accept: application/json" -H "X
  -Auth-Token: c688bd71f9834ea28a8cfe5d8927a26b"

  DEBUG: quantumclient.client RESP:{'date': 'Mon, 19 Nov 2012 10:40:18
  GMT', 'status': '500', 'content-length': '88', 'content-type':
  'application/json'}

  DEBUG: quantumclient.client RESP BODY:{"QuantumError": "Request
  Failed: internal server error while processing your request."}

  DEBUG: quantumclient.v2_0.client Error message: {"QuantumError": "Request 
Failed: internal server error while processing your request."}
  ERROR: cliff.app Request Failed: internal server error while processing your 
request.
  DEBUG: quantumclient.shell clean_up DeleteRouter
  DEBUG: quantumclient.shell got an error: Request Failed: internal server 
error while processing your request.

  ### after disassociate floatingip, delete router success
  ###
  $ quantum floatingip-disassociate 1cf835e0-c60d-4a61-9192-3089437e5485
  Disassociated floatingip 1cf835e0-c60d-4a61-9192-3089437e5485
  $ quantum router-delete routerA
  Deleted router: routerA
  ---

  quantum-server log
  ---
  2012-11-19 19:40:18    ERROR [quantum.api.v2.resource] delete failed
  Traceback (most recent call last):
    File "/opt/stack/quantum/quantum/api/v2/resource.py", line 95, in resource
      result = method(request=request, **args)
    File "/opt/stack/quantum/quantum/api/v2/base.py", line 358, in delete
      obj_deleter(request.context, id)
    File 
"/opt/stack/quantum/quantum/plugins/metaplugin/meta_quantum_plugin.py", line 
361, in delete_router
      return plugin.delete_router(context, id)
    File "/opt/stack/quantum/quantum/db/l3_db.py", line 441, in delete_router
      context.session.delete(router)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", 
line 449, in __exit__
      self.commit()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", 
line 361, in commit
      self._prepare_impl()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", 
line 340, in _prepare_impl
      self.session.flush()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", 
line 1718, in flush
      self._flush(objects)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", 
line 1789, in _flush
      flush_context.execute()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", 
line 331, in execute
      rec.execute(self)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", 
line 498, in execute
      uow
    File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 
115, in delete_obj
      cached_connections, mapper, table, delete)
    File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 
671, in _emit_delete_statements
      connection.execute(statement, del_objects)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", 
line 1449, in execute
      params)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", 
line 1584, in _execute_clauseelement
      compiled_sql, distilled_params
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", 
line 1698, in _execute_context
      context)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", 
line 1691, in _execute_context
      context)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", 
line 331, in do_execute
      cursor.execute(statement, parameters)
    File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in 
execute
      self.errorhandler(self, exc, value)
    File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in 
defaulterrorhandler
      raise errorclass, errorvalue
  IntegrityError: (IntegrityError) (1451, 'Cannot delete or update a parent 
row: a foreign key constraint fails (`ovs_quantum`.`floatingips`, CONSTRAINT 
`floatingips_ibfk_3` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`))') 
'DELETE FROM routers WHERE routers.id = %s' 
('128283af-6caa-4db8-baab-3aaf16202b14',)
  2012-11-19 19:40:18    DEBUG [eventlet.wsgi.server] 172.17.190.3 - - 
[19/Nov/2012 19:40:18] "DELETE 
/v2.0/routers/128283af-6caa-4db8-baab-3aaf16202b14.json HTTP/1.1" 500 215 
0.177709
  ---

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to