From: armando-migliaccio Date: Thu, 6 Mar 2014 20:40:38 +0000 (-0800) Subject: Makes the Extension loader behavior predictable X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7262ba713b50ab07a932ab7c8acf7ba1d838ff53;p=openstack-build%2Fneutron-build.git Makes the Extension loader behavior predictable When using a cluster of load-balanced Neutron Servers, the order of extension files being loaded may differ from one server to another. This is usually harmless, but it is better to force the list to be loaded in the same way across the entire cluster, just in case something funky is going on. Partial-bug: #1285999 Change-Id: Ib0bfd24fc52b6cd9f90c350d3af496f04a90f50a --- diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index f4c1af79e..6f6210947 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -541,7 +541,10 @@ class ExtensionManager(object): LOG.error(_("Extension path '%s' doesn't exist!"), path) def _load_all_extensions_from_path(self, path): - for f in os.listdir(path): + # Sorting the extension list makes the order in which they + # are loaded predictable across a cluster of load-balanced + # Neutron Servers + for f in sorted(os.listdir(path)): try: LOG.info(_('Loading extension file: %s'), f) mod_name, file_ext = os.path.splitext(os.path.split(f)[-1])