Can't delete subnetpool when using existing neutron network

Bug #1650130 reported by Dongcan Ye
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kuryr-libnetwork
Fix Released
Undecided
Dongcan Ye

Bug Description

How to reproduce:
=================

1. Create Neutron network using neutron-client:
===============================================
# neutron net-create test2
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2016-12-15T05:28:13Z |
| description | |
| id | 303825d7-65c1-4678-9d23-6e06a7552586 |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1450 |
| name | test2 |
| port_security_enabled | True |
| project_id | ea3f909d09914ae9b9210dc449a6e39b |
| provider:network_type | vxlan |
| provider:physical_network | |
| provider:segmentation_id | 78 |
| qos_policy_id | |
| revision_number | 3 |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | ea3f909d09914ae9b9210dc449a6e39b |
| updated_at | 2016-12-15T05:28:13Z |
+---------------------------+--------------------------------------+

2. Using docker client create network using existing Neutron network:
=====================================================================
# docker network create -d kuryr --ipam-driver=kuryr --subnet=90.10.0.0/24 --gateway=90.10.0.1 -o neutron.net.name=test2 test2_docker_net
f37928cdea4e8acfd368bcf69a05f1a99c82d190bdce60146e3ae329a5893ded

3. Using docker client delete network:
======================================
# docker network rm test2_docker_net
test2_docker_net

In kuryr-libnetwork, raise log info:
2016-12-15 13:35:17.715 13562 DEBUG kuryr_libnetwork [-] Received JSON data {u'PoolID': u'82788620-b9a6-4eae-af94-96a204f810b8'} for /IpamDriver.ReleasePool ipam_release_pool /opt/stack/kuryr-libnetwork/kuryr_libnetwork/controllers.py:1406
2016-12-15 13:35:17.824 13562 DEBUG neutronclient.v2_0.client [-] Error message: {"NeutronError": {"message": "Unable to delete subnet pool: Subnet pool has existing allocations.", "type": "SubnetPoolDeleteError", "detail": ""}} _handle_fault_response /usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py:265
2016-12-15 13:35:17.824 13562 DEBUG neutronclient.v2_0.client [-] DELETE call to neutron for http://10.20.30.20:9696/v2.0/subnetpools/82788620-b9a6-4eae-af94-96a204f810b8.json used request id req-14ee6c02-ad7d-4b4b-8d40-02488cb22046 _append_request_id /usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py:127
[2016-12-15 13:35:17,825] ERROR in controllers: Error happened during deleting a Neutron subnetpool: Unable to delete subnet pool: Subnet pool has existing allocations.
Neutron server returns request_ids: ['req-14ee6c02-ad7d-4b4b-8d40-02488cb22046']
2016-12-15 13:35:17.825 13562 ERROR kuryr_libnetwork [-] Error happened during deleting a Neutron subnetpool: Unable to delete subnet pool: Subnet pool has existing allocations.
Neutron server returns request_ids: ['req-14ee6c02-ad7d-4b4b-8d40-02488cb22046']
[2016-12-15 13:35:17,825] ERROR in utils: Unexpected error happened: Unable to delete subnet pool: Subnet pool has existing allocations.
Neutron server returns request_ids: ['req-14ee6c02-ad7d-4b4b-8d40-02488cb22046']
2016-12-15 13:35:17.825 13562 ERROR kuryr_libnetwork [-] Unexpected error happened: Unable to delete subnet pool: Subnet pool has existing allocations.
Neutron server returns request_ids: ['req-14ee6c02-ad7d-4b4b-8d40-02488cb22046']
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/stack/kuryr-libnetwork/kuryr_libnetwork/controllers.py", line 1410, in ipam_release_pool
    app.neutron.delete_subnetpool(pool_id)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 822, in delete_subnetpool
    return self.delete(self.subnetpool_path % (subnetpool))
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 356, in delete
    headers=headers, params=params)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 337, in retry_request
    headers=headers, params=params)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 300, in do_request
    self._handle_fault_response(status_code, replybody, resp)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 275, in _handle_fault_response
    exception_handler_v20(status_code, error_body)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 91, in exception_handler_v20
    request_ids=request_ids)
BadRequest: Unable to delete subnet pool: Subnet pool has existing allocations.

Dongcan Ye (hellochosen)
Changed in kuryr-libnetwork:
assignee: nobody → Dongcan Ye (hellochosen)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kuryr-libnetwork (master)

Fix proposed to branch: master
Review: https://review.openstack.org/411144

Changed in kuryr-libnetwork:
status: New → In Progress
Dongcan Ye (hellochosen)
summary: - Can't delete subnetpool when deleting network
+ Can't delete subnetpool when using existing neutron network
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kuryr-libnetwork (master)

Reviewed: https://review.openstack.org/411144
Committed: https://git.openstack.org/cgit/openstack/kuryr-libnetwork/commit/?id=678dafbad8be7202880b8bc210c66e026cb6660a
Submitter: Jenkins
Branch: master

commit 678dafbad8be7202880b8bc210c66e026cb6660a
Author: Dongcan Ye <email address hidden>
Date: Thu Dec 15 15:17:10 2016 +0800

    Delete kuryr-subnet in existing Neutron network

    When we create docker network using existing Neutron network,
    we should delete the subnet created by kuryr.
    Otherwise, there will leave the subnet and subnetpool undeleted.

    Change-Id: Ieb93bb935e52fb5cd3043a1c5c60656b93a37298
    Closes-Bug: #1650130

Changed in kuryr-libnetwork:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.