Skip to content

Commit

Permalink
If any RI is deleted during reinit, drop then 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
(cherry picked from commit f4da987)
  • Loading branch information
Sachin Bansal committed Apr 2, 2016
1 parent 73ce0e7 commit ab13f51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/config/schema-transformer/to_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
ConnectionStatus
from cfgm_common.uve.cfgm_cpuinfo.ttypes import NodeStatusUVE, NodeStatus
from db import SchemaTransformerDB
from cStringIO import StringIO
from cfgm_common.utils import cgitb_hook

_PROTO_STR_TO_NUM = {
Expand Down Expand Up @@ -2592,6 +2593,7 @@ def reinit(self):
vn_id_list = [vn.uuid for vn in vn_list]
ri_list = _vnc_lib.routing_instances_list(detail=True)
ri_dict = {}
ri_deleted = {}
for ri in ri_list:
delete = False
if ri.parent_uuid not in vn_id_list:
Expand All @@ -2602,6 +2604,7 @@ def reinit(self):
sc_id = VirtualNetworkST._get_service_id_from_ri(ri.name)
if sc_id and sc_id not in ServiceChain:
delete = True
ri_deleted.setdefault(ri.parent_uuid, []).append(ri.uuid)
else:
ri_dict[ri.get_fq_name_str()] = ri
if delete:
Expand Down Expand Up @@ -2670,6 +2673,11 @@ def reinit(self):

start_time = time.time()
for index, vn in enumerate(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,
ri_dict)
if not index % 100:
Expand Down

0 comments on commit ab13f51

Please sign in to comment.