Comment 1 for bug 1674840

Revision history for this message
Sam Su (sam-su) wrote :

I think it is because the current network deletion code doesn't follow the sequence as the network creation, the deletion should follow the reverse sequence(like the operations push and pop in a stack) to release related resources.

For example:
In the network creation function _create_network_db: it create network segment first, then mechanism_manager.create_network_precommit.

In the network deletion function delete_network: it send related deletion events of resources.NETWORK in the following order:
   events.BEFORE_DELETE-> events.PRECOMMIT_DELETE -> events.AFTER_DELETE

when notified the event events.PRECOMMIT_DELETE, mechanism_manager.delete_network_precommit was triggered, however delete_segment was triggered either on the same event events.PRECOMMIT_DELETE(current implementation) or on the prior event events.BEFORE_DELETE (in the fix https://review.openstack.org/#/c/429441/8/neutron/services/segments/db.py ).

It is better to follow the push and pop operations to do the creation and deletion to avoid any potential resources dependence.