]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Makes the Extension loader behavior predictable
authorarmando-migliaccio <armamig@gmail.com>
Thu, 6 Mar 2014 20:40:38 +0000 (12:40 -0800)
committerarmando-migliaccio <armamig@gmail.com>
Thu, 6 Mar 2014 20:44:27 +0000 (12:44 -0800)
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

neutron/api/extensions.py

index f4c1af79e614b43072a90b8824132b845a6b7c50..6f6210947a56c59b48e8d50e5920d51d4f3f861c 100644 (file)
@@ -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])