Bug 1777891

Summary: [RFE] Network cascade deletion
Product: Red Hat OpenStack Reporter: Luis Tomas Bolivar <ltomasbo>
Component: openstack-neutronAssignee: Slawek Kaplonski <skaplons>
Status: ASSIGNED --- QA Contact: Eran Kuris <ekuris>
Severity: low Docs Contact:
Priority: low    
Version: 16.0 (Train)CC: amoralej, chrisw, gurpsing, lmartins, scohen, skaplons
Target Milestone: gaKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luis Tomas Bolivar 2019-11-28 15:41:42 UTC
To be able to delete a neutron network, first we need to detach its subnet from the router and also eliminate all the ports and subports that are on the network.

From the OpenShift on OpenStack with Kuryr use case point of view, it would be great to have a similar command to the one already existing for octavia loadbalancers deletion: openstack loadbalancer delete --cascade LB_ID. In the same way as cascade deleting the loadbalancer makes octavia to take care of the listeners, pools and members deletion before deleting the loadbalancer, it will be great to have an 'openstack network delete --cascade NET_ID' (or --force) that takes care of removing the ports/subports associated to that network.

For the OpenShift on OpenStack with kuryr use case, there is a new network/subnet per each OpenShift namespace. In addition, pods are connected to the Neutron networks by using subports attached to trunks, whose parent port is the one associated to the VM where the pod is running. This leads that everytime a namespace is deleted, instead of just deleting the network, kuryr needs to make the next calls to neutron API:
a) Detach the subnet from the router
b) Remove all the ports in DOWN status
c) Get all the ports in ACTIVE status (those are subports attached to trunks):
- For each of those ports, find the trunk they are attached to
- Detach the port from the associated trunk
- Delete the port
d) Delete the network. Note this will take care of removing the subnet. But also, if the previous calls to detach the subports and delete them has not yet finished, this call will fail and needs to be retried