NSXv3: Search for the default section from the end

Upon startup we inquire the backend for the list of firewall section, as
we want to find the specific default section.
Because the firewall section should be located at the bottom, it is more
likely it is located at the end of the list, thus iterating the list in
reversed fashion may save few cycles on startup.

Change-Id: I6212adaa4924cbd46b9d810e95f737d341e10883
This commit is contained in:
Roey Chen 2016-12-05 07:29:09 -08:00
parent 85459a7f9b
commit c52244b8b9

View File

@ -457,7 +457,7 @@ class NsxLibFirewallSection(utils.NsxLibApiBase):
def init_default(self, name, description, nested_groups,
log_sg_blocked_traffic):
fw_sections = self.list()
for section in fw_sections:
for section in reversed(fw_sections):
if section['display_name'] == name:
break
else: