Skip to content

Commit

Permalink
If any RI is deleted during reinit, drop them from the parent VN object
Browse files Browse the repository at this point in the history
During reinit, we examine whether each RI is supposed to be deleted.
After we delete an RI, we should delete it from parent object local
copy otherwise when we reinitialize the VN object, it will incorrectly
resurrect the deleted RI.

Change-Id: I21fd133ee79a4b121190c7feb6cee3ba0d1b1b37
Closes-Bug: 1564669
  • Loading branch information
Sachin Bansal committed Apr 3, 2016
1 parent 1c37c05 commit 92fd19b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/config/schema-transformer/to_bgp.py
Expand Up @@ -350,10 +350,12 @@ def reinit(self):
vn_id_list = [vn.uuid for vn in vn_list]
ri_dict = {}
service_ri_dict = {}
ri_deleted = {}
for ri in DBBaseST.list_vnc_obj('routing_instance'):
delete = False
if ri.parent_uuid not in vn_id_list:
delete = True
ri_deleted.setdefault(ri.parent_uuid, []).append(ri.uuid)
else:
# if the RI was for a service chain and service chain no
# longer exists, delete the RI
Expand Down Expand Up @@ -421,6 +423,11 @@ def reinit(self):
gevent.sleep(0.001)
RouteTargetST.reinit()
for vn in vn_list:
if vn.uuid in ri_deleted:
vn_ri_list = vn.get_routing_instances() or []
new_vn_ri_list = [vn_ri for vn_ri in vn_ri_list
if vn_ri['uuid'] not in ri_deleted[vn.uuid]]
vn.routing_instances = new_vn_ri_list
VirtualNetworkST.locate(vn.get_fq_name_str(), vn, vn_acl_dict)
for ri_name, ri_obj in ri_dict.items():
RoutingInstanceST.locate(ri_name, ri_obj)
Expand Down

0 comments on commit 92fd19b

Please sign in to comment.