From c52244b8b9f1d5bb4530d80c0493091a600afca0 Mon Sep 17 00:00:00 2001 From: Roey Chen Date: Mon, 5 Dec 2016 07:29:09 -0800 Subject: [PATCH] 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 --- vmware_nsxlib/v3/security.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmware_nsxlib/v3/security.py b/vmware_nsxlib/v3/security.py index 66d98ebd..ec9647d1 100644 --- a/vmware_nsxlib/v3/security.py +++ b/vmware_nsxlib/v3/security.py @@ -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: