Segment of ha network is deleted when a ha router is removed

Bug #1733054 reported by sunzuohua
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
New
Undecided
sunzuohua

Bug Description

The repro steps is as follows:
1.Create at least two ha router.
2.Delete one ha router.

Then the ha network is not deleted, but the segment of this ha network is deleted.
[root@cdpm01 ~]# neutron net-show 5edf9be2-2a07-4350-98dd-9d3c12a9b9dd
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+---------------------------+----------------------------------------------------+
| Field | Value |
+---------------------------+----------------------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2017-11-17T01:40:44Z |
| description | |
| id | 5edf9be2-2a07-4350-98dd-9d3c12a9b9dd |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1450 |
| name | HA network tenant a2794be2207a45b5be5b2423bfa08c2c |
| port_security_enabled | True |
| project_id | |
| provider:network_type | |
| provider:physical_network | |
| provider:segmentation_id | |
| qos_policy_id | |
| revision_number | 5 |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | a356ecf7-c4a0-4596-b742-d1521a2aa38f |
| tags | |
| tenant_id | |
| updated_at | 2017-11-17T09:26:25Z |
+---------------------------+----------------------------------------------------+

The reason:
1.When a ha router is deleted, neutron attempted to delete the ha network.
2.When deleting a network, the event:events.BEFORE_DELETE for resources.NETWORK is send[[1]] and _delete_segments_for_network is invoked to delete the segment[2].
3.After sending the event:events.BEFORE_DELETE for resources.NETWORK, the ha network is checked to be in use[3], so it is not deleted

Mybe we should check if the network is in use before sending the event:events.BEFORE_DELETE for resources.NETWORK?
Or Check if the router being deleted is the last router belong to the tenant.

[1]https://github.com/openstack/neutron/blob/master/neutron/db/db_base_plugin_v2.py#L433
[2]https://github.com/openstack/neutron/blob/master/neutron/services/segments/db.py#L315
[3]https://github.com/openstack/neutron/blob/master/neutron/db/db_base_plugin_v2.py#L435

sunzuohua (zuohuasun)
Changed in neutron:
assignee: nobody → sunzuohua (zuohuasun)
sunzuohua (zuohuasun)
description: updated
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.