Skip to content

Commit

Permalink
Merge "If any RI is deleted during reinit, drop them from the parent …
Browse files Browse the repository at this point in the history
…VN object"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 4, 2016
2 parents 18f9c2d + 960befe commit f4bd7df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/config/schema-transformer/to_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,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 @@ -423,6 +425,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 f4bd7df

Please sign in to comment.