Skip to content

Commit

Permalink
config-perf: for shared and external net use list with filters.
Browse files Browse the repository at this point in the history
Use the newly added support for list by filter so that shared nets
and router:external nets (which are based on property value) are
picked efficiently

Change-Id: Ic3904749e9c7f7078058dd89f64d3aed253ee236
Closes-Bug: #1463417
(cherry picked from commit 5594d77)
  • Loading branch information
Hampapur Ajay committed Jun 16, 2015
1 parent 10f40c9 commit 5179daf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Expand Up @@ -328,13 +328,15 @@ def _virtual_network_delete(self, net_id):
#end _virtual_network_delete

def _virtual_network_list(self, parent_id=None, obj_uuids=None,
fields=None, detail=False, count=False):
fields=None, detail=False, count=False,
filters=None):
return self._vnc_lib.virtual_networks_list(
parent_id=parent_id,
obj_uuids=obj_uuids,
fields=fields,
detail=detail,
count=count)
count=count,
filters=filters)
#end _virtual_network_list

def _virtual_machine_interface_read(self, port_id=None, fq_name=None,
Expand Down Expand Up @@ -429,7 +431,7 @@ def _project_list_domain(self, domain_id):
#end _project_list_domain

# find network ids on a given project
def _network_list_project(self, project_id, count=False):
def _network_list_project(self, project_id, count=False, filters=None):
if project_id:
try:
project_uuid = str(uuid.UUID(project_id))
Expand All @@ -440,10 +442,10 @@ def _network_list_project(self, project_id, count=False):

if count:
ret_val = self._virtual_network_list(parent_id=project_uuid,
count=True)
count=True, filters=filters)
else:
ret_val = self._virtual_network_list(parent_id=project_uuid,
detail=True)
detail=True, filters=filters)

return ret_val
#end _network_list_project
Expand Down Expand Up @@ -579,7 +581,8 @@ def _fip_pool_refs_project(self, project_id):

def _network_list_shared_and_ext(self):
ret_list = []
nets = self._network_list_project(project_id=None)
nets = self._network_list_project(project_id=None,
filters={'is_shared':True, 'router_external':True})
for net in nets:
if net.get_router_external() and net.get_is_shared():
ret_list.append(net)
Expand All @@ -588,7 +591,8 @@ def _network_list_shared_and_ext(self):

def _network_list_router_external(self):
ret_list = []
nets = self._network_list_project(project_id=None)
nets = self._network_list_project(project_id=None,
filters={'router_external':True})
for net in nets:
if not net.get_router_external():
continue
Expand All @@ -598,7 +602,8 @@ def _network_list_router_external(self):

def _network_list_shared(self):
ret_list = []
nets = self._network_list_project(project_id=None)
nets = self._network_list_project(project_id=None,
filters={'is_shared':True})
for net in nets:
if not net.get_is_shared():
continue
Expand Down

0 comments on commit 5179daf

Please sign in to comment.